    {-# LANGUAGE TypeSynonymInstances #-}
    module Foundation.Numerical.Floating
        ( FloatingPoint(..)
        ) where

    import           Basement.Compat.Base
    import           Data.Proxy
    import qualified Prelude

    -- | IEEE754 Floating Point
    class FloatingPoint a where
        floatRadix  :: Proxy a -> Integer
        floatDigits :: Proxy a -> Int
        floatRange  :: Proxy a -> (Int, Int)
        floatDecode :: a -> (Integer, Int)
        floatEncode :: Integer -> Int -> a

    instance FloatingPoint Float where
        floatRadix :: Proxy Float -> Integer
    floatRadix _ = Float -> Integer
    forall a. RealFloat a => a -> Integer
    Prelude.floatRadix (0.0 :: Float)
        floatDigits :: Proxy Float -> Int
    floatDigits _ = Float -> Int
    forall a. RealFloat a => a -> Int
    Prelude.floatDigits (0.0 :: Float)
        floatRange :: Proxy Float -> (Int, Int)
    floatRange _ = Float -> (Int, Int)
    forall a. RealFloat a => a -> (Int, Int)
    Prelude.floatRange (0.0 :: Float)
        floatDecode :: Float -> (Integer, Int)
    floatDecode = Float -> (Integer, Int)
    forall a. RealFloat a => a -> (Integer, Int)
    Prelude.decodeFloat
        floatEncode :: Integer -> Int -> Float
    floatEncode = Integer -> Int -> Float
    forall a. RealFloat a => Integer -> Int -> a
    Prelude.encodeFloat

    instance FloatingPoint Double where
        floatRadix :: Proxy Double -> Integer
    floatRadix _ = Double -> Integer
    forall a. RealFloat a => a -> Integer
    Prelude.floatRadix (0.0 :: Double)
        floatDigits :: Proxy Double -> Int
    floatDigits _ = Double -> Int
    forall a. RealFloat a => a -> Int
    Prelude.floatDigits (0.0 :: Double)
        floatRange :: Proxy Double -> (Int, Int)
    floatRange _ = Double -> (Int, Int)
    forall a. RealFloat a => a -> (Int, Int)
    Prelude.floatRange (0.0 :: Double)
        floatDecode :: Double -> (Integer, Int)
    floatDecode = Double -> (Integer, Int)
    forall a. RealFloat a => a -> (Integer, Int)
    Prelude.decodeFloat
        floatEncode :: Integer -> Int -> Double
    floatEncode = Integer -> Int -> Double
    forall a. RealFloat a => Integer -> Int -> a
    Prelude.encodeFloat