Computer Zero, Inf, Epsilon



I think that what you want are constants  available in any ANSI common lisp
E.g.  

:lisp  least-positive-double-float
 5.0d-324
:lisp  double-float-epsilon
1.1102230246251568d-16
:lisp most-positive-double-float
1.7976931348623157d+308
Etc

This should be the same for any IEEE double float implementation, though it
may depend upon whether you allow only normalized numbers.
least-positive-normalized-double-float = 2.2250738585072014d-308
Also
 least-positive-normalized-single-float = 1.1754944e-38

 
I'm not sure what CLISP is doing though wrt denomalized numbers and whether
is has both single and double.
.

You can compute these items by fairly obvious simple loops, assuming the
representation is radix 2, though. I suggest you use (expt 2.0d0 n)   rather
than (expt 2 n) which is not floating point at all.


RJF

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Mansur Marvanov
> Sent: Thursday, September 27, 2007 2:22 PM
> To: maxima at math.utexas.edu
> Subject: Computer Zero, Inf, Epsilon
> 
> 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;
> 
> 3) Computer Epsilon: e(M)=2^(-k), where k - minimum natural 
> number, when
> (1+2^(-k)) = 1 --- no my assumption.
> 
> My versions:
> Maxima 5.12.99rc1 http://maxima.sourceforge.net
> Using Lisp CLISP 2.41 (2006-10-13)
> 
> Thanks a lot.
> -- 
> Mansur Marvanov <nanorobocop at gmail.com>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>