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

Previous Even Function
Math Arithmetic Class

Public Function PreviousEven( _
    ByVal vX As Variant _
    ) As Variant

"Previous Even Number"
Returns the next smaller even number.

    PreviousEven(1) = 0
    PreviousEven(2) = 0
    PreviousEven(3) = 2
    PreviousEven(22.4) = 22
    PreviousEven(-1.7) = -2
    PreviousEven(-6.5) = -8
    PreviousEven(-7.8) = -8
See also:
    PreviousEvenSample Subroutine
    PreviousOdd Function
    PreviousNumber Function
    NextEven Function
vX: Number which is rounded-down to the previous even number (i.e. 2, 4, 6, -2, -4, -6, etc.). Function returns Null if vX is Null or cannot be fixed up to a number.
Note: Similar to calling the Floor function with a precision of 2 (two), except that if vX is already an even number, this function returns the previous even number.
Note: Zero is considered an even number, as are all negative numbers divisible by two.

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