IMSL Mathematics Reference Guide > Special Functions > DOLLAR_DECIMAL Function (PV-WAVE Advantage)
  

DOLLAR_DECIMAL Function (PV-WAVE Advantage)
Converts a fractional price to a decimal price.
Usage
result = DOLLAR_DECIMAL (fractional_num, fraction)
Input Parameters
fractional_num—Whole number of dollars plus the numerator, as the fractional part.
fraction—Denominator of the fractional dollar. fraction must be positive.
Returned Value
result—The dollar price expressed as a decimal number. The dollar price is the whole number part of fractional-dollar plus its decimal part divided by fraction. If no result can be computed, NaN is returned.
Input Keywords
Double—If present and nonzero, double precision is used.
Discussion
Function DOLLAR_DECIMAL converts a dollar price, expressed as a fraction, into a dollar price, expressed as a decimal number.
It is computed using the following:
where idollar is the integer part of fractional_num, and ifrac is the integer part of log(fraction).
Example
In this example, DOLLAR_DECIMAL converts $1 1/4 to $1.25.
PRINT, DOLLAR_DECIMAL(1.1, 4)
; PV-WAVE prints: 1.25000

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.