Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Rebol Programming/modulo

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

USAGE: MODULO a b DESCRIPTION: Wrapper for MOD that handles errors like REMAINDER. Negligible values (compared to A and B) are rounded to zero. MODULO is a function value. ARGUMENTS: a -- (Type: number money time) b -- Absolute value will be used (Type: number money time) (SPECIAL ATTRIBUTES) catch SOURCE CODE modulo: func [ {Wrapper for MOD that handles errors like REMAINDER. Negligible ^-^-values (compared to A and B) are rounded to zero.} [catch] a [number! money! time!] b [number! money! time!] "Absolute value will be used" /local r ][ throw-on-error [ any [number? a b: make a b] r: mod a abs b either any [a - r = a r + b = b] [make r 0] [r] ] ]