Frama-C:
Plug-ins:
Libraries:

Frama-C API - Rational

Implementation of the Field signature based on rational numbers.

  • since Frama-C+dev
include Field.S with type t = Q.t
include Datatype.S_with_collections with type t = Q.t
include Datatype.S with type t = Q.t
include Datatype.S_no_copy with type t = Q.t
val name : string

Unique name of the datatype.

val descr : t Descr.t

Datatype descriptor.

val packed_descr : Structural_descr.pack

Packed version of the descriptor.

val reprs : t list

List of representants of the descriptor.

val equal : t -> t -> bool
val compare : t -> t -> int

Comparison: same spec than Stdlib.compare.

val hash : t -> int

Hash function: same spec than Hashtbl.hash.

val pretty : Stdlib.Format.formatter -> t -> unit

Pretty print each value in an user-friendly way.

val mem_project : (Project_skeleton.t -> bool) -> t -> bool

mem_project f x must return true iff there is a value p of type Project.t in x such that f p returns true.

val copy : t -> t

Deep copy: no possible sharing between x and copy x.

module Set : Datatype.Set with type elt = t
module Map : Datatype.Map with type key = t
module Hashtbl : Datatype.Hashtbl with type key = t
type scalar = t

Useful constants in the field.

Two is provided for users that model floating point computations using abstractions over the field.

val zero : scalar
val one : scalar
val two : scalar
val pos_inf : scalar
val neg_inf : scalar

Constructors interacting with standard OCaml types.

val of_int : int -> scalar
val of_float : float -> scalar
val to_float : scalar -> float
val of_string : string -> scalar

Standard arithmetic unary operations.

val neg : scalar -> scalar
val abs : scalar -> scalar

Standard arithmetic binary operations.

val (+) : scalar -> scalar -> scalar
val (-) : scalar -> scalar -> scalar
val (*) : scalar -> scalar -> scalar
val (/) : scalar -> scalar -> scalar

Standard arithmetic relational operations.

val (=) : scalar -> scalar -> bool
val (!=) : scalar -> scalar -> bool
val (<=) : scalar -> scalar -> bool
val (<) : scalar -> scalar -> bool
val (>=) : scalar -> scalar -> bool
val (>) : scalar -> scalar -> bool

Other arithmetic operations.

val pow2 : int -> scalar

pow2 e computes the scalar 2 ^ e.

val log2 : scalar -> int Field.bounds

log2 f computes the integer l and u such as l = floor(log₂ f) and u = ceiling(log₂ f).

val sqrt : scalar -> scalar Field.bounds

sqrt f computes bounds of the square root of f.

val max : scalar -> scalar -> scalar
val min : scalar -> scalar -> scalar