Main Content

cast64BitIntToFi

Cast 64-bit integer types to an equivalent fi object type

Since R2020a

Description

y = cast64BitIntToFi(u) casts the input variable u to an equivalent 64-bit fi object when the data type of u is a 64-bit integer type. Otherwise, the output has the same data type as the input.

example

Examples

collapse all

Use the castIntToFi and cast64BitIntToFi functions to cast integer data types in your code to equivalent fi objects.

Create a variable with a signed 16-bit integer data type. Cast the variable to an equivalent fi object using the castIntToFi function.

u = int16(25);
y1 = castIntToFi(u)
y1 = 

    25

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 0

The output fi object has the same word length and signedness as the input, and zero fraction length.

The cast64BitIntToFi function casts only 64-bit integer data types to an equivalent fi object. All other input data types retain their data type.

In this example, because the input is not an int64 or uint64 data type, the output remains an int16.

y2 = cast64BitIntToFi(u)
y2 =

  int16

   25

When you pass an int64 into the cast64BitIntToFi function, the output is a fi object with a 64-bit word length and zero fraction length.

u = int64(25);
y3 = castIntToFi(u)
y3 = 

    25

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 64
        FractionLength: 0

Input Arguments

collapse all

Numeric input array, specified as a scalar, vector, matrix, or multidimensional array.

Data Types: double | single | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
Complex Number Support: Yes

Output Arguments

collapse all

Numeric output, returned as a scalar, vector, matrix, or multidimensional array with the same value and dimensions as the input.

When the data type of u is a 64-bit integer type, the output is a fi object with a 64-bit word length, fraction length of zero, and the same signedness as the input. Otherwise, the output has the same data type as the input.

Version History

Introduced in R2020a