File : numerics.adb



package body Numerics is

  Zero_Numeric: constant Numeric := Numeric(0.0);

  function IsNumeric(S: Numeric) return Boolean is
  begin
    return True;
  end IsNumeric;

  function Scal(K: Integer) return Numeric is
  begin
    return Numeric(K);
  end Scal;

  function Scal(R: Rep) return Numeric is
  begin
    return Numeric(R);
  end Scal;

  function Ball(R: Rep) return Numeric is
  begin
    return Zero_Numeric;
  end Ball;

  function Ball(S: Numeric) return Numeric is
  begin
    return Zero_Numeric;
  end Ball;

  function IntFloor(S: Numeric) return Integer is
  begin
    return Integer(Numeric'Floor(S));
  end IntFloor;

  function IntCeiling(S: Numeric) return Integer is
  begin
    return Integer(Numeric'Ceiling(S));
  end IntCeiling;

  function Approx(S: Numeric) return Rep is
  begin
    return Rep(S);
  end Approx;

  function Up(R: Rep; Dummy: Numeric) return Rep is
  begin
    return R+Rep'Safe_Small;
  end Up;

  function Center(S: Numeric) return Numeric is
  begin
    return S;
  end Center;

  procedure ResetCenter(S: in out Numeric) is
  begin
    S := Zero_Numeric;
  end ResetCenter;

  procedure Split(S: in Numeric; S0,SE: out Numeric) is
  begin
    S0 := S;
    SE := Zero_Numeric;
  end Split;

  procedure ErrMult(R: in Rep; S: in out Numeric) is
  begin
    null;
  end ErrMult;

  function SupAbs(S: Numeric) return Rep is
  begin
    return Abs(Rep(S));
  end SupAbs;

  function Cap(R: Radius; S: Numeric) return Numeric is
  begin
    if Abs(S) <= Numeric(R) then
      return S;
    else
      return Zero_Numeric;
    end if;
  end Cap;

end Numerics;