Fix: Difference between revisions
Jump to navigation
Jump to search
Created page with "FIX(''number'') '''Description''' FIX removes the fractional part from a number, returning the integer closest to 0. The required parameter, ''number'', is any numeric expre..." |
No edit summary |
||
Line 1: | Line 1: | ||
Fix(''number'') | |||
== Description == | |||
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 == | |||
<pre> | <pre> | ||
Rem Fix Example | |||
' | 'Fix converts floats to int nearest 0 | ||
Dim Pos, Neg | |||
Pos = | Pos = Exp(1) | ||
Neg = - | Neg = -Exp(1) | ||
Print "Fix(e) = " & Fix(Pos) | |||
Print "Fix(-e) = " & Fix(Neg) | |||
</pre> | </pre> | ||
== Output == | |||
<pre> | <pre> | ||
Fix(e) = 2 | |||
Fix(-e) = -2 | |||
</pre> | </pre> | ||
== Related Items == | |||
[[int|INT]] | [[int|INT]] | ||
[[Category:Language Reference]] |
Revision as of 01:06, 17 August 2012
Fix(number)
Description
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
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)
Output
Fix(e) = 2 Fix(-e) = -2