On Sat, 2002-01-19 at 07:20, Tony Peden wrote:
> I've been trying to reproduce the reported problem in FGInitialCondition
> and would like to have floating point exceptions enabled to do that.
> The trouble is that I can't seem to get it to work like I expect.
> On linux, if I either the method in src/Main/main.cxx:
> 
> fpu_control_t fpe_flags;
> _FPU_GETCW(fpe_flags);
> fpe_flags &= ~_FPU_MASK_IM;   // invalid operation
> fpe_flags &= ~_FPU_MASK_DM;   // denormalized operand
> fpe_flags &= ~_FPU_MASK_ZM;   // zero-divide
> fpe_flags &= ~_FPU_MASK_OM;   // overflow
> fpe_flags &= ~_FPU_MASK_UM;   // underflow
> fpe_flags &= ~_FPU_MASK_PM;   // precision (inexact result)
> _FPU_SETCW(fpe_flags);
> 
> or that defined in fenv.h:
> feenableexcepts(FE_ALL_EXCEPT)
> 
> I'll get an exception for
> float a= 3/0
> but *not* for
> float a=3/0.0
> even though both div by zero and overflow are enabled, AFAICT.
> 
> Does anyone understand what's happening here?

Well, I've spent quite a few hours on this and AFAICT, the FPU
is being set up correctly, it's just not generating the exception
for a floating point divide by zero (or any other floating point error
I could induce).  Integer divide by zero works just fine.

This has implications for FG as well, as I've used FG's code in
my experiments.  I don't know what it is that needs to be done 
but until we figure it out I don't think the code in FG is really
doing much of anything as most of the math is floating point as
far as I know.  Of course, it's not hurting anything either ...


> 
> 
> -- 
> Tony Peden
> [EMAIL PROTECTED]
> We all know Linux is great ... it does infinite loops in 5 seconds. 
> -- attributed to Linus Torvalds
> 
> _______________________________________________
> Flightgear-devel mailing list
> [EMAIL PROTECTED]
> http://mail.flightgear.org/mailman/listinfo/flightgear-devel
-- 
Tony Peden
[EMAIL PROTECTED]
We all know Linux is great ... it does infinite loops in 5 seconds. 
-- attributed to Linus Torvalds

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to