You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the issue here is that it's not clear what Measurement#to_f is doing, in this case, but to get the correct value you should be using Measurement#value here instead:
1000.meters.to.kilometers.value# => 1
The way switching between prefixes like kilo is by storing the information like this:
The idea at the time was that kilometers and meters are conceptually the same measurement just with an exponent, so calling Alchemist#to_f gives you the following:
defto_f(precise_value * exponent).to_fend
Which describes it in terms of the base meters, instead of kilometers. I think I agree that this can be confusing so my plan is to resolve this for the "eventual" 1.0 release.
1000.meters.to.kilometers is returning 1000. it should be 1
The text was updated successfully, but these errors were encountered: