Int: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Add javascript snippet |
||
Line 5: | Line 5: | ||
Int removes the fractional part of a number, returning the next smallest integer. The required parameter, ''number'', is any valid numeric expression. | Int removes the fractional part of a number, returning the next smallest integer. The required parameter, ''number'', is any valid numeric expression. | ||
== Example== | == Example (Basic) == | ||
<pre> | <pre> | ||
Line 15: | Line 15: | ||
Print "Int(pi) = " & Int(Pos) | Print "Int(pi) = " & Int(Pos) | ||
Print "Int(-pi) = " & Int(Neg) | Print "Int(-pi) = " & Int(Neg) | ||
</pre> | |||
== Example (JavaScript) == | |||
<pre> | |||
// Int Example | |||
/* Int converts floats to the next smallestint */ | |||
var Pos, Neg; | |||
Pos = Math.atan(1) * 4; | |||
Neg = -Pos; | |||
NSB.Print("parseInt(pi) = " + Math.floor(Pos)); | |||
NSB.Print("parseInt(-pi) = " + Math.floor(Neg)); | |||
</pre> | </pre> | ||
Revision as of 20:48, 19 May 2013
Int(number)
Description
Int removes the fractional part of a number, returning the next smallest integer. The required parameter, number, is any valid numeric expression.
Example (Basic)
Rem Int Example 'Int converts floats to the next smallestint Dim Pos, Neg Pos = Atn(1) * 4 Neg = -Pos Print "Int(pi) = " & Int(Pos) Print "Int(-pi) = " & Int(Neg)
Example (JavaScript)
// Int Example /* Int converts floats to the next smallestint */ var Pos, Neg; Pos = Math.atan(1) * 4; Neg = -Pos; NSB.Print("parseInt(pi) = " + Math.floor(Pos)); NSB.Print("parseInt(-pi) = " + Math.floor(Neg));
Output
Int(pi) = 3 Int(-pi) = -4