numeric-prelude-0.4.4: An experimental alternative hierarchy of numeric type classes
Safe HaskellNone
LanguageHaskell98

NumericPrelude.Numeric

Synopsis

Documentation

(+), (-) :: C a => a -> a -> a infixl 6 +, - Source #

add and subtract elements

(+), (-) :: C a => a -> a -> a infixl 6 +, - Source #

add and subtract elements

negate :: C a => a -> a Source #

inverse with respect to +

zero :: C a => a Source #

zero element of the vector space

subtract :: C a => a -> a -> a Source #

subtract is (-) with swapped operand order. This is the operand order which will be needed in most cases of partial application.

sum :: C a => [a] -> a Source #

Sum up all elements of a list. An empty list yields zero.

This function is inappropriate for number types like Peano. Maybe we should make sum a method of Additive. This would also make lengthLeft and lengthRight superfluous.

sum1 :: C a => [a] -> a Source #

Sum up all elements of a non-empty list. This avoids including a zero which is useful for types where no universal zero is available. ToDo: Should have NonEmpty type.

\(QC.NonEmpty ns) -> A.sum ns == (A.sum1 ns :: Integer)

isZero :: C a => a -> Bool Source #

(*) :: C a => a -> a -> a infixl 7 Source #

one :: C a => a Source #

(^) :: C a => a -> Integer -> a infixr 8 Source #

The exponent has fixed type Integer in order to avoid an arbitrarily limitted range of exponents, but to reduce the need for the compiler to guess the type (default type). In practice the exponent is most oftenly fixed, and is most oftenly 2. Fixed exponents can be optimized away and thus the expensive computation of Integers doesn't matter. The previous solution used a C constrained type and the exponent was converted to Integer before computation. So the current solution is not less efficient.

A variant of ^ with more flexibility is provided by ringPower.

ringPower :: (C a, C b) => b -> a -> a Source #

A prefix function of (^) with a parameter order that fits the needs of partial application and function composition. It has generalised exponent.

See: Argument order of expNat on http://www.haskell.org/pipermail/haskell-cafe/2006-September/018022.html

sqr :: C a => a -> a Source #

product :: C a => [a] -> a Source #

product1 :: C a => [a] -> a Source #

div, mod :: C a => a -> a -> a infixl 7 `div`, `mod` Source #

div, mod :: C a => a -> a -> a infixl 7 `div`, `mod` Source #

divMod :: C a => a -> a -> (a, a) Source #

\n (QC.NonZero m) -> let (q,r) = divMod n m in n == (q*m+r :: Integer)

divides :: (C a, C a) => a -> a -> Bool Source #

even :: (C a, C a) => a -> Bool Source #

odd :: (C a, C a) => a -> Bool Source #

(/) :: C a => a -> a -> a infixl 7 Source #

recip :: C a => a -> a Source #

(^-) :: C a => a -> Integer -> a infixr 8 Source #

fieldPower :: (C a, C b) => b -> a -> a Source #

A prefix function of (^-). It has a generalised exponent.

fromRational :: C a => Rational -> a Source #

Needed to work around shortcomings in GHC.

(^/) :: C a => a -> Rational -> a infixr 8 Source #

sqrt :: C a => a -> a Source #

pi :: C a => a Source #

exp, log :: C a => a -> a Source #

exp, log :: C a => a -> a Source #

logBase, (**) :: C a => a -> a -> a infixr 8 Source #

logBase, (**) :: C a => a -> a -> a infixr 8 Source #

(^?) :: C a => a -> a -> a infixr 8 Source #

sin, cos, tan :: C a => a -> a Source #

sin, cos, tan :: C a => a -> a Source #

sin, cos, tan :: C a => a -> a Source #

asin, acos, atan :: C a => a -> a Source #

asin, acos, atan :: C a => a -> a Source #

asin, acos, atan :: C a => a -> a Source #

sinh, cosh, tanh :: C a => a -> a Source #

sinh, cosh, tanh :: C a => a -> a Source #

sinh, cosh, tanh :: C a => a -> a Source #

asinh, acosh, atanh :: C a => a -> a Source #

asinh, acosh, atanh :: C a => a -> a Source #

asinh, acosh, atanh :: C a => a -> a Source #

abs :: C a => a -> a Source #

signum :: C a => a -> a Source #

quot, rem :: C a => a -> a -> a infixl 7 `quot`, `rem` Source #

quot, rem :: C a => a -> a -> a infixl 7 `quot`, `rem` Source #

quotRem :: C a => a -> a -> (a, a) Source #

splitFraction :: (C a, C b) => a -> (b, a) Source #

\x -> (x::Rational) == (uncurry (+) $ mapFst fromInteger $ splitFraction x)
\x -> uncurry (==) $ mapFst (((x::Double)-) . fromInteger) $ splitFraction x
\x -> uncurry (==) $ mapFst (((x::Rational)-) . fromInteger) $ splitFraction x
\x -> splitFraction x == (floor (x::Double) :: Integer, fraction x)
\x -> splitFraction x == (floor (x::Rational) :: Integer, fraction x)

fraction :: C a => a -> a Source #

\x -> let y = fraction (x::Double) in 0<=y && y<1
\x -> let y = fraction (x::Rational) in 0<=y && y<1

truncate :: (C a, C b) => a -> b Source #

round :: (C a, C b) => a -> b Source #

ceiling, floor :: (C a, C b) => a -> b Source #

\x -> ceiling (-x) == negate (floor (x::Double) :: Integer)
\x -> ceiling (-x) == negate (floor (x::Rational) :: Integer)

ceiling, floor :: (C a, C b) => a -> b Source #

\x -> ceiling (-x) == negate (floor (x::Double) :: Integer)
\x -> ceiling (-x) == negate (floor (x::Rational) :: Integer)

approxRational :: (C a, C a) => a -> a -> Rational Source #

TODO: Should be moved to a continued fraction module.

atan2 :: C a => a -> a -> a Source #

toRational :: C a => a -> Rational Source #

Lossless conversion from any representation of a rational to Rational

toInteger :: C a => a -> Integer Source #

fromIntegral :: (C a, C b) => a -> b Source #

isUnit :: C a => a -> Bool Source #

extendedGCD :: C a => a -> a -> (a, (a, a)) Source #

Compute the greatest common divisor and solve a respective Diophantine equation.

  (g,(a,b)) = extendedGCD x y ==>
       g==a*x+b*y   &&  g == gcd x y

TODO: This method is not appropriate for the PID class, because there are rings like the one of the multivariate polynomials, where for all x and y greatest common divisors of x and y exist, but they cannot be represented as a linear combination of x and y. TODO: The definition of extendedGCD does not return the canonical associate.

gcd :: C a => a -> a -> a Source #

The Greatest Common Divisor is defined by:

  gcd x y == gcd y x
  divides z x && divides z y ==> divides z (gcd x y)   (specification)
  divides (gcd x y) x

lcm :: C a => a -> a -> a Source #

Least common multiple

euclid :: (C a, C a) => (a -> a -> a) -> a -> a -> a Source #

extendedEuclid :: (C a, C a) => (a -> a -> (a, a)) -> a -> a -> (a, (a, a)) Source #

(%) :: C a => a -> a -> T a infixl 7 Source #

numerator :: T a -> a Source #

denominator :: T a -> a Source #

data Integer #

Arbitrary precision integers. In contrast with fixed-size integral types such as Int, the Integer type represents the entire infinite range of integers.

For more information about this type's representation, see the comments in its implementation.

Instances

Instances details
Enum Integer

Since: base-2.1

Instance details

Defined in GHC.Enum

Eq Integer 
Instance details

Defined in GHC.Integer.Type

Methods

(==) :: Integer -> Integer -> Bool #

(/=) :: Integer -> Integer -> Bool #

Integral Integer

Since: base-2.0.1

Instance details

Defined in GHC.Real

Num Integer

Since: base-2.1

Instance details

Defined in GHC.Num

Ord Integer 
Instance details

Defined in GHC.Integer.Type

Read Integer

Since: base-2.1

Instance details

Defined in GHC.Read

Real Integer

Since: base-2.0.1

Instance details

Defined in GHC.Real

Show Integer

Since: base-2.1

Instance details

Defined in GHC.Show

Ix Integer

Since: base-2.1

Instance details

Defined in GHC.Ix

Arbitrary Integer 
Instance details

Defined in Test.QuickCheck.Arbitrary

CoArbitrary Integer 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

coarbitrary :: Integer -> Gen b -> Gen b #

NFData Integer 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Integer -> () #

Random Integer

Note - random generates values in the Int range

Instance details

Defined in System.Random

Methods

randomR :: RandomGen g => (Integer, Integer) -> g -> (Integer, g) #

random :: RandomGen g => g -> (Integer, g) #

randomRs :: RandomGen g => (Integer, Integer) -> g -> [Integer] #

randoms :: RandomGen g => g -> [Integer] #

UniformRange Integer 
Instance details

Defined in System.Random.Internal

Methods

uniformRM :: StatefulGen g m => (Integer, Integer) -> g -> m Integer #

C Integer Source # 
Instance details

Defined in Algebra.Indexable

C Integer Source # 
Instance details

Defined in Algebra.Additive

C Integer Source # 
Instance details

Defined in Algebra.ZeroTestable

Methods

isZero :: Integer -> Bool Source #

C Integer Source # 
Instance details

Defined in Algebra.Ring

C Integer Source # 
Instance details

Defined in Algebra.IntegralDomain

C Integer Source # 
Instance details

Defined in Algebra.Units

C Integer Source # 
Instance details

Defined in Algebra.PrincipalIdealDomain

C Integer Source # 
Instance details

Defined in Algebra.Absolute

C Integer Source # 
Instance details

Defined in Algebra.ToRational

C Integer Source # 
Instance details

Defined in Algebra.RealIntegral

C Integer Source # 
Instance details

Defined in Algebra.ToInteger

C Integer Source # 
Instance details

Defined in Algebra.RealRing

Methods

splitFraction :: C b => Integer -> (b, Integer) Source #

fraction :: Integer -> Integer Source #

ceiling :: C b => Integer -> b Source #

floor :: C b => Integer -> b Source #

truncate :: C b => Integer -> b Source #

round :: C b => Integer -> b Source #

C Integer Source # 
Instance details

Defined in Algebra.Lattice

Lift Integer 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Integer -> Q Exp #

liftTyped :: Integer -> Q (TExp Integer) #

C Integer Integer Source # 
Instance details

Defined in Algebra.Module

C Integer Integer Source # 
Instance details

Defined in Algebra.ModuleBasis

C Integer Integer Source # 
Instance details

Defined in Algebra.NormedSpace.Sum

Methods

norm :: Integer -> Integer Source #

C Integer Integer Source # 
Instance details

Defined in Algebra.NormedSpace.Maximum

Methods

norm :: Integer -> Integer Source #

C Integer Integer Source # 
Instance details

Defined in Algebra.NormedSpace.Euclidean

Methods

norm :: Integer -> Integer Source #

Sqr Integer Integer Source # 
Instance details

Defined in Algebra.NormedSpace.Euclidean

C a => C Integer (T a) Source # 
Instance details

Defined in Algebra.Module

Methods

(*>) :: Integer -> T a -> T a Source #

data Int #

A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]. The exact range for a given implementation can be determined by using minBound and maxBound from the Bounded class.

Instances

Instances details
Bounded Int

Since: base-2.1

Instance details

Defined in GHC.Enum

Methods

minBound :: Int #

maxBound :: Int #

Enum Int

Since: base-2.1

Instance details

Defined in GHC.Enum

Methods

succ :: Int -> Int #

pred :: Int -> Int #

toEnum :: Int -> Int #

fromEnum :: Int -> Int #

enumFrom :: Int -> [Int] #

enumFromThen :: Int -> Int -> [Int] #

enumFromTo :: Int -> Int -> [Int] #

enumFromThenTo :: Int -> Int -> Int -> [Int] #

Eq Int 
Instance details

Defined in GHC.Classes

Methods

(==) :: Int -> Int -> Bool #

(/=) :: Int -> Int -> Bool #

Integral Int

Since: base-2.0.1

Instance details

Defined in GHC.Real

Methods

quot :: Int -> Int -> Int #

rem :: Int -> Int -> Int #

div :: Int -> Int -> Int #

mod :: Int -> Int -> Int #

quotRem :: Int -> Int -> (Int, Int) #

divMod :: Int -> Int -> (Int, Int) #

toInteger :: Int -> Integer #

Num Int

Since: base-2.1

Instance details

Defined in GHC.Num

Methods

(+) :: Int -> Int -> Int #

(-) :: Int -> Int -> Int #

(*) :: Int -> Int -> Int #

negate :: Int -> Int #

abs :: Int -> Int #

signum :: Int -> Int #

fromInteger :: Integer -> Int #

Ord Int 
Instance details

Defined in GHC.Classes

Methods

compare :: Int -> Int -> Ordering #

(<) :: Int -> Int -> Bool #

(<=) :: Int -> Int -> Bool #

(>) :: Int -> Int -> Bool #

(>=) :: Int -> Int -> Bool #

max :: Int -> Int -> Int #

min :: Int -> Int -> Int #

Read Int

Since: base-2.1

Instance details

Defined in GHC.Read

Real Int

Since: base-2.0.1

Instance details

Defined in GHC.Real

Methods

toRational :: Int -> Rational #

Show Int

Since: base-2.1

Instance details

Defined in GHC.Show

Methods

showsPrec :: Int -> Int -> ShowS #

show :: Int -> String #

showList :: [Int] -> ShowS #

Ix Int

Since: base-2.1

Instance details

Defined in GHC.Ix

Methods

range :: (Int, Int) -> [Int] #

index :: (Int, Int) -> Int -> Int #

unsafeIndex :: (Int, Int) -> Int -> Int #

inRange :: (Int, Int) -> Int -> Bool #

rangeSize :: (Int, Int) -> Int #

unsafeRangeSize :: (Int, Int) -> Int #

Arbitrary Int 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen Int #

shrink :: Int -> [Int] #

CoArbitrary Int 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

coarbitrary :: Int -> Gen b -> Gen b #

Storable Int

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int -> Int #

alignment :: Int -> Int #

peekElemOff :: Ptr Int -> Int -> IO Int #

pokeElemOff :: Ptr Int -> Int -> Int -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int #

pokeByteOff :: Ptr b -> Int -> Int -> IO () #

peek :: Ptr Int -> IO Int #

poke :: Ptr Int -> Int -> IO () #

NFData Int 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Int -> () #

Random Int 
Instance details

Defined in System.Random

Methods

randomR :: RandomGen g => (Int, Int) -> g -> (Int, g) #

random :: RandomGen g => g -> (Int, g) #

randomRs :: RandomGen g => (Int, Int) -> g -> [Int] #

randoms :: RandomGen g => g -> [Int] #

Uniform Int 
Instance details

Defined in System.Random.Internal

Methods

uniformM :: StatefulGen g m => g -> m Int #

UniformRange Int 
Instance details

Defined in System.Random.Internal

Methods

uniformRM :: StatefulGen g m => (Int, Int) -> g -> m Int #

C Int Source # 
Instance details

Defined in Algebra.Additive

Methods

zero :: Int Source #

(+) :: Int -> Int -> Int Source #

(-) :: Int -> Int -> Int Source #

negate :: Int -> Int Source #

C Int Source # 
Instance details

Defined in Algebra.ZeroTestable

Methods

isZero :: Int -> Bool Source #

C Int Source # 
Instance details

Defined in Algebra.Ring

C Int Source # 
Instance details

Defined in Algebra.IntegralDomain

Methods

div :: Int -> Int -> Int Source #

mod :: Int -> Int -> Int Source #

divMod :: Int -> Int -> (Int, Int) Source #

C Int Source # 
Instance details

Defined in Algebra.Units

C Int Source # 
Instance details

Defined in Algebra.PrincipalIdealDomain

Methods

extendedGCD :: Int -> Int -> (Int, (Int, Int)) Source #

gcd :: Int -> Int -> Int Source #

lcm :: Int -> Int -> Int Source #

C Int Source # 
Instance details

Defined in Algebra.Absolute

Methods

abs :: Int -> Int Source #

signum :: Int -> Int Source #

C Int Source # 
Instance details

Defined in Algebra.ToRational

C Int Source # 
Instance details

Defined in Algebra.RealIntegral

Methods

quot :: Int -> Int -> Int Source #

rem :: Int -> Int -> Int Source #

quotRem :: Int -> Int -> (Int, Int) Source #

C Int Source # 
Instance details

Defined in Algebra.ToInteger

C Int Source # 
Instance details

Defined in Algebra.RealRing

Methods

splitFraction :: C b => Int -> (b, Int) Source #

fraction :: Int -> Int Source #

ceiling :: C b => Int -> b Source #

floor :: C b => Int -> b Source #

truncate :: C b => Int -> b Source #

round :: C b => Int -> b Source #

Lift Int 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Int -> Q Exp #

liftTyped :: Int -> Q (TExp Int) #

C Int Int Source # 
Instance details

Defined in Algebra.Module

Methods

(*>) :: Int -> Int -> Int Source #

C Int Int Source # 
Instance details

Defined in Algebra.ModuleBasis

Methods

basis :: Int -> [Int] Source #

flatten :: Int -> [Int] Source #

dimension :: Int -> Int -> Int Source #

C Int Int Source # 
Instance details

Defined in Algebra.NormedSpace.Sum

Methods

norm :: Int -> Int Source #

C Int Int Source # 
Instance details

Defined in Algebra.NormedSpace.Maximum

Methods

norm :: Int -> Int Source #

C Int Int Source # 
Instance details

Defined in Algebra.NormedSpace.Euclidean

Methods

norm :: Int -> Int Source #

Sqr Int Int Source # 
Instance details

Defined in Algebra.NormedSpace.Euclidean

Methods

normSqr :: Int -> Int Source #

Generic1 (URec Int :: k -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Associated Types

type Rep1 (URec Int) :: k -> Type #

Methods

from1 :: forall (a :: k0). URec Int a -> Rep1 (URec Int) a #

to1 :: forall (a :: k0). Rep1 (URec Int) a -> URec Int a #

Foldable (UInt :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => UInt m -> m #

foldMap :: Monoid m => (a -> m) -> UInt a -> m #

foldMap' :: Monoid m => (a -> m) -> UInt a -> m #

foldr :: (a -> b -> b) -> b -> UInt a -> b #

foldr' :: (a -> b -> b) -> b -> UInt a -> b #

foldl :: (b -> a -> b) -> b -> UInt a -> b #

foldl' :: (b -> a -> b) -> b -> UInt a -> b #

foldr1 :: (a -> a -> a) -> UInt a -> a #

foldl1 :: (a -> a -> a) -> UInt a -> a #

toList :: UInt a -> [a] #

null :: UInt a -> Bool #

length :: UInt a -> Int #

elem :: Eq a => a -> UInt a -> Bool #

maximum :: Ord a => UInt a -> a #

minimum :: Ord a => UInt a -> a #

sum :: Num a => UInt a -> a #

product :: Num a => UInt a -> a #

Traversable (UInt :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> UInt a -> f (UInt b) #

sequenceA :: Applicative f => UInt (f a) -> f (UInt a) #

mapM :: Monad m => (a -> m b) -> UInt a -> m (UInt b) #

sequence :: Monad m => UInt (m a) -> m (UInt a) #

Functor (URec Int :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

fmap :: (a -> b) -> URec Int a -> URec Int b #

(<$) :: a -> URec Int b -> URec Int a #

Eq (URec Int p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

(==) :: URec Int p -> URec Int p -> Bool #

(/=) :: URec Int p -> URec Int p -> Bool #

Ord (URec Int p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

compare :: URec Int p -> URec Int p -> Ordering #

(<) :: URec Int p -> URec Int p -> Bool #

(<=) :: URec Int p -> URec Int p -> Bool #

(>) :: URec Int p -> URec Int p -> Bool #

(>=) :: URec Int p -> URec Int p -> Bool #

max :: URec Int p -> URec Int p -> URec Int p #

min :: URec Int p -> URec Int p -> URec Int p #

Show (URec Int p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

showsPrec :: Int -> URec Int p -> ShowS #

show :: URec Int p -> String #

showList :: [URec Int p] -> ShowS #

Generic (URec Int p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Int p) :: Type -> Type #

Methods

from :: URec Int p -> Rep (URec Int p) x #

to :: Rep (URec Int p) x -> URec Int p #

data URec Int (p :: k)

Used for marking occurrences of Int#

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

data URec Int (p :: k) = UInt {}
type Rep1 (URec Int :: k -> Type) 
Instance details

Defined in GHC.Generics

type Rep1 (URec Int :: k -> Type) = D1 ('MetaData "URec" "GHC.Generics" "base" 'False) (C1 ('MetaCons "UInt" 'PrefixI 'True) (S1 ('MetaSel ('Just "uInt#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UInt :: k -> Type)))
type Rep (URec Int p) 
Instance details

Defined in GHC.Generics

type Rep (URec Int p) = D1 ('MetaData "URec" "GHC.Generics" "base" 'False) (C1 ('MetaCons "UInt" 'PrefixI 'True) (S1 ('MetaSel ('Just "uInt#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UInt :: Type -> Type)))

data Float #

Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.

Instances

Instances details
Eq Float

Note that due to the presence of NaN, Float's Eq instance does not satisfy reflexivity.

>>> 0/0 == (0/0 :: Float)
False

Also note that Float's Eq instance does not satisfy substitutivity:

>>> 0 == (-0 :: Float)
True
>>> recip 0 == recip (-0 :: Float)
False
Instance details

Defined in GHC.Classes

Methods

(==) :: Float -> Float -> Bool #

(/=) :: Float -> Float -> Bool #

Floating Float

Since: base-2.1

Instance details

Defined in GHC.Float

Ord Float

Note that due to the presence of NaN, Float's Ord instance does not satisfy reflexivity.

>>> 0/0 <= (0/0 :: Float)
False

Also note that, due to the same, Ord's operator interactions are not respected by Float's instance:

>>> (0/0 :: Float) > 1
False
>>> compare (0/0 :: Float) 1
GT
Instance details

Defined in GHC.Classes

Methods

compare :: Float -> Float -> Ordering #

(<) :: Float -> Float -> Bool #

(<=) :: Float -> Float -> Bool #

(>) :: Float -> Float -> Bool #

(>=) :: Float -> Float -> Bool #

max :: Float -> Float -> Float #

min :: Float -> Float -> Float #

Read Float

Since: base-2.1

Instance details

Defined in GHC.Read

RealFloat Float

Since: base-2.1

Instance details

Defined in GHC.Float

Arbitrary Float 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen Float #

shrink :: Float -> [Float] #

CoArbitrary Float 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

coarbitrary :: Float -> Gen b -> Gen b #

Storable Float

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Float -> Int #

alignment :: Float -> Int #

peekElemOff :: Ptr Float -> Int -> IO Float #

pokeElemOff :: Ptr Float -> Int -> Float -> IO () #

peekByteOff :: Ptr b -> Int -> IO Float #

pokeByteOff :: Ptr b -> Int -> Float -> IO () #

peek :: Ptr Float -> IO Float #

poke :: Ptr Float -> Float -> IO () #

NFData Float 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Float -> () #

Random Float

Note - random produces values in the closed range [0,1].

Instance details

Defined in System.Random

Methods

randomR :: RandomGen g => (Float, Float) -> g -> (Float, g) #

random :: RandomGen g => g -> (Float, g) #

randomRs :: RandomGen g => (Float, Float) -> g -> [Float] #

randoms :: RandomGen g => g -> [Float] #

UniformRange Float

See Floating point number caveats.

Instance details

Defined in System.Random.Internal

Methods

uniformRM :: StatefulGen g m => (Float, Float) -> g -> m Float #

C Float Source # 
Instance details

Defined in Algebra.Additive

C Float Source # 
Instance details

Defined in Algebra.ZeroTestable

Methods

isZero :: Float -> Bool Source #

C Float Source # 
Instance details

Defined in Algebra.Ring

C Float Source # 
Instance details

Defined in Algebra.Absolute

C Float Source # 
Instance details

Defined in Algebra.Field

C Float Source # 
Instance details

Defined in Algebra.ToRational

C Float Source # 
Instance details

Defined in Algebra.Algebraic

C Float Source # 
Instance details

Defined in Algebra.Transcendental

C Float Source # 
Instance details

Defined in Algebra.RealRing

Methods

splitFraction :: C b => Float -> (b, Float) Source #

fraction :: Float -> Float Source #

ceiling :: C b => Float -> b Source #

floor :: C b => Float -> b Source #

truncate :: C b => Float -> b Source #

round :: C b => Float -> b Source #

C Float Source # 
Instance details

Defined in Algebra.RealField

C Float Source # 
Instance details

Defined in Algebra.RealTranscendental

Methods

atan2 :: Float -> Float -> Float Source #

C Float Source # 
Instance details

Defined in Algebra.FloatingPoint

Power Float Source # 
Instance details

Defined in Number.Complex

Methods

power :: Rational -> T Float -> T Float Source #

Lift Float 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Float -> Q Exp #

liftTyped :: Float -> Q (TExp Float) #

C Float Float Source # 
Instance details

Defined in Algebra.Module

Methods

(*>) :: Float -> Float -> Float Source #

C Float Float Source # 
Instance details

Defined in Algebra.VectorSpace

C Float Float Source # 
Instance details

Defined in Algebra.ModuleBasis

C Float Float Source # 
Instance details

Defined in Algebra.OccasionallyScalar

C Float Float Source # 
Instance details

Defined in Algebra.NormedSpace.Sum

Methods

norm :: Float -> Float Source #

C Float Float Source # 
Instance details

Defined in Algebra.NormedSpace.Maximum

Methods

norm :: Float -> Float Source #

C Float Float Source # 
Instance details

Defined in Algebra.NormedSpace.Euclidean

Methods

norm :: Float -> Float Source #

Sqr Float Float Source # 
Instance details

Defined in Algebra.NormedSpace.Euclidean

Methods

normSqr :: Float -> Float Source #

Generic1 (URec Float :: k -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Associated Types

type Rep1 (URec Float) :: k -> Type #

Methods

from1 :: forall (a :: k0). URec Float a -> Rep1 (URec Float) a #

to1 :: forall (a :: k0). Rep1 (URec Float) a -> URec Float a #

Foldable (UFloat :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => UFloat m -> m #

foldMap :: Monoid m => (a -> m) -> UFloat a -> m #

foldMap' :: Monoid m => (a -> m) -> UFloat a -> m #

foldr :: (a -> b -> b) -> b -> UFloat a -> b #

foldr' :: (a -> b -> b) -> b -> UFloat a -> b #

foldl :: (b -> a -> b) -> b -> UFloat a -> b #

foldl' :: (b -> a -> b) -> b -> UFloat a -> b #

foldr1 :: (a -> a -> a) -> UFloat a -> a #

foldl1 :: (a -> a -> a) -> UFloat a -> a #

toList :: UFloat a -> [a] #

null :: UFloat a -> Bool #

length :: UFloat a -> Int #

elem :: Eq a => a -> UFloat a -> Bool #

maximum :: Ord a => UFloat a -> a #

minimum :: Ord a => UFloat a -> a #

sum :: Num a => UFloat a -> a #

product :: Num a => UFloat a -> a #

Traversable (UFloat :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> UFloat a -> f (UFloat b) #

sequenceA :: Applicative f => UFloat (f a) -> f (UFloat a) #

mapM :: Monad m => (a -> m b) -> UFloat a -> m (UFloat b) #

sequence :: Monad m => UFloat (m a) -> m (UFloat a) #

Functor (URec Float :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

fmap :: (a -> b) -> URec Float a -> URec Float b #

(<$) :: a -> URec Float b -> URec Float a #

Eq (URec Float p) 
Instance details

Defined in GHC.Generics

Methods

(==) :: URec Float p -> URec Float p -> Bool #

(/=) :: URec Float p -> URec Float p -> Bool #

Ord (URec Float p) 
Instance details

Defined in GHC.Generics

Methods

compare :: URec Float p -> URec Float p -> Ordering #

(<) :: URec Float p -> URec Float p -> Bool #

(<=) :: URec Float p -> URec Float p -> Bool #

(>) :: URec Float p -> URec Float p -> Bool #

(>=) :: URec Float p -> URec Float p -> Bool #

max :: URec Float p -> URec Float p -> URec Float p #

min :: URec Float p -> URec Float p -> URec Float p #

Show (URec Float p) 
Instance details

Defined in GHC.Generics

Methods

showsPrec :: Int -> URec Float p -> ShowS #

show :: URec Float p -> String #

showList :: [URec Float p] -> ShowS #

Generic (URec Float p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Float p) :: Type -> Type #

Methods

from :: URec Float p -> Rep (URec Float p) x #

to :: Rep (URec Float p) x -> URec Float p #

data URec Float (p :: k)

Used for marking occurrences of Float#

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

data URec Float (p :: k) = UFloat {}
type Rep1 (URec Float :: k -> Type) 
Instance details

Defined in GHC.Generics

type Rep1 (URec Float :: k -> Type) = D1 ('MetaData "URec" "GHC.Generics" "base" 'False) (C1 ('MetaCons "UFloat" 'PrefixI 'True) (S1 ('MetaSel ('Just "uFloat#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UFloat :: k -> Type)))
type Rep (URec Float p) 
Instance details

Defined in GHC.Generics

type Rep (URec Float p) = D1 ('MetaData "URec" "GHC.Generics" "base" 'False) (C1 ('MetaCons "UFloat" 'PrefixI 'True) (S1 ('MetaSel ('Just "uFloat#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UFloat :: Type -> Type)))

data Double #

Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.

Instances

Instances details
Eq Double

Note that due to the presence of NaN, Double's Eq instance does not satisfy reflexivity.

>>> 0/0 == (0/0 :: Double)
False

Also note that Double's Eq instance does not satisfy substitutivity:

>>> 0 == (-0 :: Double)
True
>>> recip 0 == recip (-0 :: Double)
False
Instance details

Defined in GHC.Classes

Methods

(==) :: Double -> Double -> Bool #

(/=) :: Double -> Double -> Bool #

Floating Double

Since: base-2.1

Instance details

Defined in GHC.Float

Ord Double

Note that due to the presence of NaN, Double's Ord instance does not satisfy reflexivity.

>>> 0/0 <= (0/0 :: Double)
False

Also note that, due to the same, Ord's operator interactions are not respected by Double's instance:

>>> (0/0 :: Double) > 1
False
>>> compare (0/0 :: Double) 1
GT
Instance details

Defined in GHC.Classes

Read Double

Since: base-2.1

Instance details

Defined in GHC.Read

RealFloat Double

Since: base-2.1

Instance details

Defined in GHC.Float

Arbitrary Double 
Instance details

Defined in Test.QuickCheck.Arbitrary

CoArbitrary Double 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

coarbitrary :: Double -> Gen b -> Gen b #

Storable Double

Since: base-2.1

Instance details

Defined in Foreign.Storable

NFData Double 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Double -> () #

Random Double

Note - random produces values in the closed range [0,1].

Instance details

Defined in System.Random

Methods

randomR :: RandomGen g => (Double, Double) -> g -> (Double, g) #

random :: RandomGen g => g -> (Double, g) #

randomRs :: RandomGen g => (Double, Double) -> g -> [Double] #

randoms :: RandomGen g => g -> [Double] #

UniformRange Double

See Floating point number caveats.

Instance details

Defined in System.Random.Internal

Methods

uniformRM :: StatefulGen g m => (Double, Double) -> g -> m Double #

C Double Source # 
Instance details

Defined in Algebra.Additive

C Double Source # 
Instance details

Defined in Algebra.ZeroTestable

Methods

isZero :: Double -> Bool Source #

C Double Source # 
Instance details

Defined in Algebra.Ring

C Double Source # 
Instance details

Defined in Algebra.Absolute

C Double Source # 
Instance details

Defined in Algebra.Field

C Double Source # 
Instance details

Defined in Algebra.ToRational

C Double Source # 
Instance details

Defined in Algebra.Algebraic

C Double Source # 
Instance details

Defined in Algebra.Transcendental

C Double Source # 
Instance details

Defined in Algebra.RealRing

Methods

splitFraction :: C b => Double -> (b, Double) Source #

fraction :: Double -> Double Source #

ceiling :: C b => Double -> b Source #

floor :: C b => Double -> b Source #

truncate :: C b => Double -> b Source #

round :: C b => Double -> b Source #

C Double Source # 
Instance details

Defined in Algebra.RealField

C Double Source # 
Instance details

Defined in Algebra.RealTranscendental

Methods

atan2 :: Double -> Double -> Double Source #

C Double Source # 
Instance details

Defined in Algebra.FloatingPoint

Power Double Source # 
Instance details

Defined in Number.Complex

Methods

power :: Rational -> T Double -> T Double Source #

Lift Double 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Double -> Q Exp #

liftTyped :: Double -> Q (TExp Double) #

C Double Double Source # 
Instance details

Defined in Algebra.Module

Methods

(*>) :: Double -> Double -> Double Source #

C Double Double Source # 
Instance details

Defined in Algebra.VectorSpace

C Double Double Source # 
Instance details

Defined in Algebra.ModuleBasis

C Double Double Source # 
Instance details

Defined in Algebra.OccasionallyScalar

C Double Double Source # 
Instance details

Defined in Algebra.NormedSpace.Sum

Methods

norm :: Double -> Double Source #

C Double Double Source # 
Instance details

Defined in Algebra.NormedSpace.Maximum

Methods

norm :: Double -> Double Source #

C Double Double Source # 
Instance details

Defined in Algebra.NormedSpace.Euclidean

Methods

norm :: Double -> Double Source #

Sqr Double Double Source # 
Instance details

Defined in Algebra.NormedSpace.Euclidean

Generic1 (URec Double :: k -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Associated Types

type Rep1 (URec Double) :: k -> Type #

Methods

from1 :: forall (a :: k0). URec Double a -> Rep1 (URec Double) a #

to1 :: forall (a :: k0). Rep1 (URec Double) a -> URec Double a #

Foldable (UDouble :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => UDouble m -> m #

foldMap :: Monoid m => (a -> m) -> UDouble a -> m #

foldMap' :: Monoid m => (a -> m) -> UDouble a -> m #

foldr :: (a -> b -> b) -> b -> UDouble a -> b #

foldr' :: (a -> b -> b) -> b -> UDouble a -> b #

foldl :: (b -> a -> b) -> b -> UDouble a -> b #

foldl' :: (b -> a -> b) -> b -> UDouble a -> b #

foldr1 :: (a -> a -> a) -> UDouble a -> a #

foldl1 :: (a -> a -> a) -> UDouble a -> a #

toList :: UDouble a -> [a] #

null :: UDouble a -> Bool #

length :: UDouble a -> Int #

elem :: Eq a => a -> UDouble a -> Bool #

maximum :: Ord a => UDouble a -> a #

minimum :: Ord a => UDouble a -> a #

sum :: Num a => UDouble a -> a #

product :: Num a => UDouble a -> a #

Traversable (UDouble :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> UDouble a -> f (UDouble b) #

sequenceA :: Applicative f => UDouble (f a) -> f (UDouble a) #

mapM :: Monad m => (a -> m b) -> UDouble a -> m (UDouble b) #

sequence :: Monad m => UDouble (m a) -> m (UDouble a) #

Functor (URec Double :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

fmap :: (a -> b) -> URec Double a -> URec Double b #

(<$) :: a -> URec Double b -> URec Double a #

Eq (URec Double p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

(==) :: URec Double p -> URec Double p -> Bool #

(/=) :: URec Double p -> URec Double p -> Bool #

Ord (URec Double p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

compare :: URec Double p -> URec Double p -> Ordering #

(<) :: URec Double p -> URec Double p -> Bool #

(<=) :: URec Double p -> URec Double p -> Bool #

(>) :: URec Double p -> URec Double p -> Bool #

(>=) :: URec Double p -> URec Double p -> Bool #

max :: URec Double p -> URec Double p -> URec Double p #

min :: URec Double p -> URec Double p -> URec Double p #

Show (URec Double p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

showsPrec :: Int -> URec Double p -> ShowS #

show :: URec Double p -> String #

showList :: [URec Double p] -> ShowS #

Generic (URec Double p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Double p) :: Type -> Type #

Methods

from :: URec Double p -> Rep (URec Double p) x #

to :: Rep (URec Double p) x -> URec Double p #

data URec Double (p :: k)

Used for marking occurrences of Double#

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

data URec Double (p :: k) = UDouble {}
type Rep1 (URec Double :: k -> Type) 
Instance details

Defined in GHC.Generics

type Rep1 (URec Double :: k -> Type) = D1 ('MetaData "URec" "GHC.Generics" "base" 'False) (C1 ('MetaCons "UDouble" 'PrefixI 'True) (S1 ('MetaSel ('Just "uDouble#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UDouble :: k -> Type)))
type Rep (URec Double p) 
Instance details

Defined in GHC.Generics

type Rep (URec Double p) = D1 ('MetaData "URec" "GHC.Generics" "base" 'False) (C1 ('MetaCons "UDouble" 'PrefixI 'True) (S1 ('MetaSel ('Just "uDouble#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UDouble :: Type -> Type)))

(*>) :: C a v => a -> v -> v infixr 7 Source #

scale a vector by a scalar