realmax - Largest positive floating-point number - MATLAB (original) (raw)
Main Content
Largest positive floating-point number
Syntax
Description
[f](#mw%5F56ff5a35-e70e-47e8-b47c-9720eff39805) = realmax
returns the largest finite floating-point number in IEEE® double precision. This is equal to(2-2^(-52))*2^1023
.
[f](#mw%5F56ff5a35-e70e-47e8-b47c-9720eff39805) = realmax([precision](#mw%5Ff86e82a6-15c0-4d28-8a79-a46160e342dc))
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.
[f](#mw%5F56ff5a35-e70e-47e8-b47c-9720eff39805) = realmax(like=[p](#mw%5Fa3465443-498e-472a-b534-a0c4b72783c6))
returns the largest finite floating-point number with the same data type, sparsity, and complexity (real or complex) as the floating-point variable p
.
Examples
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.
Check the class of f
.
Return the largest finite floating-point number 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 finite floating-point number as a scalar that is complex like p.
f = single
3.4028e+38 +0.0000e+00i
Create a 10-by-10 sparse matrix.
Return the largest finite floating-point number with the same data type and sparsity as p
. The output is a 1-by-1 sparse matrix.
f = sparse double (1,1) 1.7977e+308
Input Arguments
Floating-point precision type, specified as "double"
or"single"
.
Prototype, specified as a floating-point variable.
Data Types: double
| single
Complex Number Support: Yes
Output Arguments
Largest floating-point number, returned as a scalar.
Extended Capabilities
This function supports tall arrays with the limitations:
- The supported syntax is
realmax(like=p)
, where the underlying data type ofp
must be a floating-point type.
For more information, see Tall Arrays.
The realmax
function supports GPU array input with these usage notes and limitations:
- The supported syntax is
realmax(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
realmax(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 before R2006a