Re: Divide by 0? Was: Re: Introduction Letter

2005-03-01 Thread Austin Schutz
On Tue, Mar 01, 2005 at 08:13:46AM +, 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

Re: Divide by 0? Was: Re: Introduction Letter

2005-03-01 Thread Ofer Nave
Austin Schutz wrote: 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.. I think that's the best answer. Not a good idea for most programs, wonderful idea for math programs -

Divide by 0? Was: Re: Introduction Letter

2005-02-28 Thread Austin Schutz
On Tue, Mar 01, 2005 at 11:43:31AM +1100, Andrew Savige wrote: running this Perl program: use strict; sub div_by_zero { exec(./a.out $_[0]); die should not be here } defined(my $pid = fork()) or die fork: $!; if ($pid == 0) { warn child, my pid $$\n; div_by_zero(0); # sig 8

Re: Divide by 0? Was: Re: Introduction Letter

2005-02-28 Thread David Golden
Austin Schutz wrote: This is not related to the original topic, but I've always wondered this: In math a number divided by 0 is undefined. Why is it that in a language which has an undefined value does the interpreter poop out rather than just having the intuitively obvious behavior of

Re: Divide by 0? Was: Re: Introduction Letter

2005-02-28 Thread Eric Wilhelm
# The following was supposedly scribed by # David Golden # on Monday 28 February 2005 07:07 pm: Which would you prefer?     $ perl -le '$x=1/0; print $x+1'         Illegal division by zero at -e line 1. or     $ perl -le '$x=1/0; print $x+1'         1 I like the one where you get the