Public Function FloatToFraction( _ ByVal vX As Variant _ , ByVal vPrecision As Variant _ ) As Variant
FloatToFraction(23.45678, 64) = "23 29/64" FloatToFraction(23.45678, 10) = "23 1/2" FloatToFraction(23.45678, 1E10) = "23 22839/50000" FloatToFraction(23.45678, 1) = "23" ' #4See also:
RationalToFractionString Function GreatestCommonDivisor FunctionvX: The floating-point number that is to be converted to a fractional number and returned in string form. Function returns Null if vX is Null or cannot be fixed up to a number.
vPrecision: The precision used when rounding vX. Function returns Null if vPrecision is Null or cannot be fixed up to a number. With a precision of 1 (one), function rounds all numbers to integers and returns them as strings as in example #4.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.