delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/09/08:31:33

From: sime AT fly DOT cc DOT fer DOT hr (S. Mikecin)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Floating point exception problem
Date: 9 May 1997 10:17:48 GMT
Organization: FER, Croatia
Lines: 31
Distribution: world
Message-ID: <5kutkc$le7@bagan.srce.hr>
References: <336ECFF0 DOT 1DEF AT netvision DOT net DOT il>
Reply-To: sime AT fly DOT cc DOT etf DOT hr
NNTP-Posting-Host: fly.cc.etf.hr
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Guy Rauscher (rauscher AT netvision DOT net DOT il) wrote:
: Hi!

: I've constructed a small library for easily creating 3d applications with
: Allegro. I've produced a small program to demonstrate the functionality
: of my library and it ackwardly breaks sometimes due to a floating point
: exception. The real problem is that the exception occurs when the 3d
: clipping function is used but sometimes when I run the program, it works
: fine. This is NOT because the condition that causes the exception gets
: randomly unencountered. The clipping function uses floating point
: division.

: What I'd like to know is: what is it that causes a FPE in the first place
: and more specifically, what can I do to fix my program? If necessary,
: I'll post the source code.

I think this could solve your problem:

At the beggining of the program put:

#include <float.h>

and in the beggining of the main():

  _control87(MSW_EM,MSW_EM);



--
                                         // E-mail: sime AT fly DOT cc DOT fer DOT hr
                                        // URL:     http://fly.cc.fer.hr/~sime

- Raw text -


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