realmax

Largest positive floating-point number

Description

example

f = realmax returns the largest finite floating-point number in IEEE® double precision. This is equal to (2-2^(-52))*2^1023.

example

f = realmax(precision) returns the largest finite floating-point number in IEEE single or double precision. This is equal to realmax for double precision, and to single((2-2^(-23))*2^127) for single precision.

Examples

collapse all

Set the output format to long scientific notation. Return the largest finite floating-point number in IEEE® double precision.

format long e
f = realmax
f = 
    1.797693134862316e+308

Return the largest finite floating-point number in IEEE® single precision.

f = realmax('single')
f = single
    3.4028e+38

Check the class of f.

class(f)
ans = 
'single'

Input Arguments

collapse all

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a