DEVELOPMENT EDITION · 769442725406
Library Reference
On this page

Ada.Numerics

Named-number constants Pi and e.

Read the family guide for representation, selection and resource rules. The complete declaration page retains exact signatures/contracts; the source specification is the implementation baseline.

Availability and ownership

Pi and e are named numbers with the digits shown in the source; converting one to a floating type rounds it. Argument_Error is declared so that a program may name it; the elementary functions never raise it, as their preconditions keep arguments in their domains.

A client proof uses these contracts without proving the body again (see library assurance). Global => null excludes package-global effects, not changes made through an in out argument.

Import and instantiate

with Ada.Numerics;
import Ada.Numerics;

A Vibe module imports this unit's names with from Ada.Numerics import Name; see library use across syntaxes. In Varc, keep each name's declared spelling and write & on arguments the call changes.

Contract and lifecycle reading

A Pre condition is the caller's obligation; a Post is what a normal return guarantees. What a postcondition does not state, a client cannot assume. Ghost functions are for contracts and ghost code. The family guide describes copying, lifetime, order and cost.

API 001

Declared interface:

Argument_Error : exception;

API 002

Pi (declaration) — Named-number approximation of pi with the source decimal digits; conversion to a concrete floating type rounds.

Declared interface:

Pi : constant := 3.14159_26535_89793_23846_26433_83279_50288_41971_69399_37511;

API 003

e (declaration) — Named-number approximation of Euler e with the source decimal digits; not an executable arbitrary-precision value.

Declared interface:

e : constant := 2.71828_18284_59045_23536_02874_71352_66249_77572_47093_69996;