Functions
editIsNan
editFunction IsNan( x:Double )
Description: Check if a value is NAN
Returns: True if x is 'not a number' (e.g.: Sqr(-1))
Example:
Local a:Float = Sqr(-1) Local b:Int = IsNan(a) 'b will equal True in this example, because the square root of -1 is 'not a number'
IsInf
editFunction IsInf( x:Double )
Description: Check if a value is infinite (e.g.: 1.0/0.0)
Returns: True if x is infinite
Example:
Local a:Float = 1.0 / 0.0 Local b:Int = IsInf(a) 'b will equal True in this example, because 1.0 divided by 0.0 is infinite
Sqr
editFunction Sqr:Double( x:Double )
Description: Square root of x
Example:
Local a:Int = 4 Local b:Int = Sqr(a)
Sin
editFunction Sin:Double( x:Double )
Description: Sine of x degrees
Cos
editFunction Cos:Double( x:Double )
Description: Cosine of x degrees
Tan
editFunction Tan:Double( x:Double )
Description: Tangent of x degrees
ASin
editFunction ASin:Double( x:Double )
Description: Inverse Sine of x
Comments: The inverse sine can determine the remaining angles of a right triangle when the lengths of the sides are known. For instance, an angle may be calculated using the length of the opposite side and the hypotenuse.
Example:
Local alpha:Double = ASin(length_opposite / length_hypotenuse)
ACos
editFunction ACos:Double( x:Double )
Description: Inverse Cosine of x
Comments: The inverse cosine can determine the remaining angles of a right triangle when the lengths of the sides are known. For instance, an angle may be calculated using the length of the adjacent side and the hypotenuse.
Example:
Local alpha:Double = ACos(length_adjacent / length_hypotenuse)
ATan
editFunction ATan:Double( x:Double )
Description: Inverse Tangent of x
Comments: The inverse tangent can determine the remaining angles of a right triangle when the lengths of the sides are known. For instance, an angle may be calculated using the length of the opposite side and the adjacent side.
Example:
Local alpha:Double = ATan(length_opposite / length_adjacent)
ATan2
editFunction ATan2:Double( y:Double,x:Double )
Description: Inverse Tangent of two variables x , y
Comments: ATan2 is similar to ATan. However, it makes use of the two arguments signs to determine the angle of a imaginary vector (x,y) relatively to the x-axis (counterclockwise). This is very useful, for example in determining the direction from one point to another.
Example:
Local ax:Float = -1, ay:Float =- 2 'Point A Local bx:Float = 3, by:Float = 2 'Point B 'Notice how the variables we are using are Float's, BlitzMax will automatically 'convert them into Double's when we call ATan2() Local angle:Float = ATan2(by - ay, bx - ax) 'Angle from A to B
Sinh
editFunction Sinh:Double( x:Double )
Description: Hyperbolic sine of x
Cosh
editFunction Cosh:Double( x:Double )
Description: Hyperbolic cosine of x
Tanh
editFunction Tanh:Double( x:Double )
Description: Hyperbolic tangent of x
Exp
editFunction Exp:Double( x:Double )
Description: Exponential function
Log
editFunction Log:Double( x:Double )
Description: Natural logarithm
Log10
editFunction Log10:Double( x:Double )
Description: Base 10 logarithm
Ceil
editFunction Ceil:Double( x:Double )
Description: Smallest integral value not less than x
Floor
editFunction Floor:Double( x:Double )
Description: Largest integral value not greater than x
Comments: Ceil() will round a variable up, whereas Floor() will round it down.
Example:
Local a:Float = 3.5 Local round_up:Float = Ceil(a) 'Becomes 4.0 Local round_down:Float = Floor(a) 'Becomes 3.0