module Math: sig end
Useful mathmatical functions
There's a lot of math functions that aren't provided by ocaml's
standard library. Some of them are C functions in the C99 standard,
others are common in unix C libraries, and others are just plain handy
at times.
val succ_float : float -> float
Returns n+1.0
val pred_float : float -> float
Returns n-1.0
val root : float -> int -> float
root x n
calculates the nth root of x.
val fraction : ?error:float -> float -> int * int
fraction x
returns the numerator and denominator of a fraction approximating x
error
: The accuracy to which the fraction should represent the original number.
If these functions aren't provided by a system's libc, they raise Failure.
val fma : float -> float -> float -> float
The C99 function fma()
val fdim : float -> float -> float
Returns The positive difference between its arguments.
val nextafter : float -> float -> float
Returns The next representable value after x in the direction of y.
val remainder : float -> float -> float
Returns x REM y. See IEC 60559.
val trunc : float -> float
Returns The integer value nearest to but no larger in magnitude than x.
val round : float -> float
Returns X rounded to the nearest integer value, rounding halfway cases away from zero.
val nearbyint : float -> float
Returns x, rounded to the nearest integer value, using the current rounding direction.
val tgamma : float -> float
Returns The gamma function of x.
val lgamma : float -> float
Returns The natural logarithm of the absolute value of gamma of x.
val erfc : float -> float
Returns The complementary error function of x.
val erf : float -> float
Returns The error function of x.
val hypot : float -> float -> float
Returns The square root of the sum of the squares of x and y.
val cbrt : float -> float
Returns the cube root of its argument
val scalbn : float -> int -> float
Returns x * (FLT_RADIX ** n)
val logb : float -> float
Returns the exponent of x, as a signed integer value in float format.
val log2 : float -> float
Returns The log base 2 of its argument.
val log1p : float -> float
Returns The base-e logarithm of 1 plus x.
val ilogb : float -> int
Returns The exponent of x.
val expm1 : float -> float
Returns The base-e exponential of x, minus 1.
val exp2 : float -> float
Returns The base-2 exponential of x.
val atanh : float -> float
Returns The hyperbolic arc cotangent of x.
val asinh : float -> float
Returns The hyperbolic arc sine of x.
val acosh : float -> float
Returns The hyperbolic arc cosine of x.
Once again, if these functions don't exist in the C library, they raise Failure.
val j0 : float -> float
Returns The Bessel function of the first kind of order 0
val j1 : float -> float
Returns The Bessel function of the first kind of order 0
val y0 : float -> float
Returns The Bessel function of the second kind of order 0
val y1 : float -> float
Returns The Bessel function of the second kind of order 1