Int: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
Created page with "INT(''number'') '''Description''' INT removes the fractional part of a number, returning the next smallest integer. The required parameter, ''number'', is any valid numeric ..."
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
INT(''number'')
''This function is for BASIC compatibility. It is not available in pure JavaScript projects.''  


'''Description'''
Int(''number'')


INT removes the fractional part of a number, returning the next smallest integer. The required parameter, ''number'', is any valid numeric expression.
== Description ==


'''Example'''
Int removes the fractional part of a number, returning the next smallest integer. The required parameter, ''number'', is any valid numeric expression.
 
== Example (Basic) ==


<pre>
<pre>
REM INT Example
Rem Int Example
'INT converts floats to the next smallestint
'Int converts floats to the next smallest integer
DIM Pos, Neg
Dim Pos, Neg
Pos = ATN(1) * 4
Pos = Atn(1) * 4
Neg = -Pos
Neg = -Pos
PRINT "INT(pi) = " & INT(Pos)
Print "Int(pi) = " & Int(Pos)
PRINT "INT(-pi) = " & INT(Neg)
Print "Int(-pi) = " & Int(Neg)
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
INT(pi) = 3
Int(pi) = 3
INT(-pi) = -4
Int(-pi) = -4
</pre>
</pre>


'''Related Items'''
== Related Items ==
 
[[fix|Fix]]
 
[[Category:Language Reference]]
 
[[Category:Math]]


[[fix|FIX]]
[[Category:BASIC Functions]]

Latest revision as of 15:27, 25 March 2019

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

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 smallest integer
Dim Pos, Neg
Pos = Atn(1) * 4
Neg = -Pos
Print "Int(pi) = " & Int(Pos)
Print "Int(-pi) = " & Int(Neg)

Output

Int(pi) = 3
Int(-pi) = -4

Related Items

Fix