Math

Module NameMath
Import NameMath

This module provides floating point math routines.

Abs

Function Abs(value As Single) As Single

Calculates the absolute value of a given number.

Trunc

 Function Trunc(value As Single) As Single

Truncates a given number. For example:

 trunc(2.7) = 2
 trunc(2) = 2
 trunc(-2.7) = -2 

Round

 Function Round(value As Single) As Single

Rounds up a given number. For example:

 round(2.7) = 3
 round(2) = 2
 round(-2.7) = -3

Ldexp

 Function Ldexp(x As Single, n as byte) As Single

Load exponent Function

Exp

 Function Exp(x As Single) As Single

Return the exponential Function of a value

Frexp

 Function Frexp(x As Single, ByRef exponent as sbyte) As Single

Splits a number into mantissa and exponent. Calculates the mantissa m (a float greater than or equal to 0.5 and less than 1) and the integer value n such that x equals m * 2n.

Log

 Function Log(x As Single) As Single

Computes the NATURAL log of a number

Sin

 Function Sin(x As Single) As Single

Returns the sine of a value

Cos

 Function Cos(x As Single) As Single

Returns the cosine of a value

Asin

 Function Asin(x As Single) As Single

Returns the arc sine of a value

Acos

 Function Acos(x As Single) As Single

Returns the arc cosine of a value

Atan

 Function Atan(x As Single) As Single

Returns the arc tangent of a value

Atan2

 Function Atan2(y As Single, x As Single) As Single

Computes the inverse tangent

Ceiling

 Function Ceiling(value As Single) As Single

Rounds a value up toward positive infinity NOT the same as round(x). For example:

 ceil(2.3) = 3
 ceil(2) = 2
 ceil(-2.3) = -2                

Floor

 Function Floor(value As Single) As Single

Rounds a value towards negative infinity NOT the same as trunc(x). For example:

 floor(2.9) = 2
 floor(-2) = -2
 floor(-2.3) = -3   

Fmod

 Function Fmod(x As Single,y As Single) As Single

Computes the floating point remainder of x/y

Modf

 Function Modf(x As Single, ByRef integral As Single) As Single

Breaks the float x into two parts: the integer and the fraction modf stores the integer in

ipart and returns the fraction. Returns the fractional and integral part of a value

Sqrt

 Function Sqrt(value As Single) As Single

returns the square root of a value

Tan

 Function Tan(x As Single) As Single

Return the tangent of a value

Log10

 Function Log10(x As Single) As Single

Returns the log base 10 of a value

Pow

 Function Pow(base As Single, expression As Single) As Single

Returns base to the nth power (expression)

Cosh

 Function Cosh(x As Single) As Single

Returns the hyperbolic cosine value of x

Sinh

 Function Sinh(x As Single) As Single

Returns the hyperbolic sine value of x

Tanh

 Function Tanh(x As Single) As Single

Returns the hyperbolic tangent value of x

Radians

 Function Radians(x As Single) As Single

Converts degrees into radians

LastError

 Function LastError() As Byte

Returns the last error. Can be ErrorOK, ErrorDomain or ErrorRange.