System.Set8087CW

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Set8087CW(NewCW: Word);

C++

extern DELPHI_PACKAGE void __fastcall Set8087CW(Word NewCW);

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.pas
System.hpp
System System

Description

Sets the FPU control word.

On 32-bit Windows: This control word controls the precision of floating-point calculations, the rounding mode, and whether certain floating-point operations trigger exceptions. See the Intel processors' documentation for details.

This routine allows you to have direct access to the CW. Be aware that using this routine to change the value of the 8087CW changes the behavior of the program's FP calculations. To avoid this, reset the 8087CW. For an example, see the Set8087CW code examples, listed below.

Note: To change the exception mode, the rounding mode, and the precision for floating-point numbers, we recommend that you use System.Math.SetExceptionMask, System.Math.SetRoundMode, and System.Math.SetPrecisionMode instead of Set8087CW or System.SetMXCSR.

When using OpenGL to render 3D graphics, we recommend that you disable all floating-point exceptions for performance reasons. To do this, call Set8087CW(0x133f) in your main form's OnCreate event before calling any OpenGL functions.

On 64-bit Windows: This control word does not control floating-point operations, because the SSE register is used for floating point in 64-bit mode, instead of the FPU (floating-point unit). However the FPU is still present in 64-bit mode, so Set8087CW sets the value of the control word, as in 32-bit mode.

On iOS/Simulator: This function does not change the exception for the X87 control word mask bits. The masked bits for this exception always have the value 1.

See Also

Code Examples