<-- Previous || Up || Next -->

Mod Alt Function
Math Reals Class

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

"Modulo (Alternate Definition)" or "Modulus" or "Remainder"
Floating-point modulus of real numbers.

Plots:
    Y = 4:
      *   *   *|  *   *   *
     *   *   * | *   *   *
    *   *   *  |*   *   *
    ---*---*---*---*---*---
               |
    Y = -4:
               |
               |
               |
    ---*---*---*---*---*---
      *   *   *|  *   *   *
     *   *   * | *   *   *
    *   *   *  |*   *   *

Examples:
    ModAlt(0, 3) = 0
    ModAlt(1, 3) = 1
    ModAlt(2, 3) = 2
    ModAlt(3, 3) = 0
    ModAlt(4, 3) = 1
    ModAlt(-1, 3) = 2
    ModAlt(-2, 3) = 1
    ModAlt(-2, -3) = -2
    ModAlt(2, -3) = -1
See also:
    ModAltVerify Subroutine
    ModSym Function
    ModStd Function
    Floor Function
    Mod Operator (Visual Basic)
    Int Function (Visual Basic)
Note: Differs from the ModStd function when X is negative and Y is positive. We believe that this definition of the modulo function is much more widely accepted than the other definition (which is similar to the one that Microsoft implements in all of their language products).

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.

Definitions:

    X - Y * Int(X / Y)
    X - Y * Floor(X / Y)

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.