Closed arekfu closed 7 years ago
This is a legitimate bug that is fixed in master
but not in the released version.
I will create a maintenance release. Thanks for reporting.
Actually I was incorrect, this isn't even fixed in master
, there are two issues that combine to make this, only one of which is fixed in master
. Working on a fix.
Wow. This is surprisingly tricky to get right while maintaining both the polymorphism we have now and the fact that conversion factor arithmetic is done exactly for as long as possible and then rounded at the last minute. I'm starting to wonder if there is a solution that doesn't require either overlapping instances and some ad hoc typeclass or a really zany type for mega
and friends. I need to think about this one some more tomorrow. Great test case, thanks.
In a nutshell the issue is that we want to be able to apply mega
and friends to things using only a Num
constraint, because after all it only involves a multiplication. But we also want to compute the conversion factor using exact arithmetic and only convert it to, say, Double
once we have constructed some large unit expression.
Prepared a maintenance release for this but won't be deploying it until I can review it with fresh eyes in the morning. If it helps you to have it before that, use it from here: https://github.com/dmcclean/dimensional/tree/fix-175.
Thanks a lot. It seems to work here.
Sure thing. Thanks again for the report, it's much appreciated.
Fixed in 1.0.1.3 which just hit hackage.
I am not sure I am using this package correctly, but:
Is there any solution?