realmin
"returns the smallest positive normalized floating point number in IEEE double precision". eps(X)
"is the positive distance from ABS(X) to the
next larger in mangitude floating point number of the same precision as X".
If I am interpreting the above documentation correctly, then realmin
-- the smallest positive number that can be represented -- must be smaller than eps
(0)
. But:
>> realmin; % 2.2251e-308
>> eps(0); % 4.9407e-324
Obviously, eps(0)
, which is even smaller, can be represented too. Could someone explain this to me?
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.
Description. eps returns the distance from 1.0 to the next largest floating-point number. The value eps is a default tolerance for pinv and rank , as well as several other MATLAB functions. On machines with IEEE floating-point arithmetic, eps = 2^(-52) , which is roughly 2.22e-16 . See Also.
Convert Value Smaller Than intmin Return the smallest value of the 8-bit signed integer type, which is –128.
REALMIN('single') is the smallest positive normalized single precision floating point number on your computer. realmin is 2^(-1022) or about 2.2251e-308 .
This is a floating point issue. You should go read up on denormal numbers.
Briefly, realmin
returns the smallest positive normalized floating point number. But it's possible to have denormal numbers that are smaller than this and still representable in floating point, which is what eps(0)
returns.
Quick explanation of denormal numbers
A binary floating point number looks like this:
1.abcdef * 2^M
where abcdefg
are each either 0 or 1, and M
is a number in the range -1022 <= M <= 1023. These are called normalized floating point numbers. The smallest possible normalized floating point number is 1 * 2^(-1022)
.
The denormal numbers looks like this
0.abcdef * 2^(-1022)
so they can take values that are smaller than the smallest possible normalized floating point number. The denormal numbers linearly interpolate between -realmin
and realmin
.
Perhaps it is a matter of definition, this is what I see in the documentation of eps:
For all X of class double such that abs(X) <= realmin, eps(X) = 2^(-1074)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With