Decimal to thirty-second quotation
[OutNumber,Fractions] = dec2thirtytwo(InNumber,Accuracy)
This example shows two bonds that are quoted with decimal prices of 101.78 and 102.96. These prices are converted to fractions with a denominator of 32.
InNumber = [101.78; 102.96]; [OutNumber, Fractions] = dec2thirtytwo(InNumber)
OutNumber = 2×1 101 102
Fractions = 2×1 25 31
InNumber— Input number
Input number, specified as an
of numeric decimal fractions.
1(round down to nearest thirty second) (default) | numeric with values
Rounding, specified as an
1 vector of accuracy
desired with numeric values of
10. The values are:
1, round down to nearest thirty second,
2 (nearest half),
10 (nearest decile).
OutNumber— Output number which is
InNumberrounded downward to closest integer
Output number which is
InNumber rounded downward
to closest integer, returned as a numeric value.
Fractions— Fractional part in units of thirty-second
Fractional part in units of thirty-second, returned as a numeric
Fractions output conforms to accuracy
as prescribed by the input