21f19d70a70e2a2e9d70f70d02780780d44e8659
2 - Copyright (C) 2009 Nick Bowler.
4 - License BSD2: 2-clause BSD license. See LICENSE for full terms.
5 - This is free software: you are free to change and redistribute it.
6 - There is NO WARRANTY, to the extent permitted by law.
9 module Data
.Floating
.Instances
where
11 import qualified Prelude
12 import Prelude
hiding (round, floor, ceiling, truncate)
13 import Data
.Floating
.Classes
16 instance Integral a
=> Roundable
(Ratio a
) where
17 toIntegral
= Just
. fst . properFraction
19 |
abs frac
>= 1%2
= int%1
+ signum frac
21 where (int
, frac
) = properFraction x