Name

$SafeDivide Compiler Directive

Syntax

{$U-}             // default
{$SafeDivide Off} // default
{$U+}
{$SafeDivide On}

Scope

Local

Description

When you enable the $SafeDivide directive, Delphi ensures that the infamous Pentium FDIV bug does not bite your program. With the $SafeDivide directive, floating-point division is carried out by a special function. The first time your program calls the function, it tests for the presence of the bug. If the floating-point hardware is defective, subsequent divisions are carried out by software. If the hardware is correct, subsequent divisions are carried out by the hardware. The test subroutine sets the TestFDIV variable to -1 if the hardware is defective or 1 if the hardware is correct.

The FDIV error affects only older Pentium processors and only certain division operations. Most programs can safely ignore this problem today.

See Also

TestFDIV Variable

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.