Main Content

realmin

Smallest normalized floating-point number

Description

example

f = realmin returns the smallest positive normalized floating-point number in IEEE® double precision. This is equal to 2^(-1022).

example

f = realmin(precision) returns the smallest positive normalized floating-point number in IEEE single or double precision. This is equal to realmin for double precision, and to single(2^(-126)) for single precision.

example

f = realmin("like",p) returns the smallest positive normalized floating-point number with the same data type, sparsity, and complexity (real or complex) as the floating-point variable p.

Examples

collapse all

Set the output format to long scientific notation. Return the smallest positive normalized floating-point number in IEEE® double precision.

format long e
f = realmin
f = 
    2.225073858507201e-308

Return the smallest positive normalized floating-point number in IEEE® single precision.

f = realmin("single")
f = single
    1.1755e-38

Check the class of f.

class(f)
ans = 
'single'

Return the smallest positive normalized 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 smallest positive normalized floating-point number as a scalar that is complex like p.

f = realmin("like",p)
f = single
    1.1755e-38 + 0.0000e+00i

Create a 10-by-10 sparse matrix.

p = sparse(10,10,pi);

Return the smallest positive normalized floating-point number with the same data type and sparsity as p. The output is a 1-by-1 sparse matrix.

f = realmin("like",p)
f = 
   (1,1)     2.2251e-308

Input Arguments

collapse all

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

Prototype, specified as a floating-point variable.

Data Types: double | single
Complex Number Support: Yes

Extended Capabilities

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

Version History

Introduced before R2006a