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

Mod Std Function
Math Reals Class

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

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

Plot:
    Y = 4 or Y = -4:
               |  *   *   *
               | *   *   *
               |*   *   *
    ---*---*---*---*---*---
      *   *   *|
     *   *   * |
    *   *   *  |

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

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.

Definition:

    X - Y * Fix(X / Y)

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