Skip to content
angerangel edited this page Mar 19, 2013 · 1 revision

USAGE

   ROUND value /to scale /even /down /half-down /floor /ceiling /half-ceiling

DESCRIPTION

Rounds a numeric value; halves round up (away from zero) by default.

ROUND is an action value.

ARGUMENTS

  • value -- The value to round (number! pair! money! time!)

REFINEMENTS

  • /to -- Return the nearest multiple of the scale parameter
    • scale -- Must be a non-zero value (number! money! time!)
  • /even -- Halves round toward even results
  • /down -- Round toward zero, ignoring discarded digits. (truncate)
  • /half-down -- Halves round toward zero
  • /floor -- Round in negative direction
  • /ceiling -- Round in positive direction
  • /half-ceiling -- Halves round in positive direction

#SOURCE

round: make action! [  [
    {Rounds a numeric value; halves round up (away from zero) by default.}
    value [number! pair! money! time!] "The value to round"
    /to "Return the nearest multiple of the scale parameter"
    scale [number! money! time!] "Must be a non-zero value"
    /even "Halves round toward even results"
    /down {Round toward zero, ignoring discarded digits. (truncate)}
    /half-down "Halves round toward zero"
    /floor "Round in negative direction"
    /ceiling "Round in positive direction"
    /half-ceiling "Halves round in positive direction"
] ]
Clone this wiki locally