RAD Studio (Common)
ContentsIndex
PreviousUpNext
Floating Point Exception Checking (Delphi)
Type  
Switch  
Syntax  
{$FINITEFLOAT ON}, {$FINITEFLOAT OFF}  
Default  
{$FINITEFLOAT ON}  
Scope  
Global  

Remarks 

The $FINITEFLOAT directive controls the handling of floating point overflow and underflow, and invalid floating point operations such as division by zero. 

In the {$FINITEFLOAT ON} state, which is the default, the results of floating point calculations are checked, and an exception is raised when there is an overflow, underflow, or invalid operation. In the {$FINITEFLOAT OFF} state, such floating point calculations will return NAN, -INF, or +INF. 

Extra runtime processing is required to check the results of floating point calculations and raise exceptions. If your Delphi code uses floating point operations but does not require strict enforcement of overflow/underflow exceptions, you can turn {$FINITEFLOAT OFF} to get slightly faster runtime execution.

Note: Most code in .NET runs without floating point checks. However, Delphi has traditionally provided strict floating point semantics. If you have Delphi code that relies on exceptions to be raised in overflow and underflow conditions, you should retain the default setting ({$FINITEFLOAT ON}).

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!