devxlogo

May 27, 2000

Factorial – The factorial of a number

‘ The factorial of a number” if NUMBER is negative or >170 it raises an’ “subscript out of range” errorFunction Factorial(ByVal number As Long) As Double Static result(170) As Double

Rnd2 – A random value in a range

‘ A random number in the range (low, high)Function Rnd2(low As Single, high As Single) As Single Rnd2 = Rnd * (high – low) + lowEnd Function

Fract – The fractional portion of a number

‘ The fractional part of a floating-point number’ note that negative numbers return negative valuesFunction Fract(number As Variant) As Variant Fract = number – Fix(number)End Function

Log10 – Base-10 logarithm

‘ Base 10 logarithmFunction Log10(number As Double) As Double Log10 = Log(number) / 2.30258509299405End Function