Foundation.Numerical

foundation-0.0.30: Alternative prelude with batteries and no dependencies

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Foundation.Numerical

Description

Compared to the Haskell hierarchy of number classes this provide a more flexible approach that is closer to the mathematical foundation (group, field, etc)

This try to only provide one feature per class, at the expense of the number of classes.

Synopsis

- class (Integral a, Eq a, Ord a) => IsIntegral a where
  - toInteger :: a -> Integer
- class IsIntegral a => IsNatural a where
  - toNatural :: a -> Natural
- class Signed a where
  - abs :: a -> a
  - signum :: a -> Sign
- class Additive a where
  - azero :: a
  - (+) :: a -> a -> a
  - scale :: IsNatural n => n -> a -> a
- class Subtractive a where
  - type Difference a
  - (-) :: a -> a -> Difference a
- class Multiplicative a where
  - midentity :: a
  - (*) :: a -> a -> a
  - (^) :: (IsNatural n, Enum n, IDivisible n) => a -> n -> a
- class (Additive a, Multiplicative a) => IDivisible a where
  - div :: a -> a -> a
  - mod :: a -> a -> a
  - divMod :: a -> a -> (a, a)
- class Multiplicative a => Divisible a where
  - (/) :: a -> a -> a
- data Sign
  - = SignNegative
  - | SignZero
  - | SignPositive
- recip :: Divisible a => a -> a
- class IntegralRounding a where
  - roundUp :: Integral n => a -> n
  - roundDown :: Integral n => a -> n
  - roundTruncate :: Integral n => a -> n
  - roundNearest :: Integral n => a -> n
- 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

# Documentation

class (Integral a, Eq a, Ord a) => IsIntegral a where #

Number literals, convertible through the generic Integer type.

all number are Enum'erable, meaning that you can move to next element

Methods

toInteger :: a -> Integer #

#### Instances

Instances details

IsIntegral Word128 |
Instance details Defined in Basement.Types.Word128 Methods toInteger :: Word128 -> Integer #
IsIntegral Word256 |
Instance details Defined in Basement.Types.Word256 Methods toInteger :: Word256 -> Integer #
IsIntegral CBool |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CBool -> Integer #
IsIntegral CChar |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CChar -> Integer #
IsIntegral CInt |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CInt -> Integer #
IsIntegral CIntMax |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CIntMax -> Integer #
IsIntegral CIntPtr |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CIntPtr -> Integer #
IsIntegral CLLong |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CLLong -> Integer #
IsIntegral CLong |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CLong -> Integer #
IsIntegral CPtrdiff |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CPtrdiff -> Integer #
IsIntegral CSChar |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CSChar -> Integer #
IsIntegral CShort |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CShort -> Integer #
IsIntegral CSigAtomic |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CSigAtomic -> Integer #
IsIntegral CSize |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CSize -> Integer #
IsIntegral CUChar |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUChar -> Integer #
IsIntegral CUInt |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUInt -> Integer #
IsIntegral CUIntMax |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUIntMax -> Integer #
IsIntegral CUIntPtr |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUIntPtr -> Integer #
IsIntegral CULLong |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CULLong -> Integer #
IsIntegral CULong |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CULong -> Integer #
IsIntegral CUShort |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CUShort -> Integer #
IsIntegral CWchar |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: CWchar -> Integer #
IsIntegral Int16 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int16 -> Integer #
IsIntegral Int32 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int32 -> Integer #
IsIntegral Int64 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int64 -> Integer #
IsIntegral Int8 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int8 -> Integer #
IsIntegral Word16 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word16 -> Integer #
IsIntegral Word32 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word32 -> Integer #
IsIntegral Word64 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word64 -> Integer #
IsIntegral Word8 |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word8 -> Integer #
IsIntegral Integer |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Integer -> Integer #
IsIntegral Natural |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Natural -> Integer #
IsIntegral Int |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Int -> Integer #
IsIntegral Word |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word -> Integer #
KnownNat n => IsIntegral (Zn n) |
Instance details Defined in Basement.Bounded Methods toInteger :: Zn n -> Integer #
(KnownNat n, NatWithinBound Word64 n) => IsIntegral (Zn64 n) |
Instance details Defined in Basement.Bounded Methods toInteger :: Zn64 n -> Integer #
IsIntegral (CountOf ty) |
Instance details Defined in Basement.Types.OffsetSize Methods toInteger :: CountOf ty -> Integer #
IsIntegral (Offset ty) |
Instance details Defined in Basement.Types.OffsetSize Methods toInteger :: Offset ty -> Integer #

class IsIntegral a => IsNatural a where #

Non Negative Number literals, convertible through the generic Natural type

Methods

toNatural :: a -> Natural #

#### Instances

Instances details

IsNatural Word128 |
Instance details Defined in Basement.Types.Word128 Methods toNatural :: Word128 -> Natural #
IsNatural Word256 |
Instance details Defined in Basement.Types.Word256 Methods toNatural :: Word256 -> Natural #
IsNatural CSize |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CSize -> Natural #
IsNatural CUChar |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUChar -> Natural #
IsNatural CUInt |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUInt -> Natural #
IsNatural CUIntMax |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUIntMax -> Natural #
IsNatural CUIntPtr |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUIntPtr -> Natural #
IsNatural CULLong |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CULLong -> Natural #
IsNatural CULong |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CULong -> Natural #
IsNatural CUShort |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: CUShort -> Natural #
IsNatural Word16 |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word16 -> Natural #
IsNatural Word32 |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word32 -> Natural #
IsNatural Word64 |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word64 -> Natural #
IsNatural Word8 |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word8 -> Natural #
IsNatural Natural |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Natural -> Natural #
IsNatural Word |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word -> Natural #
KnownNat n => IsNatural (Zn n) |
Instance details Defined in Basement.Bounded Methods toNatural :: Zn n -> Natural #
(KnownNat n, NatWithinBound Word64 n) => IsNatural (Zn64 n) |
Instance details Defined in Basement.Bounded Methods toNatural :: Zn64 n -> Natural #
IsNatural (CountOf ty) |
Instance details Defined in Basement.Types.OffsetSize Methods toNatural :: CountOf ty -> Natural #
IsNatural (Offset ty) |
Instance details Defined in Basement.Types.OffsetSize Methods toNatural :: Offset ty -> Natural #

class Signed a where #

types that have sign and can be made absolute

Methods

abs :: a -> a #

signum :: a -> Sign #

#### Instances

Instances details

Signed Int16 # |
Instance details Defined in Foundation.Numerical Methods abs :: Int16 -> Int16 # signum :: Int16 -> Sign #
Signed Int32 # |
Instance details Defined in Foundation.Numerical Methods abs :: Int32 -> Int32 # signum :: Int32 -> Sign #
Signed Int64 # |
Instance details Defined in Foundation.Numerical Methods abs :: Int64 -> Int64 # signum :: Int64 -> Sign #
Signed Int8 # |
Instance details Defined in Foundation.Numerical Methods abs :: Int8 -> Int8 # signum :: Int8 -> Sign #
Signed Integer # |
Instance details Defined in Foundation.Numerical Methods abs :: Integer -> Integer # signum :: Integer -> Sign #
Signed Double # |
Instance details Defined in Foundation.Numerical Methods abs :: Double -> Double # signum :: Double -> Sign #
Signed Float # |
Instance details Defined in Foundation.Numerical Methods abs :: Float -> Float # signum :: Float -> Sign #
Signed Int # |
Instance details Defined in Foundation.Numerical Methods abs :: Int -> Int # signum :: Int -> Sign #

class Additive a where #

Represent class of things that can be added together, contains a neutral element and is commutative.

    x + azero = x
    azero + x = x
    x + y = y + x

Minimal complete definition

azero, (+)

Methods

azero :: a #

(+) :: a -> a -> a infixl 6 #

scale :: IsNatural n => n -> a -> a #

default scale :: (Enum n, IsNatural n) => n -> a -> a #

#### Instances

Instances details

Additive Word128 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word128 # (+) :: Word128 -> Word128 -> Word128 # scale :: IsNatural n => n -> Word128 -> Word128 #
Additive Word256 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word256 # (+) :: Word256 -> Word256 -> Word256 # scale :: IsNatural n => n -> Word256 -> Word256 #
Additive NanoSeconds # |
Instance details Defined in Foundation.Time.Types Methods azero :: NanoSeconds # (+) :: NanoSeconds -> NanoSeconds -> NanoSeconds # scale :: IsNatural n => n -> NanoSeconds -> NanoSeconds #
Additive Seconds # |
Instance details Defined in Foundation.Time.Types Methods azero :: Seconds # (+) :: Seconds -> Seconds -> Seconds # scale :: IsNatural n => n -> Seconds -> Seconds #
Additive CChar |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CChar # (+) :: CChar -> CChar -> CChar # scale :: IsNatural n => n -> CChar -> CChar #
Additive CClock |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CClock # (+) :: CClock -> CClock -> CClock # scale :: IsNatural n => n -> CClock -> CClock #
Additive CDouble |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CDouble # (+) :: CDouble -> CDouble -> CDouble # scale :: IsNatural n => n -> CDouble -> CDouble #
Additive CFloat |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CFloat # (+) :: CFloat -> CFloat -> CFloat # scale :: IsNatural n => n -> CFloat -> CFloat #
Additive CInt |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CInt # (+) :: CInt -> CInt -> CInt # scale :: IsNatural n => n -> CInt -> CInt #
Additive CIntMax |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CIntMax # (+) :: CIntMax -> CIntMax -> CIntMax # scale :: IsNatural n => n -> CIntMax -> CIntMax #
Additive CIntPtr |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CIntPtr # (+) :: CIntPtr -> CIntPtr -> CIntPtr # scale :: IsNatural n => n -> CIntPtr -> CIntPtr #
Additive CLLong |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CLLong # (+) :: CLLong -> CLLong -> CLLong # scale :: IsNatural n => n -> CLLong -> CLLong #
Additive CLong |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CLong # (+) :: CLong -> CLong -> CLong # scale :: IsNatural n => n -> CLong -> CLong #
Additive CPtrdiff |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CPtrdiff # (+) :: CPtrdiff -> CPtrdiff -> CPtrdiff # scale :: IsNatural n => n -> CPtrdiff -> CPtrdiff #
Additive CSChar |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CSChar # (+) :: CSChar -> CSChar -> CSChar # scale :: IsNatural n => n -> CSChar -> CSChar #
Additive CSUSeconds |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CSUSeconds # (+) :: CSUSeconds -> CSUSeconds -> CSUSeconds # scale :: IsNatural n => n -> CSUSeconds -> CSUSeconds #
Additive CShort |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CShort # (+) :: CShort -> CShort -> CShort # scale :: IsNatural n => n -> CShort -> CShort #
Additive CSigAtomic |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CSigAtomic # (+) :: CSigAtomic -> CSigAtomic -> CSigAtomic # scale :: IsNatural n => n -> CSigAtomic -> CSigAtomic #
Additive CSize |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CSize # (+) :: CSize -> CSize -> CSize # scale :: IsNatural n => n -> CSize -> CSize #
Additive CTime |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CTime # (+) :: CTime -> CTime -> CTime # scale :: IsNatural n => n -> CTime -> CTime #
Additive CUChar |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUChar # (+) :: CUChar -> CUChar -> CUChar # scale :: IsNatural n => n -> CUChar -> CUChar #
Additive CUInt |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUInt # (+) :: CUInt -> CUInt -> CUInt # scale :: IsNatural n => n -> CUInt -> CUInt #
Additive CUIntMax |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUIntMax # (+) :: CUIntMax -> CUIntMax -> CUIntMax # scale :: IsNatural n => n -> CUIntMax -> CUIntMax #
Additive CUIntPtr |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUIntPtr # (+) :: CUIntPtr -> CUIntPtr -> CUIntPtr # scale :: IsNatural n => n -> CUIntPtr -> CUIntPtr #
Additive CULLong |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CULLong # (+) :: CULLong -> CULLong -> CULLong # scale :: IsNatural n => n -> CULLong -> CULLong #
Additive CULong |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CULong # (+) :: CULong -> CULong -> CULong # scale :: IsNatural n => n -> CULong -> CULong #
Additive CUSeconds |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUSeconds # (+) :: CUSeconds -> CUSeconds -> CUSeconds # scale :: IsNatural n => n -> CUSeconds -> CUSeconds #
Additive CUShort |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CUShort # (+) :: CUShort -> CUShort -> CUShort # scale :: IsNatural n => n -> CUShort -> CUShort #
Additive CWchar |
Instance details Defined in Basement.Numerical.Additive Methods azero :: CWchar # (+) :: CWchar -> CWchar -> CWchar # scale :: IsNatural n => n -> CWchar -> CWchar #
Additive Int16 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int16 # (+) :: Int16 -> Int16 -> Int16 # scale :: IsNatural n => n -> Int16 -> Int16 #
Additive Int32 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int32 # (+) :: Int32 -> Int32 -> Int32 # scale :: IsNatural n => n -> Int32 -> Int32 #
Additive Int64 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int64 # (+) :: Int64 -> Int64 -> Int64 # scale :: IsNatural n => n -> Int64 -> Int64 #
Additive Int8 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int8 # (+) :: Int8 -> Int8 -> Int8 # scale :: IsNatural n => n -> Int8 -> Int8 #
Additive Rational |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Rational # (+) :: Rational -> Rational -> Rational # scale :: IsNatural n => n -> Rational -> Rational #
Additive COff |
Instance details Defined in Basement.Numerical.Additive Methods azero :: COff # (+) :: COff -> COff -> COff # scale :: IsNatural n => n -> COff -> COff #
Additive Word16 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word16 # (+) :: Word16 -> Word16 -> Word16 # scale :: IsNatural n => n -> Word16 -> Word16 #
Additive Word32 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word32 # (+) :: Word32 -> Word32 -> Word32 # scale :: IsNatural n => n -> Word32 -> Word32 #
Additive Word64 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word64 # (+) :: Word64 -> Word64 -> Word64 # scale :: IsNatural n => n -> Word64 -> Word64 #
Additive Word8 |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word8 # (+) :: Word8 -> Word8 -> Word8 # scale :: IsNatural n => n -> Word8 -> Word8 #
Additive Integer |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Integer # (+) :: Integer -> Integer -> Integer # scale :: IsNatural n => n -> Integer -> Integer #
Additive Natural |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Natural # (+) :: Natural -> Natural -> Natural # scale :: IsNatural n => n -> Natural -> Natural #
Additive Double |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Double # (+) :: Double -> Double -> Double # scale :: IsNatural n => n -> Double -> Double #
Additive Float |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Float # (+) :: Float -> Float -> Float # scale :: IsNatural n => n -> Float -> Float #
Additive Int |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Int # (+) :: Int -> Int -> Int # scale :: IsNatural n => n -> Int -> Int #
Additive Word |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word # (+) :: Word -> Word -> Word # scale :: IsNatural n => n -> Word -> Word #
SizeValid n => Additive (Bits n) |
Instance details Defined in Basement.Bits Methods azero :: Bits n # (+) :: Bits n -> Bits n -> Bits n # scale :: IsNatural n0 => n0 -> Bits n -> Bits n #
KnownNat n => Additive (Zn n) |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Zn n # (+) :: Zn n -> Zn n -> Zn n # scale :: IsNatural n0 => n0 -> Zn n -> Zn n #
(KnownNat n, NatWithinBound Word64 n) => Additive (Zn64 n) |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Zn64 n # (+) :: Zn64 n -> Zn64 n -> Zn64 n # scale :: IsNatural n0 => n0 -> Zn64 n -> Zn64 n #
Additive (CountOf ty) |
Instance details Defined in Basement.Types.OffsetSize Methods azero :: CountOf ty # (+) :: CountOf ty -> CountOf ty -> CountOf ty # scale :: IsNatural n => n -> CountOf ty -> CountOf ty #
Additive (Offset ty) |
Instance details Defined in Basement.Types.OffsetSize Methods azero :: Offset ty # (+) :: Offset ty -> Offset ty -> Offset ty # scale :: IsNatural n => n -> Offset ty -> Offset ty #

class Subtractive a where #

Represent class of things that can be subtracted.

Note that the result is not necessary of the same type as the operand depending on the actual type.

For example:

    (-) :: Int -> Int -> Int
    (-) :: DateTime -> DateTime -> Seconds
    (-) :: Ptr a -> Ptr a -> PtrDiff
    (-) :: Natural -> Natural -> Maybe Natural

Associated Types

type Difference a #

Methods

(-) :: a -> a -> Difference a infixl 6 #

#### Instances

Instances details

Subtractive Word128 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Word128 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Word128 = Word128
Methods (-) :: Word128 -> Word128 -> Difference Word128 #
Subtractive Word256 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Word256 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Word256 = Word256
Methods (-) :: Word256 -> Word256 -> Difference Word256 #
Subtractive CBool |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CBool |
Instance details Defined in Basement.Numerical.Subtractive type Difference CBool = CBool
Methods (-) :: CBool -> CBool -> Difference CBool #
Subtractive CChar |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CChar |
Instance details Defined in Basement.Numerical.Subtractive type Difference CChar = CChar
Methods (-) :: CChar -> CChar -> Difference CChar #
Subtractive CClock |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CClock |
Instance details Defined in Basement.Numerical.Subtractive type Difference CClock = CClock
Methods (-) :: CClock -> CClock -> Difference CClock #
Subtractive CDouble |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CDouble |
Instance details Defined in Basement.Numerical.Subtractive type Difference CDouble = CDouble
Methods (-) :: CDouble -> CDouble -> Difference CDouble #
Subtractive CFloat |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CFloat |
Instance details Defined in Basement.Numerical.Subtractive type Difference CFloat = CFloat
Methods (-) :: CFloat -> CFloat -> Difference CFloat #
Subtractive CInt |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CInt |
Instance details Defined in Basement.Numerical.Subtractive type Difference CInt = CInt
Methods (-) :: CInt -> CInt -> Difference CInt #
Subtractive CIntMax |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CIntMax |
Instance details Defined in Basement.Numerical.Subtractive type Difference CIntMax = CIntMax
Methods (-) :: CIntMax -> CIntMax -> Difference CIntMax #
Subtractive CIntPtr |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CIntPtr |
Instance details Defined in Basement.Numerical.Subtractive type Difference CIntPtr = CIntPtr
Methods (-) :: CIntPtr -> CIntPtr -> Difference CIntPtr #
Subtractive CLLong |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CLLong |
Instance details Defined in Basement.Numerical.Subtractive type Difference CLLong = CLLong
Methods (-) :: CLLong -> CLLong -> Difference CLLong #
Subtractive CLong |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CLong |
Instance details Defined in Basement.Numerical.Subtractive type Difference CLong = CLong
Methods (-) :: CLong -> CLong -> Difference CLong #
Subtractive CPtrdiff |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CPtrdiff |
Instance details Defined in Basement.Numerical.Subtractive type Difference CPtrdiff = CPtrdiff
Methods (-) :: CPtrdiff -> CPtrdiff -> Difference CPtrdiff #
Subtractive CSChar |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CSChar |
Instance details Defined in Basement.Numerical.Subtractive type Difference CSChar = CSChar
Methods (-) :: CSChar -> CSChar -> Difference CSChar #
Subtractive CSUSeconds |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CSUSeconds |
Instance details Defined in Basement.Numerical.Subtractive type Difference CSUSeconds = CSUSeconds
Methods (-) :: CSUSeconds -> CSUSeconds -> Difference CSUSeconds #
Subtractive CShort |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CShort |
Instance details Defined in Basement.Numerical.Subtractive type Difference CShort = CShort
Methods (-) :: CShort -> CShort -> Difference CShort #
Subtractive CSigAtomic |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CSigAtomic |
Instance details Defined in Basement.Numerical.Subtractive type Difference CSigAtomic = CSigAtomic
Methods (-) :: CSigAtomic -> CSigAtomic -> Difference CSigAtomic #
Subtractive CSize |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CSize |
Instance details Defined in Basement.Numerical.Subtractive type Difference CSize = CSize
Methods (-) :: CSize -> CSize -> Difference CSize #
Subtractive CTime |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CTime |
Instance details Defined in Basement.Numerical.Subtractive type Difference CTime = CTime
Methods (-) :: CTime -> CTime -> Difference CTime #
Subtractive CUChar |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CUChar |
Instance details Defined in Basement.Numerical.Subtractive type Difference CUChar = CUChar
Methods (-) :: CUChar -> CUChar -> Difference CUChar #
Subtractive CUInt |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CUInt |
Instance details Defined in Basement.Numerical.Subtractive type Difference CUInt = CUInt
Methods (-) :: CUInt -> CUInt -> Difference CUInt #
Subtractive CUIntMax |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CUIntMax |
Instance details Defined in Basement.Numerical.Subtractive type Difference CUIntMax = CUIntMax
Methods (-) :: CUIntMax -> CUIntMax -> Difference CUIntMax #
Subtractive CUIntPtr |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CUIntPtr |
Instance details Defined in Basement.Numerical.Subtractive type Difference CUIntPtr = CUIntPtr
Methods (-) :: CUIntPtr -> CUIntPtr -> Difference CUIntPtr #
Subtractive CULLong |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CULLong |
Instance details Defined in Basement.Numerical.Subtractive type Difference CULLong = CULLong
Methods (-) :: CULLong -> CULLong -> Difference CULLong #
Subtractive CULong |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CULong |
Instance details Defined in Basement.Numerical.Subtractive type Difference CULong = CULong
Methods (-) :: CULong -> CULong -> Difference CULong #
Subtractive CUSeconds |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CUSeconds |
Instance details Defined in Basement.Numerical.Subtractive type Difference CUSeconds = CUSeconds
Methods (-) :: CUSeconds -> CUSeconds -> Difference CUSeconds #
Subtractive CUShort |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CUShort |
Instance details Defined in Basement.Numerical.Subtractive type Difference CUShort = CUShort
Methods (-) :: CUShort -> CUShort -> Difference CUShort #
Subtractive CWchar |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference CWchar |
Instance details Defined in Basement.Numerical.Subtractive type Difference CWchar = CWchar
Methods (-) :: CWchar -> CWchar -> Difference CWchar #
Subtractive Int16 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Int16 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Int16 = Int16
Methods (-) :: Int16 -> Int16 -> Difference Int16 #
Subtractive Int32 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Int32 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Int32 = Int32
Methods (-) :: Int32 -> Int32 -> Difference Int32 #
Subtractive Int64 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Int64 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Int64 = Int64
Methods (-) :: Int64 -> Int64 -> Difference Int64 #
Subtractive Int8 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Int8 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Int8 = Int8
Methods (-) :: Int8 -> Int8 -> Difference Int8 #
Subtractive COff |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference COff |
Instance details Defined in Basement.Numerical.Subtractive type Difference COff = COff
Methods (-) :: COff -> COff -> Difference COff #
Subtractive Word16 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Word16 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Word16 = Word16
Methods (-) :: Word16 -> Word16 -> Difference Word16 #
Subtractive Word32 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Word32 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Word32 = Word32
Methods (-) :: Word32 -> Word32 -> Difference Word32 #
Subtractive Word64 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Word64 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Word64 = Word64
Methods (-) :: Word64 -> Word64 -> Difference Word64 #
Subtractive Word8 |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Word8 |
Instance details Defined in Basement.Numerical.Subtractive type Difference Word8 = Word8
Methods (-) :: Word8 -> Word8 -> Difference Word8 #
Subtractive Integer |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Integer |
Instance details Defined in Basement.Numerical.Subtractive type Difference Integer = Integer
Methods (-) :: Integer -> Integer -> Difference Integer #
Subtractive Natural |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Natural |
Instance details Defined in Basement.Numerical.Subtractive type Difference Natural = Maybe Natural
Methods (-) :: Natural -> Natural -> Difference Natural #
Subtractive Char |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Char |
Instance details Defined in Basement.Numerical.Subtractive type Difference Char = Int
Methods (-) :: Char -> Char -> Difference Char #
Subtractive Double |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Double |
Instance details Defined in Basement.Numerical.Subtractive type Difference Double = Double
Methods (-) :: Double -> Double -> Difference Double #
Subtractive Float |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Float |
Instance details Defined in Basement.Numerical.Subtractive type Difference Float = Float
Methods (-) :: Float -> Float -> Difference Float #
Subtractive Int |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Int |
Instance details Defined in Basement.Numerical.Subtractive type Difference Int = Int
Methods (-) :: Int -> Int -> Difference Int #
Subtractive Word |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Word |
Instance details Defined in Basement.Numerical.Subtractive type Difference Word = Word
Methods (-) :: Word -> Word -> Difference Word #
SizeValid n => Subtractive (Bits n) |
Instance details Defined in Basement.Bits Associated Types
type Difference (Bits n) |
Instance details Defined in Basement.Bits type Difference (Bits n) = Bits n
Methods (-) :: Bits n -> Bits n -> Difference (Bits n) #
KnownNat n => Subtractive (Zn n) |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference (Zn n) |
Instance details Defined in Basement.Numerical.Subtractive type Difference (Zn n) = Zn n
Methods (-) :: Zn n -> Zn n -> Difference (Zn n) #
(KnownNat n, NatWithinBound Word64 n) => Subtractive (Zn64 n) |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference (Zn64 n) |
Instance details Defined in Basement.Numerical.Subtractive type Difference (Zn64 n) = Zn64 n
Methods (-) :: Zn64 n -> Zn64 n -> Difference (Zn64 n) #
Subtractive (CountOf ty) |
Instance details Defined in Basement.Types.OffsetSize Associated Types
type Difference (CountOf ty) |
Instance details Defined in Basement.Types.OffsetSize type Difference (CountOf ty) = Maybe (CountOf ty)
Methods (-) :: CountOf ty -> CountOf ty -> Difference (CountOf ty) #
Subtractive (Offset ty) |
Instance details Defined in Basement.Types.OffsetSize Associated Types
type Difference (Offset ty) |
Instance details Defined in Basement.Types.OffsetSize type Difference (Offset ty) = CountOf ty
Methods (-) :: Offset ty -> Offset ty -> Difference (Offset ty) #

class Multiplicative a where #

Represent class of things that can be multiplied together

    x * midentity = x
    midentity * x = x

Minimal complete definition

midentity, (*)

Methods

midentity :: a #

Identity element over multiplication

(*) :: a -> a -> a infixl 7 #

Multiplication of 2 elements that result in another element

(^) :: (IsNatural n, Enum n, IDivisible n) => a -> n -> a infixr 8 #

Raise to power, repeated multiplication e.g. > a ^ 2 = a * a > a ^ 10 = (a ^ 5) * (a ^ 5) .. (^) :: (IsNatural n) => a -> n -> a

#### Instances

Instances details

Multiplicative Word128 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word128 # (*) :: Word128 -> Word128 -> Word128 # (^) :: (IsNatural n, Enum n, IDivisible n) => Word128 -> n -> Word128 #
Multiplicative Word256 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word256 # (*) :: Word256 -> Word256 -> Word256 # (^) :: (IsNatural n, Enum n, IDivisible n) => Word256 -> n -> Word256 #
Multiplicative CChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CChar # (*) :: CChar -> CChar -> CChar # (^) :: (IsNatural n, Enum n, IDivisible n) => CChar -> n -> CChar #
Multiplicative CClock |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CClock # (*) :: CClock -> CClock -> CClock # (^) :: (IsNatural n, Enum n, IDivisible n) => CClock -> n -> CClock #
Multiplicative CDouble |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CDouble # (*) :: CDouble -> CDouble -> CDouble # (^) :: (IsNatural n, Enum n, IDivisible n) => CDouble -> n -> CDouble #
Multiplicative CFloat |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CFloat # (*) :: CFloat -> CFloat -> CFloat # (^) :: (IsNatural n, Enum n, IDivisible n) => CFloat -> n -> CFloat #
Multiplicative CInt |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CInt # (*) :: CInt -> CInt -> CInt # (^) :: (IsNatural n, Enum n, IDivisible n) => CInt -> n -> CInt #
Multiplicative CIntMax |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CIntMax # (*) :: CIntMax -> CIntMax -> CIntMax # (^) :: (IsNatural n, Enum n, IDivisible n) => CIntMax -> n -> CIntMax #
Multiplicative CIntPtr |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CIntPtr # (*) :: CIntPtr -> CIntPtr -> CIntPtr # (^) :: (IsNatural n, Enum n, IDivisible n) => CIntPtr -> n -> CIntPtr #
Multiplicative CLLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CLLong # (*) :: CLLong -> CLLong -> CLLong # (^) :: (IsNatural n, Enum n, IDivisible n) => CLLong -> n -> CLLong #
Multiplicative CLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CLong # (*) :: CLong -> CLong -> CLong # (^) :: (IsNatural n, Enum n, IDivisible n) => CLong -> n -> CLong #
Multiplicative CPtrdiff |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CPtrdiff # (*) :: CPtrdiff -> CPtrdiff -> CPtrdiff # (^) :: (IsNatural n, Enum n, IDivisible n) => CPtrdiff -> n -> CPtrdiff #
Multiplicative CSChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CSChar # (*) :: CSChar -> CSChar -> CSChar # (^) :: (IsNatural n, Enum n, IDivisible n) => CSChar -> n -> CSChar #
Multiplicative CSUSeconds |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CSUSeconds # (*) :: CSUSeconds -> CSUSeconds -> CSUSeconds # (^) :: (IsNatural n, Enum n, IDivisible n) => CSUSeconds -> n -> CSUSeconds #
Multiplicative CShort |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CShort # (*) :: CShort -> CShort -> CShort # (^) :: (IsNatural n, Enum n, IDivisible n) => CShort -> n -> CShort #
Multiplicative CSigAtomic |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CSigAtomic # (*) :: CSigAtomic -> CSigAtomic -> CSigAtomic # (^) :: (IsNatural n, Enum n, IDivisible n) => CSigAtomic -> n -> CSigAtomic #
Multiplicative CSize |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CSize # (*) :: CSize -> CSize -> CSize # (^) :: (IsNatural n, Enum n, IDivisible n) => CSize -> n -> CSize #
Multiplicative CTime |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CTime # (*) :: CTime -> CTime -> CTime # (^) :: (IsNatural n, Enum n, IDivisible n) => CTime -> n -> CTime #
Multiplicative CUChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUChar # (*) :: CUChar -> CUChar -> CUChar # (^) :: (IsNatural n, Enum n, IDivisible n) => CUChar -> n -> CUChar #
Multiplicative CUInt |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUInt # (*) :: CUInt -> CUInt -> CUInt # (^) :: (IsNatural n, Enum n, IDivisible n) => CUInt -> n -> CUInt #
Multiplicative CUIntMax |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUIntMax # (*) :: CUIntMax -> CUIntMax -> CUIntMax # (^) :: (IsNatural n, Enum n, IDivisible n) => CUIntMax -> n -> CUIntMax #
Multiplicative CUIntPtr |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUIntPtr # (*) :: CUIntPtr -> CUIntPtr -> CUIntPtr # (^) :: (IsNatural n, Enum n, IDivisible n) => CUIntPtr -> n -> CUIntPtr #
Multiplicative CULLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CULLong # (*) :: CULLong -> CULLong -> CULLong # (^) :: (IsNatural n, Enum n, IDivisible n) => CULLong -> n -> CULLong #
Multiplicative CULong |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CULong # (*) :: CULong -> CULong -> CULong # (^) :: (IsNatural n, Enum n, IDivisible n) => CULong -> n -> CULong #
Multiplicative CUSeconds |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUSeconds # (*) :: CUSeconds -> CUSeconds -> CUSeconds # (^) :: (IsNatural n, Enum n, IDivisible n) => CUSeconds -> n -> CUSeconds #
Multiplicative CUShort |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CUShort # (*) :: CUShort -> CUShort -> CUShort # (^) :: (IsNatural n, Enum n, IDivisible n) => CUShort -> n -> CUShort #
Multiplicative CWchar |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: CWchar # (*) :: CWchar -> CWchar -> CWchar # (^) :: (IsNatural n, Enum n, IDivisible n) => CWchar -> n -> CWchar #
Multiplicative Int16 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int16 # (*) :: Int16 -> Int16 -> Int16 # (^) :: (IsNatural n, Enum n, IDivisible n) => Int16 -> n -> Int16 #
Multiplicative Int32 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int32 # (*) :: Int32 -> Int32 -> Int32 # (^) :: (IsNatural n, Enum n, IDivisible n) => Int32 -> n -> Int32 #
Multiplicative Int64 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int64 # (*) :: Int64 -> Int64 -> Int64 # (^) :: (IsNatural n, Enum n, IDivisible n) => Int64 -> n -> Int64 #
Multiplicative Int8 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int8 # (*) :: Int8 -> Int8 -> Int8 # (^) :: (IsNatural n, Enum n, IDivisible n) => Int8 -> n -> Int8 #
Multiplicative Rational |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Rational # (*) :: Rational -> Rational -> Rational # (^) :: (IsNatural n, Enum n, IDivisible n) => Rational -> n -> Rational #
Multiplicative COff |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: COff # (*) :: COff -> COff -> COff # (^) :: (IsNatural n, Enum n, IDivisible n) => COff -> n -> COff #
Multiplicative Word16 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word16 # (*) :: Word16 -> Word16 -> Word16 # (^) :: (IsNatural n, Enum n, IDivisible n) => Word16 -> n -> Word16 #
Multiplicative Word32 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word32 # (*) :: Word32 -> Word32 -> Word32 # (^) :: (IsNatural n, Enum n, IDivisible n) => Word32 -> n -> Word32 #
Multiplicative Word64 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word64 # (*) :: Word64 -> Word64 -> Word64 # (^) :: (IsNatural n, Enum n, IDivisible n) => Word64 -> n -> Word64 #
Multiplicative Word8 |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word8 # (*) :: Word8 -> Word8 -> Word8 # (^) :: (IsNatural n, Enum n, IDivisible n) => Word8 -> n -> Word8 #
Multiplicative Integer |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Integer # (*) :: Integer -> Integer -> Integer # (^) :: (IsNatural n, Enum n, IDivisible n) => Integer -> n -> Integer #
Multiplicative Natural |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Natural # (*) :: Natural -> Natural -> Natural # (^) :: (IsNatural n, Enum n, IDivisible n) => Natural -> n -> Natural #
Multiplicative Double |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Double # (*) :: Double -> Double -> Double # (^) :: (IsNatural n, Enum n, IDivisible n) => Double -> n -> Double #
Multiplicative Float |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Float # (*) :: Float -> Float -> Float # (^) :: (IsNatural n, Enum n, IDivisible n) => Float -> n -> Float #
Multiplicative Int |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Int # (*) :: Int -> Int -> Int # (^) :: (IsNatural n, Enum n, IDivisible n) => Int -> n -> Int #
Multiplicative Word |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word # (*) :: Word -> Word -> Word # (^) :: (IsNatural n, Enum n, IDivisible n) => Word -> n -> Word #
SizeValid n => Multiplicative (Bits n) |
Instance details Defined in Basement.Bits Methods midentity :: Bits n # (*) :: Bits n -> Bits n -> Bits n # (^) :: (IsNatural n0, Enum n0, IDivisible n0) => Bits n -> n0 -> Bits n #

class (Additive a, Multiplicative a) => IDivisible a where #

Represent types that supports an euclidian division

    (x ‘div‘ y) * y + (x ‘mod‘ y) == x

Minimal complete definition

div, mod | divMod

Methods

div :: a -> a -> a #

mod :: a -> a -> a #

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

#### Instances

Instances details

IDivisible Word128 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word128 -> Word128 -> Word128 # mod :: Word128 -> Word128 -> Word128 # divMod :: Word128 -> Word128 -> (Word128, Word128) #
IDivisible Word256 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word256 -> Word256 -> Word256 # mod :: Word256 -> Word256 -> Word256 # divMod :: Word256 -> Word256 -> (Word256, Word256) #
IDivisible CChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CChar -> CChar -> CChar # mod :: CChar -> CChar -> CChar # divMod :: CChar -> CChar -> (CChar, CChar) #
IDivisible CInt |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CInt -> CInt -> CInt # mod :: CInt -> CInt -> CInt # divMod :: CInt -> CInt -> (CInt, CInt) #
IDivisible CIntMax |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CIntMax -> CIntMax -> CIntMax # mod :: CIntMax -> CIntMax -> CIntMax # divMod :: CIntMax -> CIntMax -> (CIntMax, CIntMax) #
IDivisible CIntPtr |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CIntPtr -> CIntPtr -> CIntPtr # mod :: CIntPtr -> CIntPtr -> CIntPtr # divMod :: CIntPtr -> CIntPtr -> (CIntPtr, CIntPtr) #
IDivisible CLLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CLLong -> CLLong -> CLLong # mod :: CLLong -> CLLong -> CLLong # divMod :: CLLong -> CLLong -> (CLLong, CLLong) #
IDivisible CLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CLong -> CLong -> CLong # mod :: CLong -> CLong -> CLong # divMod :: CLong -> CLong -> (CLong, CLong) #
IDivisible CPtrdiff |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CPtrdiff -> CPtrdiff -> CPtrdiff # mod :: CPtrdiff -> CPtrdiff -> CPtrdiff # divMod :: CPtrdiff -> CPtrdiff -> (CPtrdiff, CPtrdiff) #
IDivisible CSChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CSChar -> CSChar -> CSChar # mod :: CSChar -> CSChar -> CSChar # divMod :: CSChar -> CSChar -> (CSChar, CSChar) #
IDivisible CShort |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CShort -> CShort -> CShort # mod :: CShort -> CShort -> CShort # divMod :: CShort -> CShort -> (CShort, CShort) #
IDivisible CSigAtomic |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CSigAtomic -> CSigAtomic -> CSigAtomic # mod :: CSigAtomic -> CSigAtomic -> CSigAtomic # divMod :: CSigAtomic -> CSigAtomic -> (CSigAtomic, CSigAtomic) #
IDivisible CSize |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CSize -> CSize -> CSize # mod :: CSize -> CSize -> CSize # divMod :: CSize -> CSize -> (CSize, CSize) #
IDivisible CUChar |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUChar -> CUChar -> CUChar # mod :: CUChar -> CUChar -> CUChar # divMod :: CUChar -> CUChar -> (CUChar, CUChar) #
IDivisible CUInt |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUInt -> CUInt -> CUInt # mod :: CUInt -> CUInt -> CUInt # divMod :: CUInt -> CUInt -> (CUInt, CUInt) #
IDivisible CUIntMax |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUIntMax -> CUIntMax -> CUIntMax # mod :: CUIntMax -> CUIntMax -> CUIntMax # divMod :: CUIntMax -> CUIntMax -> (CUIntMax, CUIntMax) #
IDivisible CUIntPtr |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUIntPtr -> CUIntPtr -> CUIntPtr # mod :: CUIntPtr -> CUIntPtr -> CUIntPtr # divMod :: CUIntPtr -> CUIntPtr -> (CUIntPtr, CUIntPtr) #
IDivisible CULLong |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CULLong -> CULLong -> CULLong # mod :: CULLong -> CULLong -> CULLong # divMod :: CULLong -> CULLong -> (CULLong, CULLong) #
IDivisible CULong |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CULong -> CULong -> CULong # mod :: CULong -> CULong -> CULong # divMod :: CULong -> CULong -> (CULong, CULong) #
IDivisible CUShort |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CUShort -> CUShort -> CUShort # mod :: CUShort -> CUShort -> CUShort # divMod :: CUShort -> CUShort -> (CUShort, CUShort) #
IDivisible CWchar |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: CWchar -> CWchar -> CWchar # mod :: CWchar -> CWchar -> CWchar # divMod :: CWchar -> CWchar -> (CWchar, CWchar) #
IDivisible Int16 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int16 -> Int16 -> Int16 # mod :: Int16 -> Int16 -> Int16 # divMod :: Int16 -> Int16 -> (Int16, Int16) #
IDivisible Int32 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int32 -> Int32 -> Int32 # mod :: Int32 -> Int32 -> Int32 # divMod :: Int32 -> Int32 -> (Int32, Int32) #
IDivisible Int64 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int64 -> Int64 -> Int64 # mod :: Int64 -> Int64 -> Int64 # divMod :: Int64 -> Int64 -> (Int64, Int64) #
IDivisible Int8 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int8 -> Int8 -> Int8 # mod :: Int8 -> Int8 -> Int8 # divMod :: Int8 -> Int8 -> (Int8, Int8) #
IDivisible Word16 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word16 -> Word16 -> Word16 # mod :: Word16 -> Word16 -> Word16 # divMod :: Word16 -> Word16 -> (Word16, Word16) #
IDivisible Word32 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word32 -> Word32 -> Word32 # mod :: Word32 -> Word32 -> Word32 # divMod :: Word32 -> Word32 -> (Word32, Word32) #
IDivisible Word64 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word64 -> Word64 -> Word64 # mod :: Word64 -> Word64 -> Word64 # divMod :: Word64 -> Word64 -> (Word64, Word64) #
IDivisible Word8 |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word8 -> Word8 -> Word8 # mod :: Word8 -> Word8 -> Word8 # divMod :: Word8 -> Word8 -> (Word8, Word8) #
IDivisible Integer |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Integer -> Integer -> Integer # mod :: Integer -> Integer -> Integer # divMod :: Integer -> Integer -> (Integer, Integer) #
IDivisible Natural |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Natural -> Natural -> Natural # mod :: Natural -> Natural -> Natural # divMod :: Natural -> Natural -> (Natural, Natural) #
IDivisible Int |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Int -> Int -> Int # mod :: Int -> Int -> Int # divMod :: Int -> Int -> (Int, Int) #
IDivisible Word |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word -> Word -> Word # mod :: Word -> Word -> Word # divMod :: Word -> Word -> (Word, Word) #
SizeValid n => IDivisible (Bits n) |
Instance details Defined in Basement.Bits Methods div :: Bits n -> Bits n -> Bits n # mod :: Bits n -> Bits n -> Bits n # divMod :: Bits n -> Bits n -> (Bits n, Bits n) #

class Multiplicative a => Divisible a where #

Support for division between same types

This is likely to change to represent specific mathematic divisions

Methods

(/) :: a -> a -> a infixl 7 #

#### Instances

Instances details

Divisible CDouble |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: CDouble -> CDouble -> CDouble #
Divisible CFloat |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: CFloat -> CFloat -> CFloat #
Divisible Rational |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: Rational -> Rational -> Rational #
Divisible Double |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: Double -> Double -> Double #
Divisible Float |
Instance details Defined in Basement.Numerical.Multiplicative Methods (/) :: Float -> Float -> Float #

data Sign #

Sign of a signed number

Constructors

SignNegative |
SignZero |
SignPositive |

#### Instances

Instances details

Eq Sign # |
Instance details Defined in Foundation.Numerical Methods (==) :: Sign -> Sign -> Bool # (/=) :: Sign -> Sign -> Bool #

recip :: Divisible a => a -> a #

class IntegralRounding a where #

Methods

roundUp :: Integral n => a -> n #

Round up, to the next integral.

Also known as `ceiling`

roundDown :: Integral n => a -> n #

Round down, to the previous integral

Also known as `floor`

roundTruncate :: Integral n => a -> n #

Truncate to the closest integral to the fractional number closer to 0.

This is equivalent to roundUp for negative Number and roundDown for positive Number

roundNearest :: Integral n => a -> n #

Round to the nearest integral

    roundNearest 3.6

4 > roundNearest 3.4 3

#### Instances

Instances details

IntegralRounding Rational # |
Instance details Defined in Foundation.Numerical Methods roundUp :: Integral n => Rational -> n # roundDown :: Integral n => Rational -> n # roundTruncate :: Integral n => Rational -> n # roundNearest :: Integral n => Rational -> n #
IntegralRounding Double # |
Instance details Defined in Foundation.Numerical Methods roundUp :: Integral n => Double -> n # roundDown :: Integral n => Double -> n # roundTruncate :: Integral n => Double -> n # roundNearest :: Integral n => Double -> n #
IntegralRounding Float # |
Instance details Defined in Foundation.Numerical Methods roundUp :: Integral n => Float -> n # roundDown :: Integral n => Float -> n # roundTruncate :: Integral n => Float -> n # roundNearest :: Integral n => Float -> n #

class FloatingPoint a where #

IEEE754 Floating Point

Methods

floatRadix :: Proxy a -> Integer #

floatDigits :: Proxy a -> Int #

floatRange :: Proxy a -> (Int, Int) #

floatDecode :: a -> (Integer, Int) #

floatEncode :: Integer -> Int -> a #

#### Instances

Instances details

FloatingPoint Double # |
Instance details Defined in Foundation.Numerical.Floating Methods floatRadix :: Proxy Double -> Integer # floatDigits :: Proxy Double -> Int # floatRange :: Proxy Double -> (Int, Int) # floatDecode :: Double -> (Integer, Int) # floatEncode :: Integer -> Int -> Double #
FloatingPoint Float # |
Instance details Defined in Foundation.Numerical.Floating Methods floatRadix :: Proxy Float -> Integer # floatDigits :: Proxy Float -> Int # floatRange :: Proxy Float -> (Int, Int) # floatDecode :: Float -> (Integer, Int) # floatEncode :: Integer -> Int -> Float #