Is there any reason not to remove checks for the Pentium FDIV bug?

Viewed 210

See the last checkbox which appears in the VB6 IDE from Project Properties / Compile / Advanced Optimizations:

enter image description here

This was relevant on buggy hardware of ~ 25 years ago (1994?) but I have a hard time imagining that any current CPUs would still have this problem.

However I am not certain if there are any desirable side-effects of this check that might mean its worth leaving in place? Or undesirable effects of removal?

I see this has been addressed for Delphi, but I can't find anything for VB6.

From those Q's I get the impression that it is no longer a real concern for Delphi.


Summary of what this was for:

Removing Safe Pentium FDIV Checks

This is yet another floating-point optimization. Some of Intel’s early Pentium chips had a bug that affected certain floating-point division calculations. By default, VB’s mathematical routines guard against the Pentium bug, but doing the math in VB code is slower than letting the processor chip do it for you. If you are confident that your programs won’t run on a machine with the Pentium FDIV bug, you may want to activate this optimization.

(ref1)


And some code to check for the bad hardware, which illustrates the problem itself:

' return True if the CPU suffers from the FDIV bug

Function IsBuggedPentium() As Boolean
    IsBuggedPentium = ((1 / 3221224323) * 3221224323) <> 1 
End Function

Note that this code always returns False in a VB application that runs as p-code or compiled with the standard compilation options. To actually detect the bug, you must execute this function in an application compiled with the "Remove Safe Pentium(tm) FDIV Checks", in the Project Properties - Advanced Optimizations dialog box.

(ref2)

0 Answers
Related