Main Content

# storedInteger

Stored integer value of fi object

## Description

example

x = storedInteger(a) returns the stored integer value of fi object a.

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.

## Examples

collapse all

This example shows how to 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)
c1 =
'int16'
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)
c2 =
'int32'

## Input Arguments

collapse all

Fixed-point numeric object from which you want to get the stored integer value, specified as a fi object.

Data Types: fi
Complex Number Support: Yes

## Output Arguments

collapse all

Stored integer value of fi object, returned as an integer.

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.

## Tips

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.

## Version History

Introduced in R2012a