flintmax - Largest consecutive integer in floating-point format - MATLAB (original) (raw)
Main Content
Largest consecutive integer in floating-point format
Syntax
Description
[f](#btpkmp1-1-f) = flintmax
returns the largest consecutive integer in IEEE® double precision, which is 2^53
. Above this value, double-precision format does not have integer precision, and not all integers can be represented exactly.
[f](#btpkmp1-1-f) = flintmax([precision](#btpkmp1-1-precision))
returns the largest consecutive integer in IEEE single or double precision. flintmax
returns single(2^24)
for single precision and 2^53
for double precision.
[f](#btpkmp1-1-f) = flintmax(like=[p](#mw%5Fd80a1eaf-506b-4cd4-af49-3004a81bfa8c))
returns the largest consecutive integer with the same data type, sparsity, and complexity (real or complex) as the floating-point variablep
.
Examples
Return the largest consecutive integer in IEEE® double precision, 2^53
.
format long e f = flintmax
f = 9.007199254740992e+15
Return the largest consecutive integer in IEEE® single precision, single(2^24)
.
Check the class of f
.
Above the value returned by flintmax("single")
, not all integers can be represented exactly with single precision.
Return the largest consecutive integer in IEEE® single precision, single(2^24)
.
Add 1
to the value returned from flintmax
.
f1
is the same as f
.
Add 2
to the value returned from flintmax
. The number 16777218
is represented exactly in single precision while 16777217
is not.
Return the largest consecutive integer with the same data type and complexity as an existing array.
First, create a complex vector of single
data type.
p = single([0.12+2i -0.5i 3]);
Return the largest consecutive integer as a scalar that is complex like p
.
f = single
1.6777e+07 +0.0000e+00i
Input Arguments
Floating-point precision type, specified as "double"
or"single"
.
Data Types: char
Prototype, specified as a floating-point variable.
Data Types: double
| single
Complex Number Support: Yes
Output Arguments
Largest consecutive integer in floating-point format returned as a scalar constant. This constant is 2^53
for double precision and single(2^24)
for single precision.
Extended Capabilities
This function supports tall arrays with the limitations:
- The supported syntax is
flintmax(like=p)
, where the underlying data type ofp
must be a floating-point type.
For more information, see Tall Arrays.
The flintmax
function supports GPU array input with these usage notes and limitations:
- The supported syntax is
flintmax(like=p)
, where the underlying data type ofp
must be a floating-point type.
For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Usage notes and limitations:
- The supported syntax is
flintmax(like=p)
, where the underlying data type ofp
must be a floating-point type.
For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version History
Introduced in R2013a