Math unit
Additional mathematical routines.
This document describes the math unit. The math unit
was initially written by Florian Klaempfl. It provides mathematical
functions which aren't covered by the system unit.
This chapter starts out with a definition of all types and constants that are defined, after which an overview is presented of the available functions, grouped by category, and the last part contains a complete explanation of each function.
The following things must be taken into account when using this unit:
- This unit is compiled in Object Pascal mode so all
integersare 32 bit. - Some overloaded functions exist for data arrays of integers and
floats. When using the address operator (
@) to pass an array of data to such a function, make sure the address is typecasted to the right type, or turn on the 'typed address operator' feature. failing to do so, will cause the compiler not be able to decide which function you want to call.
Classes and records
EInvalidArgument | class | Exception raised when invalid arguments are passed to a function. |
Procedures and functions
ArcCos | function | Return inverse cosine. |
ArcCosH | function | Return inverse hyperbolic cosine. |
ArcCot | function | |
ArcCotH | function | |
ArcCsc | function | |
ArcCscH | function | |
ArCosH | function | Return inverse hyperbolic cosine. |
ArcSec | function | |
ArcSecH | function | |
ArcSin | function | Return inverse sine. |
ArcSinH | function | Return inverse hyperbolic sine. |
ArcTan2 | function | Return arctangent of (y/x). |
ArcTanH | function | Return inverse hyperbolic tangent. |
ArSinH | function | Return inverse hyperbolic sine. |
ArTanH | function | Return inverse hyperbolic tangent. |
Ceil | function | Return the lowest integer number greater than or equal to argument. |
Ceil64 | function | Round to the nearest bigger int64 value. |
ClearExceptions | procedure | Clear Floating Point Unit exceptions. |
CompareValue | function | Compare 2 values. |
Cosecant | function | Calculate cosecant. |
cosh | function | Return hyperbolic cosine. |
Cot | function | Alias for Cotan. |
Cotan | function | Return cotangent. |
CotH | function | |
Csc | function | Alias for cosecant. |
CscH | function | |
CycleToDeg | function | |
CycleToGrad | function | |
CycleToRad | function | Convert cycle angle to radians angle. |
DegNormalize | function | Normalize an angle measured in degrees. |
DegToCycle | function | |
DegToGrad | function | Convert degree angle to grads angle. |
DegToRad | function | Convert degree angle to radians angle. |
DivMod | procedure | Return DIV and MOD of arguments. |
EnsureRange | function | Change value so it fits in a specified range. |
ExpM1 | function | |
Floor | function | Return the largest integer smaller than or equal to argument. |
Floor64 | function | Round to the nearest smaller int64 value. |
FMod | function | Floatin point modulo. |
Frexp | procedure | Return mantissa and exponent. |
FutureValue | function | Calculate the future value of an investment. |
GetExceptionMask | function | Get the Floating Point Unit exception mask. |
GetPrecisionMode | function | Return the Floating Point Unit precision mode. |
GetRoundMode | function | Return the Floating Point Unit rounding mode. |
GradToCycle | function | |
GradToDeg | function | Convert grads angle to degrees angle. |
GradToRad | function | Convert grads angle to radians angle. |
Hypot | function | Return hypotenuse of triangle. |
IfThen | function | Return one of two values, depending on a boolean condition. |
InRange | function | Check whether value is in range. |
InterestRate | function | Calculate the interest rate value of an investment. |
IntPower | function | Return integer power. |
IsInfinite | function | Check whether value is infinite. |
IsNan | function | Check whether value is Not a Number. |
IsZero | function | Check whether value is zero. |
Ldexp | function | Return (2 to the power p) times x. |
LnXP1 | function | Return natural logarithm of 1+X. |
Log10 | function | Return 10-Based logarithm. |
Log2 | function | Return 2-based logarithm. |
LogN | function | Return N-based logarithm. |
Max | function | Returns the largest of two values. |
MaxIntValue | function | Return largest element in integer array. |
MaxValue | function | Return largest value in array. |
Mean | function | Return mean value of array. |
MeanAndStdDev | procedure | Return mean and standard deviation of array. |
Min | function | Return smallest of two values. |
MinIntValue | function | Return smallest value in integer array. |
MinValue | function | Return smallest value in array. |
modulus(Float,Float):Float | operator | Floating point modulo. |
MomentSkewKurtosis | procedure | Return 4 first moments of distribution. |
Norm | function | Return Euclidean norm. |
NumberOfPeriods | function | Calculate the number of periods for an investment. |
Payment | function | Calculate the payment for an investment. |
PopnStdDev | function | Return Population standard deviation. |
PopnVariance | function | Return population variance. |
Power | function | Return real power. |
power(Float,Float):Float | operator | Raise base to the power exponent. |
power(Int64,Int64):Int64 | operator | Raise base to the power exponent. |
PresentValue | function | Calculate the present value given the future value of an investment. |
RadToCycle | function | Convert radians angle to cycle angle. |
RadToDeg | function | Convert radians angle to degrees angle. |
RadToGrad | function | Convert radians angle to grads angle. |
RandG | function | Return gaussian distributed random number. |
RandomFrom | function | Return a random element of an array of numbers. |
RandomRange | function | Return a random number in a range. |
RoundTo | function | Round to the specified number of digits. |
SameValue | function | Check whether 2 float values are the same. |
Sec | function | Alias for secant. |
Secant | function | Calculate secant. |
SecH | function | |
SetExceptionMask | function | Set the Floating Point Unit exception mask. |
SetPrecisionMode | function | Set the Floating Point Unit precision mode. |
SetRoundMode | function | Set the Floating Point Unit rounding mode. |
Sign | function | Return sign of argument. |
SimpleRoundTo | function | Round to the specified number of digits (rounding up if needed). |
SinCos | procedure | Return sine and cosine of argument. |
sinh | function | Return hyperbolic sine. |
StdDev | function | Return standard deviation of data. |
Sum | function | Return sum of values. |
SumInt | function | Return the sum of an array of integers. |
SumOfSquares | function | Return sum of squares of values. |
SumsAndSquares | procedure | Return sum and sum of squares of values. |
Tan | function | Return tangent. |
tanh | function | Return hyperbolic tangent. |
TotalVariance | function | Return total variance of values. |
Variance | function | Return variance of values. |
Types
Float | type | Float type used in all calls. |
PFloat | type | Pointer to type. |
PInteger | type | Pointer to integer type. |
TFPUException | type | Type describing Floating Point processor exceptions. |
TFPUExceptionMask | type | Type to set the Floating Point Unit exception mask. |
TFPUPrecisionMode | type | Type describing the default precision for the Floating Point processor. |
TFPURoundingMode | type | Type describing the rounding mode for the Floating Point processor. |
TPaymentTime | enumeration | Type used in financial (interest) calculations. |
TRoundToRange | type | Range with valid range of digits in RoundTo. |
TValueRelationship | type | Type to describe relational order between values. |
TValueSign | type | Type indicating sign of a value. |
Constants
EqualsValue | constant | Values are the same. |
GreaterThanValue | constant | First values is greater than second value. |
Infinity | constant | Value is infinity. |
LessThanValue | constant | First value is less than second value. |
MaxFloat | constant | Maximum value of float type. |
MinFloat | constant | Minimum value (closest to zero) of float type. |
NaN | constant | Value is Not a Number. |
NegativeValue | constant | Value is negative. |
NegInfinity | constant | Value is negative (minus) infinity. |
PositiveValue | constant | Value is positive. |
ZeroValue | constant | Value is zero. |
Topics
AngleConversionRoutines | topic | Angle unit conversion. |
CashFlowFunctions | topic | Cash flow functions. |
ExpLogRoutines | topic | Exponential and logarithmic functions. |
GeometricalRoutines | topic | Geometrical functions. |
HyperbolicRoutines | topic | Hyperbolic functions. |
MinMaxRoutines | topic | Min/max determination. |
NumberConversionRoutines | topic | Number converting. |
StatisticalRoutines | topic | Statistical functions. |
TrigoniometricRoutines | topic | Trigonometric functions. |
Uses
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
