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 was reading through the code and noticed a TODO item in the function ordersOfMagnitude -- TODO: logBase 10 1000000 /= 6 but 5, fix this
I noticed that it came from this line (floor :: Double -> Int) . logBase 10)
I was reading through the code and noticed a TODO item in the function
ordersOfMagnitude
-- TODO: logBase 10 1000000 /= 6 but 5, fix this
I noticed that it came from this line
(floor :: Double -> Int) . logBase 10)
There was a discussion on StackOverflow about the logbase 10 issues https://stackoverflow.com/questions/26844123/haskell-logbase-error.
Is there any particular reason why we use
floor
in this scenario? Since we're always dealing with integer results, perhaps we can implement something similar to what GHC did or even just round in a simpler case.https://github.com/ghc/packages-integer-gmp/blob/master/GHC/Integer/Logarithms.hs
Thanks for your time!
The text was updated successfully, but these errors were encountered: