On Tue, Mar 01, 2005 at 08:13:46AM +0000, Fergal Daly wrote:
> On Mon, Feb 28, 2005 at 07:55:36PM -0600, Eric Wilhelm wrote:
> > I like the one where you get the mathematically-correct (or at least 
> > mathematically-useful) infinity.
> > 
> >   $perl -le 'use bigint; $x = 1/0; print $x+1'
> >   inf
> > 
> >   $perl -le 'use bigint; $x = 1/0; print 1/$x'
> >   0
> 
> and what should these print?
> 
> $perl -le 'use bigint; $x = 2/0; print $x*0'
> 
> $perl -le 'use bigint; $x = 1/0; print ($x+1)-$x'
> 
> $perl -le 'use bigint; $x = 1/0; print ($x*2)/$x'
> 


        I don't know, but I do know that having the interpreter crap out
is not helpful to most of us simpletons who find phrases like "core dumped"
not especially user friendly.

        Maybe if there is a divide by zero you could set one of the cussword
variables ([EMAIL PROTECTED]@#$!) in addition to returning undef or inf, 
whatever. Then
if you mathematically correct types don't like the result you can make your
own, or go back to crapping out by kill(SIGBUS,$$).

        I suppose I could try to create a use divide 0/undef/inf/crap pragma.
Then you could do whatever you want. You'd still get a surprise if you ever
forgot it though..

        Austin

Reply via email to