March 2000
Intermediate to advanced
576 pages
18h 13m
English
Set8087CW Procedure
procedure Set8087CW(ControlWord: Word);
The Set8087CW procedure sets the floating-point
control word and saves the value of the
ControlWord variable in
Default8087CW. Set8087CW is a
real procedure.
See the Intel architecture manuals to learn more about the floating-point control word.
Common uses for Set8087CW are to change the
floating-point precision, exception mask, and rounding mode. Make
sure you do not reduce the floating-point precision if you are using
the Comp or Currency types.
type
TRoundMode = (rmNearest, rmDown, rmUp, rmZero);
TPrecisionMode = (pmSingle, pmReserved, pmDouble, pmExtended);
TExceptionMask = (emInvalid, emDenormalized, emZeroDivide,
emOverflow, emUnderflow, emPrecision);
TExceptionMasks = set of TExceptionMask;
TFpuControl = record
RoundMode: TRoundMode;
Precision: TPrecisionMode;
ExceptionMask: TExceptionMasks;
end;
const
RoundShift = 10;
PrecisionShift = 8;
// Set the floating-point control word in a structured manner.
procedure SetFpuCW(const FpuCW: TFpuControl);
var
CW: Word;
begin
CW := Byte(FpuCW.ExceptionMask);
CW := CW or (Ord(FpuCW.Precision) shl PrecisionShift);
CW := CW or (Ord(FpuCW.RoundMode) shl RoundShift);
Set8087CW(CW);
end;| Comp Type, Currency Type, Default8087CW Variable, Extended Type, Int Function, Round Function, Trunc Function |
Read now
Unlock full access