diff options
Diffstat (limited to 'lib/Postdelay/TimeSpec/Utils.hs')
-rw-r--r-- | lib/Postdelay/TimeSpec/Utils.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Postdelay/TimeSpec/Utils.hs b/lib/Postdelay/TimeSpec/Utils.hs index c10fc4b..a8c7d4a 100644 --- a/lib/Postdelay/TimeSpec/Utils.hs +++ b/lib/Postdelay/TimeSpec/Utils.hs | |||
@@ -74,7 +74,7 @@ boundedNatural padded (I.intersection (0 <=..< PosInf) -> bounds) = do | |||
74 | | otherwise = error "boundedNatural in undefined state" | 74 | | otherwise = error "boundedNatural in undefined state" |
75 | 75 | ||
76 | minDigits, maxDigits :: Extended Int | 76 | minDigits, maxDigits :: Extended Int |
77 | (minDigits, maxDigits) = ( fmap digits . I.lowerBound $ close bounds | 77 | (minDigits, maxDigits) = ( max 1 . fmap digits . I.lowerBound $ close bounds |
78 | , fmap digits . I.upperBound $ close bounds | 78 | , fmap digits . I.upperBound $ close bounds |
79 | ) | 79 | ) |
80 | where | 80 | where |
@@ -84,7 +84,7 @@ boundedNatural padded (I.intersection (0 <=..< PosInf) -> bounds) = do | |||
84 | | otherwise = int | 84 | | otherwise = int |
85 | 85 | ||
86 | digits :: n -> Int | 86 | digits :: n -> Int |
87 | digits = ceiling . (logBase 10 :: Double -> Double) . realToFrac . abs | 87 | digits = succ . floor . (logBase 10 :: Double -> Double) . realToFrac . abs |
88 | 88 | ||
89 | boundedRational :: forall s m n. (Show n, RealFrac n, StringParser s m) | 89 | boundedRational :: forall s m n. (Show n, RealFrac n, StringParser s m) |
90 | => Bool -- ^ Require number to be padded with zeroes | 90 | => Bool -- ^ Require number to be padded with zeroes |