with Floating_Characteristics;
use Floating_Characteristics;

package Numeric_Primitives is

    --  This may seem a little much but is put in this form to allow the
    --  same form to be used for a generic package
    --  If that is not needed, simple litterals could be substituted
    Zero : Float := Convert_To_Float (Integer (0));
    One : Float := Convert_To_Float (Integer (1));
    Two : Float := One + One;
    Three : Float := One + One + One;
    Half : Float := One / Two;

    --  The following "constants" are effectively deferred to
    --  the initialization part of the package body
    --  This is in order to make it possible to generalize the floating type
    --  If that capability is not desired, constants may be included here
    Pi : Float;
    One_Over_Pi : Float;
    Two_Over_Pi : Float;
    Pi_Over_Two : Float;
    Pi_Over_Three : Float;
    Pi_Over_Four : Float;
    Pi_Over_Six : Float;

    function Sign (X, Y : Float) return Float;
    --  Returns the value of X with the sign of Y

    function Max (X, Y : Float) return Float;
    --  Returns the algebraicly larger of X and Y

    function Min (X, Y : Float) return Float;
    --  Returns the algebraicly smaller of X and Y

    function Truncate (X : Float) return Float;
    --  Returns the floating value of the integer no larger than X
    --  AINT(X)

    function Round (X : Float) return Float;
    --  Returns the floating value nearest X
    --  AINTRND(X)

    function Ran return Float;
    --  This uses a portable algorithm and is included at this point
    --  Algorithms that presume unique machine hardware information
    --  should be initiated in FLOATING_CHARACTERISTICS
end Numeric_Primitives;
