unitsofmeasurement / indriya

JSR 385 - Reference Implementation
Other
118 stars 40 forks source link

Adding celsius fails #288

Closed schophil closed 4 years ago

schophil commented 4 years ago

https://github.com/unitsofmeasurement/indriya/blob/9bd4b97507a60c847802ef09ecc15e6e32f40e9e/src/main/java/tech/units/indriya/quantity/NumberQuantity.java#L171

        Quantity<Temperature> temp1 = Quantities.getQuantity(6, Units.CELSIUS, Quantity.Scale.RELATIVE);
        Quantity<Temperature> temp2 = Quantities.getQuantity(20, Units.CELSIUS, Quantity.Scale.RELATIVE);

        System.out.println(temp1);
        System.out.println(temp2);
        System.out.println(temp1.add(temp2));

Result:

6 ℃
20 ℃
12 ℃

I think it is caused by the this.getValue() on line 171. Shouldn't it be that.getValue()?

andi-huber commented 4 years ago

Yup, thanks for spotting this!