DEVELOPMENT EDITION · 769442725406
Library Reference
On this page

Ada.Numerics.Big_Numbers.Big_Reals

Exact rational values for ghost specifications.

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

Ghost package: its values exist only in contracts and ghost code. Exponents are nonnegative and divisors nonzero.

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.Big_Numbers.Big_Reals;
import Ada.Numerics.Big_Numbers.Big_Reals;

A Vibe module imports this unit's names with from Ada.Numerics.Big_Numbers.Big_Reals 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

Big_Real (declaration) — Private ghost rational value for specifications; no ordinary native arbitrary-precision decimal representation is supplied.

Ghost: for contracts and ghost code, and left out of the program.

Declared interface:

type Big_Real is private;

API 002

To_Big_Real (declaration) — Lift Big_Integer into the ghost exact-rational model.

Ghost: for contracts and ghost code, and left out of the program.

API 003

"/" (declaration) — Division/quotient in the declared domain; nonzero/finite-domain preconditions must hold, including Big_Integer-to-Big_Real quotient form.

Before this operation, establish:

Den /= To_Big_Integer (0)

Ghost: for contracts and ghost code, and left out of the program.

API 004

In_Range (declaration) — Test whether a numeric value is between the supplied bounds, inclusive.

Ghost: for contracts and ghost code, and left out of the program.

API 005

"=" (declaration) — Equality in this declared value/model domain; the family defines whether sequence order, set membership, map pairs or logical text contents are compared.

Ghost: for contracts and ghost code, and left out of the program.

API 006

"<" (declaration) — Numeric/domain ordering under this declaration; do not substitute it for model subset relations.

Ghost: for contracts and ghost code, and left out of the program.

API 007

"<=" (declaration) — The declared comparison: ordinary numeric order, sequence prefix, set inclusion or map-pair inclusion according to the parameter types.

Ghost: for contracts and ghost code, and left out of the program.

API 008

">" (declaration) — Numeric/domain greater-than comparison.

Ghost: for contracts and ghost code, and left out of the program.

API 009

">=" (declaration) — Numeric/domain greater-or-equal comparison.

Ghost: for contracts and ghost code, and left out of the program.

API 010

"-" (declaration) — Unary negation, subtraction, time difference or character-set difference according to the profile; their obligations differ.

Ghost: for contracts and ghost code, and left out of the program.

API 011

"abs" (declaration) — Absolute value in the declared numeric model.

Ghost: for contracts and ghost code, and left out of the program.

API 012

"+" (declaration) — Addition in the declared numeric/time domain; satisfy overflow/domain conditions of this overload.

Ghost: for contracts and ghost code, and left out of the program.

API 013

"-" (declaration) — Unary negation, subtraction, time difference or character-set difference according to the profile; their obligations differ.

Ghost: for contracts and ghost code, and left out of the program.

API 014

"*" (declaration) — Multiplication in numeric domains, or repeated Character construction for Natural*Character.

Ghost: for contracts and ghost code, and left out of the program.

API 015

"/" (declaration) — Division/quotient in the declared domain; nonzero/finite-domain preconditions must hold, including Big_Integer-to-Big_Real quotient form.

Before this operation, establish:

R /= To_Big_Real (To_Big_Integer (0))

Ghost: for contracts and ghost code, and left out of the program.

API 016

""** (declaration) — Exponentiation in the declared model: Natural or explicitly nonnegative Integer exponent, not arbitrary negative powers.

Before this operation, establish:

R >= 0

Ghost: for contracts and ghost code, and left out of the program.

API 017

Min (declaration) — Return the smaller compatible numeric/model value.

Ghost: for contracts and ghost code, and left out of the program.

API 018

Max (declaration) — Return the larger compatible numeric/model value.

Ghost: for contracts and ghost code, and left out of the program.