- Function PriceFractional(DecimalPrice, FractionBase)
PriceFractional
The function PriceFractional converts a price expressed as a decimal
number to a price expressed as a fractional number depending on the
input parameter FractionBase.
PriceFractional(
DecimalPrice, ! (input) numerical expression
FractionBase ! (input) numerical expression
)
Arguments
- DecimalPrice
The price expressed as a decimal number. DecimalPrice can be any real number.
- FractionBase
The base to be used as the denominator of the fraction. FractionBase must be a positive integer.
Return Value
The function
PriceFractionalreturns the DecimalPrice expressed as a fractional number.
Note
The system of equations on which the conversion between decimal and fractional prices is based, is explained for the function
PriceDecimal(the inverse ofPriceFractional).The function
FractionalDecimalis similar to the Excel functionDOLLARFR.
Example
_p_r1 := PriceFractional( 1.125000, 16 );
_p_r2 := PriceFractional( 1.312500, 32 );
block where listing_number_precision := 6 ;
display _p_r1, _p_r2 ;
endblock ;
results in:
_p_r1 := 1.020000 ;
_p_r2 := 1.100000 ;
See also
The function
PriceDecimal.