Accelerating the pace of engineering and science

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

expand all

Convert Decimal to Thirty-Second Quotation

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 =

101
102

Fractions =

25
31

```