# todecimal

Fractional to decimal conversion

## Syntax

``usddec = todecimal(quote)``
``usddec = todecimal(___,fracpart)``

## Description

example

````usddec = todecimal(quote)` returns the decimal equivalent, `usddec`, of a security whose price is normally quoted as a whole number and a fraction (`quote`). ```

example

````usddec = todecimal(___,fracpart)` returns the decimal equivalent, `usddec`, of a security whose price is normally quoted as a whole number and a fraction (`quote`). `fracpart` indicates the fractional base (denominator) with which the security is normally quoted (default = `32`).```

## Examples

collapse all

Often secuirty prices are quoted in fractional form based on a denominator of 32. For example, if you see the quoted price is 100:05 it means 100 5/32. To find the equivalent decimal value, enter:

`usddec = todecimal(100.05)`
```usddec = 100.1562 ```

You can change the defualt denominator of 32 by using the `fracpart` optional argument with a value of `16`.

`usddec = todecimal(97.04, 16)`
```usddec = 97.2500 ```

## Input Arguments

collapse all

Quoted security price, specified as a scalar numeric or an `NPORTS`-by-`1` vector.

Note

The convention of using `.` (period) as a substitute for `:` (colon) in the input is adopted from Excel® software.

Data Types: `double`

(Optional) Fractional base (denominator) with which the security is normally quoted, specified as a scalar numeric.

Data Types: `double`

## Output Arguments

collapse all

Fractional to decimal conversion, returned as a numeric decimal.

## Version History

Introduced before R2006a