From NSB App Studio
Jump to navigation Jump to search

This function is for BASIC compatibility. It is not available in pure JavaScript projects.



Fix removes the fractional part from a number, returning the integer closest to 0. The required parameter, number, is any numeric expression. When number is positive, the next smallest integer is returned; when number is negative, the next largest integer is returned. The required parameter, number, is any valid numeric expression.

Example (Basic)

Rem Fix Example
'Fix converts floats to int nearest 0
Dim Pos, Neg
Pos = Exp(1)
Neg = -Exp(1)
Print "Fix(e) = " & Fix(Pos)
Print "Fix(-e) = " & Fix(Neg)


Fix(e) = 2
Fix(-e) = -2

Related Items