Floor: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
No edit summary
imported>StDoodle
No edit summary
Line 1: Line 1:
'''[[int]] floor( [[float]] )'''
{{
#vardefine:name|floor}}{{
#vardefine:return_type|int}}{{


Rounds a [[float]] variable down to the closest [[int]]eger beneath it.
FunctionPage|
name={{#var:name}}|
function_category=|


<p>For example:<pre>int purse_rat_ML = floor( familiar_weight($familiar[109])/2 );
function1={{Function|
print( "Your squeaky little buddy is currently generating "+purse_rat_ML+" ML in aggression from monsters!" );</pre></p>
name={{#var:name}}|
{{Format}}
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
parameter1={{Param|float|number}}|
p1desc={{Pspan|number}} is the number to find the floor of|
}}|
 
function_description=This is the floor function, which returns the largest integer less than or equal to the supplied {{pspan|number}}.|
 
code1={{CodeSample|
title=Code Sample|
desc=Prints the amount of "help" you're getting from your purse rat.|
code=
<syntaxhighlight>
int purse_rat_ML = floor( familiar_weight($familiar[ purse rat ])/2 )
print( "Your squeaky little buddy is currently generating " + purse_rat_ML + " extra ML!" );
</syntaxhighlight>}}|
 
see_also={{SeeAlso|ceil}}|
}}

Revision as of 22:12, 10 March 2010

Function Syntax

int floor(float number )

  • number is the number to find the floor of

This is the floor function, which returns the largest integer less than or equal to the supplied number.

Code Sample

int purse_rat_ML = floor( familiar_weight($familiar[ purse rat ])/2 )
print( "Your squeaky little buddy is currently generating " + purse_rat_ML + " extra ML!" );

See Also

ceil()