chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] mathematical oddities


From: John Cowan
Subject: Re: [Chicken-users] mathematical oddities
Date: Thu, 15 Jul 2010 08:40:50 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

Peter Bex scripsit:

> Chicken has made a choice to raise an error.  I think that's a
> respectable decision.  I use Javascript at work quite a bit and
> the infinities are quite often a source of bugs; you get some error
> later on when you try to use the infinity, instead of at the point the
> infinity is produced.  I much prefer to be alerted right away that I'm
> trying to perform an undefined operation like division by zero.

The reason to return +0.inf from (/ 3.0 0.0) is that 0.0 is not a
mathematical zero: rather, it refers to any number r where -DBL_MIN <
r < DBL_MIN (DBL_MIN is defined in the C header <float.h>).  Dividing by
exact 0, on the other hand, clearly should throw an exception.

I'm not sure what you mean by getting an error when dealing with infinity
in JavaScript.  Are you confusing infinity with NaN?  In addition,
JavaScript forces you to use inexact arithmetic even where exact
arithmetic makes more sense; Scheme doesn't.

-- 
John Cowan  address@hidden  http://ccil.org/~cowan
The competent programmer is fully aware of the strictly limited size of his own
skull; therefore he approaches the programming task in full humility, and among
other things he avoids clever tricks like the plague.  --Edsger Dijkstra



reply via email to

[Prev in Thread] Current Thread [Next in Thread]