I created a variable like so:
When I print it converted to arcMinutes:
I get 21599.568008639824
which is off by about a half an arc minute.
If I create my own unit "moa"
and then print it in moa:
I get 21600.0 as I would expect.
I have seen posts on StackOverflow dating back to 2018 discussing this. I guess it's still broken?
This was run on Xcode, Version 11.6.
I apologize if there are any typos in the code, I didn't run it on this computer, so I had to retype it.
Code Block var d = Measurement(Value: 360.0, unit: UnitAngle.degrees)
When I print it converted to arcMinutes:
Code Block print(d.converted(to: UnitAngle.arcMinutes).value)
I get 21599.568008639824
which is off by about a half an arc minute.
If I create my own unit "moa"
Code Block extension { public static moa = UnitAngle(symbol: "moa", converter: UnitConverterLinear(coefficient: 1.0/60.0)) }
and then print it in moa:
Code Block print(d.converted(to: UnitAngle.moa).value)
I get 21600.0 as I would expect.
I have seen posts on StackOverflow dating back to 2018 discussing this. I guess it's still broken?
This was run on Xcode, Version 11.6.
I apologize if there are any typos in the code, I didn't run it on this computer, so I had to retype it.