| Fixed-Point Toolbox™ | ![]() |
Smallest built-in integer fitting stored integer value of fi object
int(a)
int(a) returns the smallest built-in integer of the data type in which the stored integer value of fi object a fits. int(a) is equivalent to a.int.
Fixed-point numbers can be represented as
![]()
or, equivalently,
![]()
The stored integer is the raw binary number, in which the binary point is assumed to be at the far right of the word.
The following table gives the return type of the int function.
| Word Length | Return Type for Signed fi | Return Type for Unsigned fi |
|---|---|---|
Word length <= 8 bits | int8 | uint8 |
8 bits < word length <= 16 bits | int16 | uint16 |
16 bits < word length <= 32 bits | int32 | uint32 |
32 < word length | double | double |
Note When the word length is greater than 52 bits, the return value can have quantization error. For bit-true integer representation of very large word lengths, use bin, oct, dec, hex, or sdec. |
The following code
a = fi([-1 1],1,8,7); y = int(a) z = a.int
returns
y = -128 127 z = -128 127
int8, int16, int32, uint8, uint16, uint32
![]() | innerprodintbits | int8 | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |