Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Numbers smaller than realmin

Today I stumbled onto this plain problem in Matlab:

>> 1/(10^309)

ans =

     0

and everything is fine. Now I type:

>> 0.0001/(10^308)

ans =

    9.999999999984653e-313

and get very confused. Wasn't the smallest number possible in Matlab realmin=2.225073858507201e-308? Why is the above output not giving 0?

like image 417
ftiaronsem Avatar asked Apr 21 '12 18:04

ftiaronsem


1 Answers

realmin returns the smallest positive normalized floating-point number in IEEE double precision.

There are smaller positive denormal floating point numbers. Have a look at “What Every Computer Scientist Should Know About Floating-Point Arithmetic”.

You might be more interested in eps that returns the smallest increment between distinct numbers.

like image 186
Anonymous Avatar answered Oct 08 '22 04:10

Anonymous