numeric-prelude-0.4.1: An experimental alternative hierarchy of numeric type classes

Portability portable (?) provisional numericprelude@henning-thielemann.de None

Number.Ratio

Description

Ratios of mathematical objects.

Synopsis

# Documentation

data T a Source

Constructors

 :% Fieldsnumerator :: !a denominator :: !a

Instances

 C a => C Integer (T a) Eq a => Eq (T a) Integral a => Fractional (T a) Integral a => Num (T a) (Ord a, C a) => Ord (T a) (Read a, C a) => Read (T a) (Show a, C a) => Show (T a) (Arbitrary a, C a, C a) => Arbitrary (T a) (Storable a, C a) => Storable (T a) (Random a, C a, C a) => Random (T a) (Ord a, C a) => C (T a) C a => C (T a) (C a, C a) => C (T a) C a => C (T a) (C a, C a) => C (T a) C a => C (T a) (C a, C a) => C (T a) (C a, C a) => C (T a) (C a, C a) => C (T a) (Ord a, C a) => C (T a) C a => C (T a) (T a) C a => C (T a) (T a) C a => C (T a) (T a) (C a, C a) => Sqr (T a) (T a) (C a, C a, C a) => C (T a) (T a) (C a, C a) => C (T a) (T a)

(%) :: C a => a -> a -> T aSource

fromValue :: C a => a -> T aSource

recip :: (C a, C a) => T a -> T aSource

scale :: C a => a -> T a -> T aSource

split :: C a => T a -> (a, T a)Source

similar to `splitFraction`

showsPrecAuto :: (Eq a, C a, Show a) => Int -> T a -> String -> StringSource

This is an alternative show method that is more user-friendly but also potentially more ambigious.

toRational98 :: Integral a => T a -> Ratio aSource

Necessary when mixing NumericPrelude.Numeric Rationals with Prelude98 Rationals