[fpc-pascal] {$FINITEFLOAT OFF}

LacaK lacak at zoznam.sk
Thu Aug 4 08:53:18 CEST 2016


Hi,

does we have in FPC something like Delphi {$FINITEFLOAT OFF} ?
If not can be implemented in future ?

I am trying to avoid FPU exception in case of underflow or overflow values.

I have this test code:

   d := 30000; // + or -
   d := 1/(1+exp(-1*d)); // here I get SIGFPE exception (my guess is 
that it is caused by value underflow -INF or overflow +INF

What can I do in this case ?
I did:
   SetExceptionMask(GetExceptionMask() + [exUnderflow,exOverflow]);

It seems to work, but it depends on Math unit, which I want to avoid.

Then I did:
   CW := Get8087CW;
   SSECW:=GetSSECSR;
   Set8087CW(CW or $18); // mask underflow,overflow
   SetSSECSR((SSECW and $ffffe07f) or (dword($58) shl 7));

It works for Win32, but not for Win64 ?

TIA
-Laco.



More information about the fpc-pascal mailing list