Documentation

This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

storedInteger

Stored integer value of `fi` object

Syntax

`st_int = storedInteger(f)`

Description

`st_int = storedInteger(f)` returns the stored integer value of fi object `f`.

Fixed-point numbers can be represented as

`$real\text{-}worldvalue={2}^{-fractionlength}×storedinteger$`

or, equivalently as

`$real\text{-}worldvalue=\left(slope×storedinteger\right)+bias$`

The stored integer is the raw binary number, in which the binary point is assumed to be at the far right of the word.

Input Arguments

collapse all

Fixed-point numeric object from which you want to get the stored integer value.

Output Arguments

collapse all

Data Types: `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64`

The returned stored integer value is the smallest built-in integer data type in which the stored integer value `f` fits. Signed `fi` values return stored integers of type `int8`, `int16`, `int32`, or `int64`. Unsigned `fi` values return stored integers of type `uint8`, `uint16`, `uint32`, or `uint64`. The return type is determined based on the stored integer word length (WL):

• WL ≤ 8 bits, the return type is `int8` or `uint8`.

• 8 bits < WL ≤ 16 bits, the return type is `int16` or `uint16`.

• 16 bits < WL ≤ 32 bits, the return type is `int32` or `uint32`.

• 32 bits < WL ≤ 64 bits, the return type is `int64` or `uint64`.

 Note   When the word length is greater than 64 bits, the `storedInteger` function errors. For bit-true integer representation of very large word lengths, use `bin`, `oct`, `dec`, `hex`, or `sdec`.

Examples

Stored Integer Value of fi Objects

Find the stored integer values for two fi objects. Use the `class` function to display the stored integer data types.

```x = fi([0.2 0.3 0.5 0.3 0.2]); in_x = storedInteger(x); c1 = class(in_x) numtp = numerictype('WordLength',17); x_n = fi([0.2 0.3 0.5 0.3 0.2],'numerictype',numtp); in_xn = storedInteger(x_n); c2 = class(in_xn)```