math.eh

Math functions. More...

use "math.eh"

Constants

const FNaN = 0f/0f
const FNEG_INFTY = -1f/0f
const FPOS_INFTY = 1f/0f
const NaN = 0d/0d
const NEG_INFTY = -1d/0d
const PI = 3.141592653589793
const POS_INFTY = 1d/0d

Functions

def abs(val: Double): Double;
def acos(val: Double): Double;
def asin(val: Double): Double;
def atan(val: Double): Double;
def cos(val: Double): Double;
def d2lbits(d: Double): Long;
def deg2rad(val: Double): Double;
def exp(val: Double): Double;
def f2ibits(f: Float): Int;
def ibits2f(bits: Int): Float;
def ipow(val: Double, pow: Int): Double;
def lbits2d(bits: Long): Double;
def log(val: Double): Double;
def rad2deg(val: Double): Double;
def sgn(val: Double): Int;
def sin(val: Double): Double;
def sqrt(val: Double): Double;
def tan(val: Double): Double;

Description

Common mathematical and trigonometric functions and constants.

Constant details

const PI = 3.141592653589793
Value of π, the ratio of the circumference of a circle to its diameter.

const POS_INFTY = 1d/0d
Special Double value "positive infinity".

const NEG_INFTY = -1d/0d
Special Double value "negative infinity".

const NaN = 0d/0d
Special Double value "not a number".

const FPOS_INFTY = 1f/0f
Special Float value "positive infinity".

const FNEG_INFTY = -1f/0f
Special Float value "negative infinity".

const FNaN = 0f/0f
Special Float value "not a number".

Function details

def abs(val: Double): Double;
Returns the absolute value of an argument.

def sgn(val: Double): Int;
Returns the sign of an argument. Returns 0 if value is zero, -1 if value less then zero and +1 if value is greater then zero.

def deg2rad(val: Double): Double;
Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

def rad2deg(val: Double): Double;
Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

def sin(val: Double): Double;
Returns the trigonometric sine of an angle.

def cos(val: Double): Double;
Returns the trigonometric cosine of an angle.

def tan(val: Double): Double;
Returns the trigonometric tangent of an angle.

def sqrt(val: Double): Double;
Returns the square root of an argument.

def ipow(val: Double, pow: Int): Double;
Returns an, the value of the first argument raised to the power of the second argument.

def exp(val: Double): Double;
Returns Euler's number e raised to the power of an argument.

def log(val: Double): Double;
Returns the natural logarithm of an argument.

def asin(val: Double): Double;
Returns the arc sine of a value. The returned angle is in the range [-PI/2, PI/2].

def acos(val: Double): Double;
Returns the arc cosine of a value. The returned angle is in the range [0, PI].

def atan(val: Double): Double;
Returns the arc tangent of a value. The returned angle is in the range [-PI/2, PI/2].

def ibits2f(bits: Int): Float;
Decodes Float value from the given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "single format" bit layout.

def f2ibits(f: Float): Int;
Encodes Float value to the bit representation according to the IEEE 754 floating-point "single format" bit layout.

def lbits2d(bits: Long): Double;
Decodes Double value from the given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double format" bit layout.

def d2lbits(d: Double): Long;
Encodes Double value to the bit representation according to the IEEE 754 floating-point "double format" bit layout.