Fmod

Revision as of 12:13, 9 September 2007 by imported>WereWolf (Added function)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Syntax:

(fmod:float) fmod dividend:float base:float offset:float

Returns the floating point modulus of dividend in the given base.

NotesEdit

  • This differs from dividend % base in the scripting language as % is a strictly integer function. When base is positive, 0 <= result < base. The optional offset shifts the range of the result to offset <= result < base+offset.
  • The two most likely uses of this function are modulus angle 360 to normalize a computed angle, i.e., ensure it is >= 0< 360.0 and , and modulus angle 360 -180 which ensures the computed [change of] angle is >= -180.0 and < 180.0. modulus n base is defined as n - base * Floor n / base. If the base is negative the direction of the inequality changes. Thus: 0 >= result > base and offset >= result > base+offset.

See AlsoEdit