Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

flintmax

Largest consecutive integer in floating-point format

Syntax

Description

example

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.

example

f = flintmax(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.

Examples

collapse all

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).

f = flintmax('single')
f =

  single

    16777216

Check the class of f.

class(f)
ans =

single

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).

f = flintmax('single')
f =

  single

    16777216

Add 1 to the value returned from flintmax.

f1 = f+1
f1 =

  single

    16777216

f1 is the same as f.

isequal(f,f1)
ans =

  logical

   1

Add 2 to the value returned from flintmax. The number 16777218 is represented exactly in single precision while 16777217 is not.

f2 = f+2
f2 =

  single

    16777218

Input Arguments

collapse all

Floating-point precision type, specified as 'double' or 'single'.

Data Types: char

Output Arguments

collapse all

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.

See Also

| | |

Introduced in R2013a

Was this topic helpful?