DEVELOPMENT EDITION · 769442725406
Library Reference
On this page

Generic package Ada.Numerics.Generic_Elementary_Functions

Ada.Numerics.Generic_Elementary_Functions (RM A.5.1), the functions Verada provides, with the contracts the prover uses: their domains as preconditions, and bounds of their results. The values come from the C library (correctly rounded to within an ulp or so), so the contracts are trusted, like the rest of the predefined library.

generic
   type Float_Type is digits <>;

Sqrt

function Sqrt (X : Float_Type) return Float_Type
  with Global => null,
       Pre => X >= 0.0,
       Post => Sqrt'Result >= 0.0 and then Sqrt'Result <= (if X <= 1.0 then 1.0 else X);

Exp

function Exp (X : Float_Type) return Float_Type
  with Global => null,
       Pre => X <= 80.0,
       Post => Exp'Result >= 0.0;

Log

function Log (X : Float_Type) return Float_Type
  with Global => null,
       Pre => X > 0.0,
       Post => Log'Result in -800.0 .. 800.0
               and then (if X >= 2.0 then Log'Result >= 0.69)
               and then (if X <= 0.5 then Log'Result <= -0.69);

Sin

function Sin (X : Float_Type) return Float_Type
  with Global => null,
       Post => Sin'Result in -1.0 .. 1.0;

Cos

function Cos (X : Float_Type) return Float_Type
  with Global => null,
       Post => Cos'Result in -1.0 .. 1.0;

Log

function Log (X, Base : Float_Type) return Float_Type
  with Global => null,
       Pre => X > 0.0 and then (Base >= 2.0 or else (Base > 0.0 and then Base <= 0.5));

the logarithm of X to a base (as APL's a ⍟ b, the logarithm of b to the base a)

Tan

function Tan (X : Float_Type) return Float_Type
  with Global => null,
       Post => Tan'Result in -1.0E17 .. 1.0E17;

Arcsin

function Arcsin (X : Float_Type) return Float_Type
  with Global => null,
       Pre => X in -1.0 .. 1.0,
       Post => Arcsin'Result in -1.6 .. 1.6;

Arccos

function Arccos (X : Float_Type) return Float_Type
  with Global => null,
       Pre => X in -1.0 .. 1.0,
       Post => Arccos'Result in 0.0 .. 3.2;

Arctan

function Arctan (X : Float_Type) return Float_Type
  with Global => null,
       Post => Arctan'Result in -1.6 .. 1.6;

Sinh

function Sinh (X : Float_Type) return Float_Type
  with Global => null,
       Pre => X in -80.0 .. 80.0,
       Post => Sinh'Result in -3.0E34 .. 3.0E34;

Cosh

function Cosh (X : Float_Type) return Float_Type
  with Global => null,
       Pre => X in -80.0 .. 80.0,
       Post => Cosh'Result in 1.0 .. 3.0E34;

Tanh

function Tanh (X : Float_Type) return Float_Type
  with Global => null,
       Post => Tanh'Result in -1.0 .. 1.0;

Arcsinh

function Arcsinh (X : Float_Type) return Float_Type
  with Global => null,
       Post => Arcsinh'Result in -800.0 .. 800.0;

Arccosh

function Arccosh (X : Float_Type) return Float_Type
  with Global => null,
       Pre => X >= 1.0,
       Post => Arccosh'Result in 0.0 .. 800.0;

Arctanh

function Arctanh (X : Float_Type) return Float_Type
  with Global => null,
       Pre => X > -1.0 and then X < 1.0,
       Post => Arctanh'Result in -800.0 .. 800.0;