[Haskell-cafe] 1/0

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Mon Jun 16 21:53:32 EDT 2008


On 2008 Jun 16, at 19:18, David Roundy wrote:

> On Mon, Jun 16, 2008 at 4:07 PM, Evan Laforge <qdunkan at gmail.com>  
> wrote:
>> Every other language throws an exception, even C will crash the
>> program, so I'm guessing it's telling the processor / OS to turn  
>> these
>> into signals, while GHC is turning that off.  Or something.  But then
>> what about this note in Control.Exception:
>
> That's just not true.  It depends on how your system (compiler?) is
> configured, but the default on most systems that I've used is to
> return NaNs.


It's how the system FPU is configured; most FPU hardware on Unixlike  
systems let you configure the FPU behavior on a per-process basis,  
although the amount of configurability may vary.

That said, the divide by zero exception you get in both C and Haskell  
is *integer* divide-by-zero.  Floating is mandated by IEEE standard to  
produce Inf (but as said above, can usually be configured).

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list