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

Mod Offset By One Function
Math Reals Class

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

"Modulus Offset By One"
Floating-point modulus of real numbers, offset by 1 (one).

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

Examples:
    ModOffsetByOne(-4, 3) = -1
    ModOffsetByOne(-3, 3) = -3
    ModOffsetByOne(-2, 3) = -2
    ModOffsetByOne(-1, 3) = -1
    ModOffsetByOne(0, 3) = 3
    ModOffsetByOne(1, 3) = 1
    ModOffsetByOne(2, 3) = 2
    ModOffsetByOne(3, 3) = 3
    ModOffsetByOne(4, 3) = 1
See also:
    ModOffsetByOneVerify Subroutine
    ModStd Function
    DivideOffsetByOne Function
    Sgn Function (Visual Basic)
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:

    If X == 0: X
    If X <> 0: ModStd(X - Sgn(X), Y) + Sgn(X)

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