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

Next Number Function
Math Arithmetic Class

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

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

Examples:
    NextNumber(0, 2, 1) = 1
    NextNumber(1, 2, 1) = 3
    NextNumber(2, 2, 1) = 3
    NextNumber(22.4, 2, 1) = 23
    NextNumber(-1.7) = -1
    NextNumber(-6.5) = -6
    NextNumber(-7.8) = -7
See also:
    NextNumberSample Subroutine
    PreviousNumber Function
    NextEven Function
    NextOdd Function
vX: Number which is rounded-up to the next number. Function returns Null if vX is Null or cannot be fixed up to a number.
Note: Similar to calling the Ceiling function except that if vX is already at the ceiling, this function returns the next ceiling.

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 next even number. With a precision of 2 and an offset of 1, function returns the next odd number.

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