SetRoundingType Procedure
Allows you to change the Current Rounding Type.

Unit
QESBPCSMath

Declaration
Procedure SetRoundingType(const RT: TESBRoundingType);

Parameters
RT Desired Rounding Type.

ertBankers - This is the default. 5 is rounded to the nearest even. When ever the Maths Processor is Initialised it returns to this state.

ertDown - 5 is always rounded down.

ertUp - 5 us always rounded up.

ertChop - Rounding always Truncates.

Category
Arithmetic Routines for Floats

Implementation

procedure SetRoundingType (const RT: TESBRoundingType);
var
     CW: TESBBitList;
     B: Byte;
begin
     CW := Get87ControlWord;
     B := Byte (RT);
     if B >= 2 then
          SetBit (CW, 11)
     else
          ClearBit (CW, 11);
     if B mod 2 = 1 then
          SetBit (CW, 10)
     else
          ClearBit (CW, 10);
     Set87ControlWord (CW);
End;


HTML generated by Time2HELP
http://www.time2help.com