Function Math Reals Class

ModSym

"Symmetric Modulo" or "Symmetric Modulus" Floating-point symmetric modulus of real numbers.

Signature (Visual Basic / VBA)

Public Function ModSym( _
      ByVal vX As Variant _
    , ByVal vY As Variant _
    ) As Variant

Code Examples

    ModSym(1, 4) = 1
    ModSym(2, 4) = -2
    ModSym(3, 4) = -1
    ModSym(4, 4) = 0
    ModSym(5, 4) = 1
    ModSym(1, -4) = 1
    ModSym(2, -4) = 2
    ModSym(3, -4) = -1
    ModSym(4, -4) = 0
    ModSym(5, -4) = 1
    Y = 6:
     *     *   | *     *
    *     *    |*     *
    -----*-----*-----*-----
        *     *|    *     *
       *     * |   *     *
      *     *  |  *     *
    Y = -6:
      *     *  |  *     *
     *     *   | *     *
    *     *    |*     *
    -----*-----*-----*-----
        *     *|    *     *
       *     * |   *     *
    X - Y * Floor(X / Y + .5)
    X - Y * Int(X / Y + .5)

Parameters

Parameter Description
vX See the Definition. Function returns Null if vX is Null or cannot be fixed up to a number.
vY See the Definition. Function returns Null if vY is Null or cannot be fixed up to a number.