File : rounding.ads



package Rounding is          -- for x87 floating point processor
                             -- 80 bit extended format (64 bit mantissa)
                             -- gnat specific code, but easy to adapt

  procedure Relax_Checks;    -- round to nearest, mask exceptions
  procedure Restore_Checks;  -- round up, unmask exceptions

private

  type Uns16 is mod 2**16;

  procedure Load_Control_Word(W: in Uns16);

  Relaxed: constant Uns16 := 2#0011_0111_1111#;
  Strict:  constant Uns16 := 2#1011_0110_0000#;
--                             abcd   ef ghij
--  ab=00  round toward zero
--  ab=10  round up
--  cd=11  64 bit mantissa
--   e=1   allow rounding (mask exception)
--   f=0   disallow underflows
--   g=0   overflows not masked     (exception instead of NaN)
--   h=0   division by 0 not masked (exception instead of infinity)
--   i=0   disallow denormalized numbers
--   j=0   invalid operations not masked

end Rounding;