dec2thirtytwo - Decimal to thirty-second quotation

Syntax

[OutNumber, Fractions] = dec2thirtytwo(InNumber, Accuracy)

Arguments

InNumber

Input number as a decimal fraction.

Accuracy

(Optional) Rounding. Default = 1, round down to nearest thirty second. Other values are 2 (nearest half), 4 (nearest quarter) and 10 (nearest decile).

Description

[OutNumber, Fractions] = dec2thirtytwo(InNumber, Accuracy) changes a decimal price quotation for a bond or bond future to a fraction with a denominator of 32.

OutNumber is InNumber rounded downward to the closest integer.

Fractions is the fractional part in units of thirty-second with accuracy as prescribed by the input Accuracy.

Examples

Two bonds are quoted with decimal prices of 101.78 and 102.96. Convert these prices to fractions with a denominator of 32.

InNumber  = [101.78; 102.96];

[OutNumber, Fractions] = dec2thirtytwo(InNumber)

OutNumber =

   101
   102

Fractions =

    25
    31

See Also

thirtytwo2dec

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS