husk-scheme-3.15.1: R5RS Scheme interpreter, compiler, and library.

Portabilityportable
Stabilityexperimental
Maintainergithub.com/justinethier
Safe HaskellSafe-Inferred

Language.Scheme.Numerical

Contents

Description

This module implements the numerical tower.

Synopsis

Generic functions

numSub :: [LispVal] -> ThrowsError LispVal

Subtract the given numbers

numMul :: [LispVal] -> ThrowsError LispVal

Multiply the given numbers

numDiv :: [LispVal] -> ThrowsError LispVal

Divide the given numbers

numAdd :: [LispVal] -> ThrowsError LispVal

Add the given numbers

numMod :: [LispVal] -> ThrowsError LispVal

Take the modulus of the given numbers

numRationalize :: [LispVal] -> ThrowsError LispVal

Convert the given number to a rational

numBoolBinopEq :: [LispVal] -> ThrowsError LispVal

Numeric equals

numBoolBinopGt :: [LispVal] -> ThrowsError LispVal

Numeric greater than

numBoolBinopGte :: [LispVal] -> ThrowsError LispVal

Numeric greater than equal

numBoolBinopLt :: [LispVal] -> ThrowsError LispVal

Numeric less than

numBoolBinopLte :: [LispVal] -> ThrowsError LispVal

Numeric less than equal

numCast :: [LispVal] -> ThrowsError LispVal

Accept two numbers and cast one of them to the appropriate type, if necessary

numDenominator :: [LispVal] -> ThrowsError LispVal

Take the denominator of the given number

numNumerator :: [LispVal] -> ThrowsError LispVal

Take the numerator of the given number

numInexact2Exact :: [LispVal] -> ThrowsError LispVal

Convert an inexact number to exact

numExact2Inexact :: [LispVal] -> ThrowsError LispVal

Convert an exact number to inexact

num2String :: [LispVal] -> ThrowsError LispVal

Convert a number to a string; radix is optional, defaults to base 10

unpackNum :: LispVal -> ThrowsError Integer

Extract an integer from the given value, throwing a type error if the wrong type is passed.

numericBinop :: (Integer -> Integer -> Integer) -> [LispVal] -> ThrowsError LispVal

A helper function to perform a numeric operation on two values

Floating point functions

numFloor :: [LispVal] -> ThrowsError LispVal

Floor the given number

numCeiling :: [LispVal] -> ThrowsError LispVal

Take the ceiling of the given number

numTruncate :: [LispVal] -> ThrowsError LispVal

Truncate the given number

numRound :: [LispVal] -> ThrowsError LispVal

Round the given number

numExpt :: [LispVal] -> ThrowsError LispVal

Raise the first number to the power of the second

numSqrt :: [LispVal] -> ThrowsError LispVal

Take the square root of the given number

numExp :: [LispVal] -> ThrowsError LispVal

Take the exponent of the given number

numLog :: [LispVal] -> ThrowsError LispVal

Compute the log of a given number

Trigonometric functions

numAtan :: [LispVal] -> ThrowsError LispVal

Arctangent

Complex functions

buildComplex

Arguments

:: LispVal

Real part

-> LispVal

Imaginary part

-> ThrowsError LispVal

Complex number

Create a complex number

numMakePolar :: [LispVal] -> ThrowsError LispVal

Create a complex number from its magnitude and phase (angle)

numRealPart :: [LispVal] -> ThrowsError LispVal

Retrieve real part of a complex number

numImagPart :: [LispVal] -> ThrowsError LispVal

Retrieve imaginary part of a complex number

numMagnitude :: [LispVal] -> ThrowsError LispVal

The nonnegative magnitude of a complex number

numAngle :: [LispVal] -> ThrowsError LispVal

The phase of a complex number

numMakeRectangular :: [LispVal] -> ThrowsError LispVal

Create a complex number given its real and imaginary parts

Predicates

isComplex :: [LispVal] -> ThrowsError LispVal

Predicate to determine if given number is complex. Keep in mind this does not just look at the types

isReal :: [LispVal] -> ThrowsError LispVal

Predicate to determine if given number is a real. Keep in mind this does not just look at the types

isRational :: [LispVal] -> ThrowsError LispVal

Predicate to determine if given number is a rational. Keep in mind this does not just look at the types

isInteger :: [LispVal] -> ThrowsError LispVal

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

Predicate to determine if given value is a number

isFloatAnInteger :: LispVal -> Bool

A utility function to determine if given value is a floating point number representing an whole number (integer).

isNumNaN :: [LispVal] -> ThrowsError LispVal

Determine if the given value is not a number

isNumInfinite :: [LispVal] -> ThrowsError LispVal

Determine if number is infinite

isNumFinite :: [LispVal] -> ThrowsError LispVal

Determine if number is not infinite

isNumExact :: [LispVal] -> ThrowsError LispVal

Determine if number is exact

isNumInexact :: [LispVal] -> ThrowsError LispVal

Determine if number is inexact