Computer Zero, Inf, Epsilon



Mansur Marvanov wrote:
> Hello!
> 
> Does anybody know how can I calculate Computer Zero, Computer Infinity
> and Computer Epsilon in Maxima?
> 
> About this values:
> 
> 1) Computer Zero: X(0)=2^(-m), where m - minimum natural number, when
> 2^(-m) = 0
> 
> I get such results:
> 
> (%i50) 2^(-1022),numer;
> (%o50)                       2.2250738585072E-308
> (%i51) 2^(-1023),numer;
> (%o51)                                0.0
> 
> So, X(0)=2.2250738585072E-308 --- is _my_ Comp. Zero;
> 
> 2) Computer Infinity: X(inf)=2^(m), where m - minimum natural number,
> when overflow --- I havn't any assumption;

For IEEE double-floats, the most positive number isn't 2^m for some m. 
It's really 2^m-2^(m-53).  But of course, you can't actually compute 
this because 2^m is an overflow. :-)

As Richard Fateman suggests, use Lisp's most-positive-double-float.
> 
> 3) Computer Epsilon: e(M)=2^(-k), where k - minimum natural number, when
> (1+2^(-k)) = 1 --- no my assumption.

For IEEE double-floats, this is also not quite right.  Epsilon is really 
2^m + a tiny bit.  The actual value should be Lisp's 
double-float-epsilon, which is 2^-53 + 2^-105.

Ray