Documentation Center

  • Trial Software
  • Product Updates
라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

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

expand all

Double Precision

Return the largest consecutive integer in IEEE double precision.

format long e
f = flintmax
f =

     9.007199254740992e+15

This is 2^53.

Single Precision

Return the largest consecutive integer in IEEE single precision.

f = flintmax('single')
f =

    16777216

This is single(2^24).

Check the class of f.

class(f)
ans =

single

Limit of Integer Single Precision

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.

f = flintmax('single')
f =

    16777216

This is single(2^24).

Add 1 to the value returned from flintmax.

f1 = f + 1
f1 =

    16777216

f1 is the same as f.

isequal(f,f1)
ans =

     1

Add 2 to the value returned from flintmax.

f2 = f + 2
f2 =

    16777218

16777218 is represented exactly in single precision while 16777217 is not.

Input Arguments

expand all

precision — Floating-point precision type‘double' (default) | ‘single'

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

Data Types: char

Output Arguments

expand all

f — Largest consecutive integer in floating-point formatscalar constant

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

| | |

Was this topic helpful?