[Haskell-cafe] Re: 0/0 > 1 == False

David Roundy droundy at darcs.net
Thu Jan 10 15:52:20 EST 2008


On Thu, Jan 10, 2008 at 09:41:53PM +0100, Achim Schneider wrote:
> David Roundy <droundy at darcs.net> wrote:
> > On Thu, Jan 10, 2008 at 09:24:34PM +0100, Achim Schneider wrote:
> > > John Meacham <john at repetae.net> wrote:
> > > > 1/0 = Infinity
> > > > -1/0 = -Infinity
> > >
> > > Just out of curiosity:
> > > 
> > > 1/-0 = -Infinity?
> > > -1/-0 = Infinity?
> > 
> > Yes.  (You could have tried this for yourself, you know... but I
> > suppose haskell-cafe isn't a bad interactive Haskell interpreter,
> > perhaps more user friendly than ghci.)
>
> Prelude> 1 `div` 0
> *** Exception: divide by zero
> 
> That's it. One just shouldn't just extrapolate and think you didn't mean
> GHC but IEEE...

Prelude> 1/(-0)
-Infinity

You need to use the / operator, if you want to do floating-point division.
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Haskell-Cafe mailing list