Closed imclem closed 3 years ago
Comparing the double values is not always a good idea, but why don't you use DEGREE_ANGLE
in the NonSI
unit system implementation from https://github.com/unitsofmeasurement/si-units?
There you will also find how it's done which is closer to the first approach but using precise enough values including the Rational number type instead of double or other primitives.
You'll also find JUnit tests for it. I close this here, if you found any problems with the SI units or suggestions for improvements, please create a new ticket there.
@keilw I don't use it because I didn't know it existed... I will use it, thanks a lot !
Hi there,
First of all, thank you for this library, it's a real joy to use!
I'm trying to add a new type "Degree" to represent an angle in degrees.
If I define the unit like this:
This does not produce the result that I expect (not even close), I get the following double value:
0.017453292519943295
.I also tried defined the unit like this:
But it produce the same result.
Now if I define the degree unit like this (thanks #257):
Everything works properly.
I tried debugging the converter method, but can't find why the first implementation is not working.
Why the first implementation is not working ? And is there a way to make it work ?
Thanks in advance