Files
BlitzNext/_release/help/commands/2d_commands/Floor.htm
T

91 lines
2.0 KiB
HTML
Raw Normal View History

2014-12-08 12:43:20 +13:00
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Floor# ( y# )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
y = any number
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Rounds downward, i.e. in the direction of -Infinity.
<br />
<br />
It is a common mistake to think this simply sets everything after the decimal point to zero.
<br />
But this is true only for positive numbers:
<br />
<br />
Floor( 1.75 ) ....... 1.0
<br />
Floor( -1.75 ) .... -2.0
<br />
<br />
See also Ceil and Int for other types of rounding.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Floor.bb>Example</a></h1>
<table>
<tr>
<td>
; Ceil / Floor / Int example, three kinds of rounding.
<br />
<br />
; Move mouse. Escape quits.
<br />
<br />
Graphics 640, 480
<br />
<br />
Const KEY_ESC = 1
<br />
<br />
SetBuffer BackBuffer()
<br />
Origin 320, 240
<br />
<br />
MoveMouse 320, 240 : HidePointer
<br />
<br />
While Not KeyDown( KEY_ESC )
<br />
<br />
Cls
<br />
<br />
my = MouseY() - 240
<br />
Color 100, 100, 0
2014-02-26 16:08:39 +13:00
<br />
2014-12-08 12:43:20 +13:00
Line -320, my, 319, my
2014-02-26 16:08:39 +13:00
<br />
2014-12-08 12:43:20 +13:00
2014-02-26 16:08:39 +13:00
<br />