www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/28/18:25:09

Date: Wed, 28 Jan 1998 15:23:43 -0800 (PST)
Message-Id: <199801282323.PAA15396@adit.ap.net>
Mime-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, Tom Chojnacki <chojnack AT quantum DOT de>
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: division by 0
Cc: djgpp AT delorie DOT com

At 04:19  1/28/1998 +0200, Eli Zaretskii wrote:
>
>On Wed, 28 Jan 1998, Tom Chojnacki wrote:
>
>> my program exits and I get "Floating Point exception".
>> Is there any way to cause that my program not to stop after
>> division by zero.
>
>You need to set the FPU so that FP exception generation in case of such 
>illegal operations is disabled.  DJGPP v2 has a function calle 
>`_control87' to do that.  I don't know whether v1.x had it.
>
>I would suggest to change your source to not divide by zero in the first 
>place, though.  Not every platform will let you get away with this, you 
>know.
Alternatively, you can install a handler for the SIGFPE signal which
`longjmp's somewhere back into your program. This is more portable than
`control87'. Of course, dividing by zero is a bad idea anyway.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019