[Ecls-list] Extension to infinity and NaN?

Goffioul Michael goffioul at imec.be
Wed Jul 20 08:02:13 UTC 2005


> On Wed, 20 Jul 2005 16:15:20 +0200
> "Goffioul Michael" <goffioul at imec.be> wrote:
> 
> > > On Wed, 2005-07-20 at 13:32 +0200, Goffioul Michael wrote:
> > > > Do you think that extending ECL to support inifinity and 
> > > NaN as special
> > > > numbers is possible (without too much effort)? I know this 
> > > is not part
> > > > of ANSI, but it can be very convenient.
> > > 
> > > The effort is precisely on ensuring that it does not 
> > > contradict the ANSI
> > > semantics. Do you know how this is handled, say for instance, 
> > > in CMUCL?
> > 
> > It uses special constants defined in the EXT package. See 
> for example
> > 
> http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.h
> tml#toc7.
> > But as you say, the problem is to not contradict ANSI. 
> Thinking about
> > it, does ANSI state that (/1 0) MUST signal an error? Looking at
> > HyperSpec, it uses MIGHT. From CMUCL doc, it seems that this depends
> > on some trapping flag.
> 
> Having (/ 1 0) signal no error violates the POLA for quite some users,
> and is mathematically incorrect (infinity is no number). When does it
> come handy?

When you do engeering computation. For example, to convert a cubic
representation (a1, a3) of an amplifier into the more common parameters
(Gain, IIP3): for a linear amplifier, a3=0, hence IIP3 is infinite.
It's then handy to have 1/0=Inf to avoid special cases in your computation.
In the same way, 1/Inf=0 is also handy.

Michael.




More information about the ecl-devel mailing list