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

Previous Number Function
Math Arithmetic Class

Public Function PreviousNumber( _
      ByVal vX As Variant _
    , Optional ByVal vPrecision As Variant _
    , Optional ByVal vOffset As Variant _
    ) As Variant

Rounds vX down to the next smallest number that is a multiple of vPrecision.
vOffset is the start of the sequence of numbers and vPrecision is the step.

Examples:
    PreviousNumber(0, 2, 1) = -1
    PreviousNumber(1, 2, 1) = -1
    PreviousNumber(2, 2, 1) = 1
    PreviousNumber(22.4, 2, 1) = 21
    PreviousNumber(-1.7) = -3
    PreviousNumber(-6.5) = -7
    PreviousNumber(-7.8) = -8
See also:
    PreviousNumberSample Subroutine
    NextNumber Function
    PreviousEven Function
    PreviousOdd Function
vX: Number which is rounded down to the next number. Function returns Null if vX is Null or cannot be fixed up to a number.
Note: Similar to calling the Floor function except that if vX is already at the floor, this function returns the previous floor.

vPrecision: The precision used when rounding vNumber. vPrecision defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number. With a precision of 1 (one), function returns the smallest integer greater than vNumber.

vOffset: The starting number in the sequence to which vX is rounded up. vOffset defaults to 0 (zero) if it is missing or Null or cannot be fixed up to a number. With a precision of 2 and an offset of 0, function returns the previous even number. With a precision of 2 and an offset of 1, function returns the previous odd number.

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