package ocplib-simplex

  1. Overview
  2. Docs

Module Rat2.MakeSource

Parameters

Signature

Sourcemodule R = R

Type

Sourcetype t = private {
  1. v : R.t;
    (*

    The raw value of the bound.

    *)
  2. offset : R.t;
    (*

    The number of epsilons to add to the bound.

    *)
}

Constructors

Sourceval zero : t

The zero bound with no offset.

Sourceval of_r : R.t -> t

From a rational r, returns the Rat2 representation with no offset.

Sourceval upper : R.t -> t

From a rational r, returns r - Ɛ.

Sourceval lower : R.t -> t

From a rational r, returns r + Ɛ.

Algebraic operations

Sourceval minus : t -> t

From a bound r + kƐ, returns -r -kƐ.

Sourceval add : t -> t -> t

Adds two bounds.

Sourceval sub : t -> t -> t

Substracts two bounds.

Sourceval mult : t -> t -> t

Multiplies two bounds.

Sourceval mult_by_const : R.t -> t -> t

Multiplies a bound by a rational constant (both v and offset are multiplied).

Sourceval div_by_const : R.t -> t -> t

Divides a bound by a constant. Fails if the constant is zero.

Comparison functions

Sourceval compare : t -> t -> int

Compares two bounds; returns 0 iff the two bounds are strictly equal.

Sourceval equal : t -> t -> bool

Returns true iff the bounds are strictly equal.

Sourceval is_zero : t -> bool

Returns true iff the bound in argument is zero.

Sourceval is_pure_rational : t -> bool

Returns true iff the offset is 0.

Sourceval is_int : t -> bool

Returns true iff the offset is 0 and the field v is an integer.

Misc

Sourceval floor : t -> t

Returns the greatest (pure) integer smaller or equal to the argument.

Sourceval ceiling : t -> t

Returns the smallest (pure) integer greater or equal to the argument.

Sourceval print : Format.formatter -> t -> unit

Prints a bound.

OCaml

Innovation. Community. Security.