[fpc-pascal] real numbers infinity

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Apr 12 16:54:52 CEST 2006


On 11 apr 2006, at 01:45, Dimitrios Apostolou wrote:

> when a real number overflows the program halts with EInvalidOp  
> error. How can I make the program behave the more standard way,  
> where the variable gets the value "inf" and execution continues  
> normally?

I'm not sure if overflow immediately results in infinity, I think  
first you get some denormalss. There's also nothing particularly  
standard about whether or not an exception is thrown when you have an  
FPU overflow, since all common FPU's I know about support both.

Anyway, you can mask overflow and related exceptions by doing this:

uses math;

...

SetExceptionMask([exDenormalized,exOverflow,exPrecision]);


Jonas



More information about the fpc-pascal mailing list