$int: Difference between revisions

From Scriptwiki
Jump to navigation Jump to search
m Added example to return remainder
m fixed commenting
Line 7: Line 7:
== Examples ==
== Examples ==


  $int([[$pi]]) - will return ''3''
  $int([[$pi]]) ;will return ''3''
  $int(9312412.3213) - will return ''9312412''
  $int(9312412.3213) ;will return ''9312412''


  [[var]] %i = 2.5
  [[var]] %i = 2.5
  [[$calc]](%i - %int(%i)) - will return ''0.5''
  [[$calc]](%i - %int(%i)) ;will return ''0.5''
The above example shows how to return the remainder from a decimal number.
The above example shows how to return the remainder from a decimal number.
== See also ==
== See also ==

Revision as of 13:08, 10 November 2005

Returns the specified integer number without rounding.

$int(N)
  • N is the number with decimals you want to handle.

Examples

$int($pi)  ;will return 3
$int(9312412.3213)  ;will return 9312412
var %i = 2.5
$calc(%i - %int(%i))  ;will return 0.5

The above example shows how to return the remainder from a decimal number.

See also

$round, $ceil and $floor.