Decimal to fractional conversion
returns the fractional equivalent,
quote = toquoted(
the decimal figure,
usddec, based on the
fractional base (denominator),
fractional bases are the ones used for quoting equity prices in the
United States (denominator 2, 4, 8, 16, or 32). If
fracpart is not entered, the
denominator 32 is assumed.
Convert Decimal to Fraction
A United States equity price in decimal form is 101.625. To convert this to fractional form in eighths of a dollar:
quote = toquoted(101.625, 8)
quote = 101.0500
The answer is interpreted as 101 5/8.
The convention of using . (period) as a substitute for : (colon) in the output is adopted from Excel ® software.
usddec — Equity price
Equity price, specified as a numeric decimal.
fracpart — Fractional bases used for quoting equity prices in the United States
32 (default) | numeric with denominator value of
Fractional bases used for quoting equity prices in the United States, specified as a scalar numeric.
quote — Fractional equivalent
Fractional equivalent, returned as a numeric. For
example, bond prices are quoted in fractional form
based on a 32nd. If you see the quoted price is
100:05, it means 100 5/32 which
is equivalent to 100.15625.
Introduced before R2006a