This concept’s semantic web URI is: [ http://sw.opencyc.org/2008/06/10/concept/en/ModuloFn ]

Modulo Fn

Unique Tag: [ ModuloFn ]

A binary function that takes a scalar and a comparable (non-null) point-value scalar to another comparable scalar, Modulo Fn is a generalization of a basic notion of modular arithmetic, broadened to apply to ScalarIntervals of all sorts.

(Modulo Fn SCALAR BASE) is the value of SCALAR modulo BASE, determined as follows. (i) If SCALAR and BASE are both positive or both negative values, SCALAR-MOD-BASE is the remainder left when BASE is successively subtracted from SCALAR (zero or more times) until the result is a value that is closer to the comparable null-value (see scalar null value) than BASE is. (ii) If SCALAR and BASE differ in their numeric signs, SCALAR-MOD-BASE is the remainder left when BASE is successively added to SCALAR (zero or more times) until the result is a value whose numeric sign agrees with that of BASE or is null, and which is closer to the comparable null-value than BASE is. (iii) If SCALAR is already a null-value, SCALAR-MOD-BASE is just SCALAR itself.

For example, (Modulo Fn 8 3) = 2, (Modulo Fn (meter 9) (meter -4)) = (meter -3), and (Modulo Fn (inch -12) (inch -4)) = (inch 0).

Note that in case (i) above, if the absolute value of SCALAR is any value Less Than the absolute value of BASE, SCALAR-MOD-BASE is equal to SCALAR. In all cases, if SCALAR Numerically Equals BASE, SCALAR-MOD-BASE is the comparable null-value. In all cases, the numeric sign of the returned value SCALAR-MOD-BASE agrees with that of BASE (unless the returned value is null). Also note that (Modulo Fn SCALAR BASE) is Undefined if SCALAR and BASE are not Numerically Comparable (q.v.), or if BASE is null.

In practice, BASE will usually be a positive integral value, and both SCALAR and the returned value will often be integral as well (see scalar integral value). Note that if SCALAR and BASE are given in different (but comparable) UnitOfMeasures (e.g. meter and (Centi meter)), the result returned by Cyc will be given in the same units as BASE.

 Click Here to Add a Comment