unwitch-3.0.0: converts between primitives
Safe HaskellNone
LanguageHaskell2010

Unwitch.Convert.Ratio

Description

Conversions from Ratio.

Synopsis

Documentation

unwrapIfDenominatorOne :: (Eq a, Num a) => Ratio a -> Maybe a Source #

Converts if denominator == 1

fromIntegralToRatio :: Integral a => a -> Ratio a Source #

Wraps an integral value as a Ratio with denominator 1.

toFloat :: Rational -> Float Source #

Converts a Rational to Float. This is lossy for rationals that cannot be exactly represented as Float.

toDouble :: Rational -> Double Source #

Converts a Rational to Double. This is lossy for rationals that cannot be exactly represented as Double.