|
|
|
@ -45,7 +45,7 @@ toDouble :: Price -> Double |
|
|
|
toDouble p = fromIntegral (priceQuants p) / fromIntegral mega |
|
|
|
toDouble p = fromIntegral (priceQuants p) / fromIntegral mega |
|
|
|
|
|
|
|
|
|
|
|
fromDouble :: Double -> Price |
|
|
|
fromDouble :: Double -> Price |
|
|
|
fromDouble d = Price { priceQuants = truncate (d * fromIntegral mega) } |
|
|
|
fromDouble d = Price { priceQuants = truncate ((d * fromIntegral mega) + 0.5) } |
|
|
|
|
|
|
|
|
|
|
|
toScientific :: Price -> Scientific |
|
|
|
toScientific :: Price -> Scientific |
|
|
|
toScientific p = normalize $ scientific (toInteger $ priceQuants p) (-6) |
|
|
|
toScientific p = normalize $ scientific (toInteger $ priceQuants p) (-6) |
|
|
|
|