Copyright | Justin Ethier |
---|---|
License | MIT (see LICENSE in the distribution) |
Maintainer | github.com/justinethier |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
This module implements the numerical tower.
- numSub :: [LispVal] -> ThrowsError LispVal
- numMul :: [LispVal] -> ThrowsError LispVal
- numDiv :: [LispVal] -> ThrowsError LispVal
- numAdd :: [LispVal] -> ThrowsError LispVal
- numMod :: [LispVal] -> ThrowsError LispVal
- numRationalize :: [LispVal] -> ThrowsError LispVal
- numBoolBinopEq :: [LispVal] -> ThrowsError LispVal
- numBoolBinopGt :: [LispVal] -> ThrowsError LispVal
- numBoolBinopGte :: [LispVal] -> ThrowsError LispVal
- numBoolBinopLt :: [LispVal] -> ThrowsError LispVal
- numBoolBinopLte :: [LispVal] -> ThrowsError LispVal
- numCast :: [LispVal] -> ThrowsError LispVal
- numDenominator :: [LispVal] -> ThrowsError LispVal
- numNumerator :: [LispVal] -> ThrowsError LispVal
- numInexact2Exact :: [LispVal] -> ThrowsError LispVal
- numExact2Inexact :: [LispVal] -> ThrowsError LispVal
- num2String :: [LispVal] -> ThrowsError LispVal
- unpackNum :: LispVal -> ThrowsError Integer
- numericBinop :: (Integer -> Integer -> Integer) -> [LispVal] -> ThrowsError LispVal
- numFloor :: [LispVal] -> ThrowsError LispVal
- numCeiling :: [LispVal] -> ThrowsError LispVal
- numTruncate :: [LispVal] -> ThrowsError LispVal
- numRound :: [LispVal] -> ThrowsError LispVal
- numExpt :: [LispVal] -> ThrowsError LispVal
- numSqrt :: [LispVal] -> ThrowsError LispVal
- numExp :: [LispVal] -> ThrowsError LispVal
- numLog :: [LispVal] -> ThrowsError LispVal
- numSin :: [LispVal] -> ThrowsError LispVal
- numCos :: [LispVal] -> ThrowsError LispVal
- numTan :: [LispVal] -> ThrowsError LispVal
- numAsin :: [LispVal] -> ThrowsError LispVal
- numAcos :: [LispVal] -> ThrowsError LispVal
- numAtan :: [LispVal] -> ThrowsError LispVal
- buildComplex :: LispVal -> LispVal -> ThrowsError LispVal
- numMakePolar :: [LispVal] -> ThrowsError LispVal
- numRealPart :: [LispVal] -> ThrowsError LispVal
- numImagPart :: [LispVal] -> ThrowsError LispVal
- numMagnitude :: [LispVal] -> ThrowsError LispVal
- numAngle :: [LispVal] -> ThrowsError LispVal
- numMakeRectangular :: [LispVal] -> ThrowsError LispVal
- isComplex :: [LispVal] -> ThrowsError LispVal
- isReal :: [LispVal] -> ThrowsError LispVal
- isRational :: [LispVal] -> ThrowsError LispVal
- isInteger :: [LispVal] -> ThrowsError LispVal
- isNumber :: [LispVal] -> ThrowsError LispVal
- isFloatAnInteger :: LispVal -> Bool
- isNumNaN :: [LispVal] -> ThrowsError LispVal
- isNumInfinite :: [LispVal] -> ThrowsError LispVal
- isNumFinite :: [LispVal] -> ThrowsError LispVal
- isNumExact :: [LispVal] -> ThrowsError LispVal
- isNumInexact :: [LispVal] -> ThrowsError LispVal
Generic functions
numRationalize :: [LispVal] -> ThrowsError LispVal Source #
Convert the given number to a rational
numBoolBinopEq :: [LispVal] -> ThrowsError LispVal Source #
Numeric equals
numBoolBinopGt :: [LispVal] -> ThrowsError LispVal Source #
Numeric greater than
numBoolBinopGte :: [LispVal] -> ThrowsError LispVal Source #
Numeric greater than equal
numBoolBinopLt :: [LispVal] -> ThrowsError LispVal Source #
Numeric less than
numBoolBinopLte :: [LispVal] -> ThrowsError LispVal Source #
Numeric less than equal
numCast :: [LispVal] -> ThrowsError LispVal Source #
Accept two numbers and cast one of them to the appropriate type, if necessary
numDenominator :: [LispVal] -> ThrowsError LispVal Source #
Take the denominator of the given number
numNumerator :: [LispVal] -> ThrowsError LispVal Source #
Take the numerator of the given number
numInexact2Exact :: [LispVal] -> ThrowsError LispVal Source #
Convert an inexact number to exact
numExact2Inexact :: [LispVal] -> ThrowsError LispVal Source #
Convert an exact number to inexact
num2String :: [LispVal] -> ThrowsError LispVal Source #
Convert a number to a string; radix is optional, defaults to base 10
unpackNum :: LispVal -> ThrowsError Integer Source #
Extract an integer from the given value, throwing a type error if the wrong type is passed.
numericBinop :: (Integer -> Integer -> Integer) -> [LispVal] -> ThrowsError LispVal Source #
A helper function to perform a numeric operation on two values
Floating point functions
numCeiling :: [LispVal] -> ThrowsError LispVal Source #
Take the ceiling of the given number
numTruncate :: [LispVal] -> ThrowsError LispVal Source #
Truncate the given number
numExpt :: [LispVal] -> ThrowsError LispVal Source #
Raise the first number to the power of the second
Trigonometric functions
Complex functions
:: LispVal | Real part |
-> LispVal | Imaginary part |
-> ThrowsError LispVal | Complex number |
Create a complex number
numMakePolar :: [LispVal] -> ThrowsError LispVal Source #
Create a complex number from its magnitude and phase (angle)
numRealPart :: [LispVal] -> ThrowsError LispVal Source #
Retrieve real part of a complex number
numImagPart :: [LispVal] -> ThrowsError LispVal Source #
Retrieve imaginary part of a complex number
numMagnitude :: [LispVal] -> ThrowsError LispVal Source #
The nonnegative magnitude of a complex number
numMakeRectangular :: [LispVal] -> ThrowsError LispVal Source #
Create a complex number given its real and imaginary parts
Predicates
isComplex :: [LispVal] -> ThrowsError LispVal Source #
Predicate to determine if given number is complex. Keep in mind this does not just look at the types
isReal :: [LispVal] -> ThrowsError LispVal Source #
Predicate to determine if given number is a real. Keep in mind this does not just look at the types
isRational :: [LispVal] -> ThrowsError LispVal Source #
Predicate to determine if given number is a rational. Keep in mind this does not just look at the types
isInteger :: [LispVal] -> ThrowsError LispVal Source #
Predicate to determine if given number is an integer. Keep in mind this does not just look at the types; a floating point input value can return true, for example.
isNumber :: [LispVal] -> ThrowsError LispVal Source #
Predicate to determine if given value is a number
isFloatAnInteger :: LispVal -> Bool Source #
A utility function to determine if given value is a floating point number representing an whole number (integer).
isNumInfinite :: [LispVal] -> ThrowsError LispVal Source #
Determine if number is infinite
isNumFinite :: [LispVal] -> ThrowsError LispVal Source #
Determine if number is not infinite
isNumExact :: [LispVal] -> ThrowsError LispVal Source #
Determine if number is exact
isNumInexact :: [LispVal] -> ThrowsError LispVal Source #
Determine if number is inexact