DOLLAR_FRACTION Function (PV-WAVE Advantage)
Converts a decimal price to a fractional price.
Usage
result = DOLLAR_FRACTION(decimal_dollar, fraction)
Input Parameters
decimal_dollar—Dollar price expressed as a decimal number.
fraction—Denominator of the fractional dollar. fraction must be positive.
Returned Value
result—Dollar price expressed as a fraction. The numerator is the decimal part of the returned value. If no result can be computed, NaN is returned.
Input Keywords
Double—If present and nonzero, double precision is used.
Discussion
Function DOLLAR_FRACTION converts a dollar price, expressed as a decimal number, into a dollar price, expressed as a fractional price. If no result can be computed, NaN is returned.
It can be found by solving the following:
where idollar is the integer part of the decimal_dollar, and ifrac is the integer part of log(fraction).
Example
In this example, DOLLAR_FRACTION converts $1.25 to $1 1/4.
PRINT, DOLLAR_FRACTION(1.25, 4)
; PV-WAVE prints: 1.10000
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.