package tezos-protocol-012-Psithaca

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A signature for modules implementing a fixed-point arithmetic.

Fixed-point types come in two flavours:

  • integral (marked with integral_tag), behaving like integers;
  • fp (marked with fp_tag), allowing for fractions.

Such numbers represent standard arithmetic, rounding (converting fp flavour to integral one) and comparisons (which can work across flavours).

type 'a t
type fp = fp_tag t
type integral = integral_tag t
val integral_of_int_exn : int -> integral
val zero : 'a t
val add : 'a t -> 'a t -> 'a t
val sub : 'a t -> 'a t -> 'a t
val ceil : fp -> integral
val floor : fp -> integral
val fp : 'a t -> fp
val (=) : 'a t -> 'b t -> bool
val (<>) : 'a t -> 'b t -> bool
val (<) : 'a t -> 'b t -> bool
val (<=) : 'a t -> 'b t -> bool
val (>=) : 'a t -> 'b t -> bool
val (>) : 'a t -> 'b t -> bool
val compare : 'a t -> 'b t -> int
val equal : 'a t -> 'b t -> bool
val max : 'a t -> 'a t -> 'a t
val min : 'a t -> 'a t -> 'a t