hgeometry-combinatorial
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellSafe-Inferred
LanguageGHC2021

HGeometry.Number.Ratio.Generalized

Description

Generalized Ratio type that accepts arbitrary 'Num a' types rather than just Integral ones as in Data.Ratio

Synopsis

Documentation

data GRatio a Source #

Generalized Ratio type that accepts more general "base" types than just Integral ones. That does mean we cannot normalize the intermediate expressions, so expect the numbers to become big quite quickly!

invariant: the denominator is not zero

Instances

Instances details
(Num a, Eq a) => Num (GRatio a) Source # 
Instance details

Defined in HGeometry.Number.Ratio.Generalized

Methods

(+) :: GRatio a -> GRatio a -> GRatio a #

(-) :: GRatio a -> GRatio a -> GRatio a #

(*) :: GRatio a -> GRatio a -> GRatio a #

negate :: GRatio a -> GRatio a #

abs :: GRatio a -> GRatio a #

signum :: GRatio a -> GRatio a #

fromInteger :: Integer -> GRatio a #

(Num a, Eq a) => Fractional (GRatio a) Source # 
Instance details

Defined in HGeometry.Number.Ratio.Generalized

Methods

(/) :: GRatio a -> GRatio a -> GRatio a #

recip :: GRatio a -> GRatio a #

fromRational :: Rational -> GRatio a #

Show a => Show (GRatio a) Source # 
Instance details

Defined in HGeometry.Number.Ratio.Generalized

Methods

showsPrec :: Int -> GRatio a -> ShowS #

show :: GRatio a -> String #

showList :: [GRatio a] -> ShowS #

(Eq a, Num a) => Eq (GRatio a) Source # 
Instance details

Defined in HGeometry.Number.Ratio.Generalized

Methods

(==) :: GRatio a -> GRatio a -> Bool #

(/=) :: GRatio a -> GRatio a -> Bool #

(Ord a, Num a) => Ord (GRatio a) Source # 
Instance details

Defined in HGeometry.Number.Ratio.Generalized

Methods

compare :: GRatio a -> GRatio a -> Ordering #

(<) :: GRatio a -> GRatio a -> Bool #

(<=) :: GRatio a -> GRatio a -> Bool #

(>) :: GRatio a -> GRatio a -> Bool #

(>=) :: GRatio a -> GRatio a -> Bool #

max :: GRatio a -> GRatio a -> GRatio a #

min :: GRatio a -> GRatio a -> GRatio a #

(%) :: (Eq a, Num a) => a -> a -> GRatio a Source #

smart constructor to construct a GRatio. Throws an exception if the denominator is zero.

numerator :: GRatio a -> a Source #

Get the numerator

denominator :: GRatio a -> a Source #

Get the denominator