package core

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

Similar to Stable.V3, but rounds to 14 significant digits in order to make the output more palatable to humans, at the cost of making it not exactly round-trippable, e.g.

Percent.Stable.V3.to_string (Percent.of_percentage 17.13) = "17.129999999999998%"

(this is because of the 17.13 /. 100. float division hidden in Percent.of_percentage). But:

Percent.Almost_round_trippable.to_string (Percent.of_percentage 17.13) = "17.13%"
type nonrec t = t
include Sexplib0.Sexpable.S with type t := t
val t_of_sexp : Sexplib0__.Sexp.t -> t
val sexp_of_t : t -> Sexplib0__.Sexp.t
val to_string : t -> Base.String.t
val of_string : Base.String.t -> t
module Always_percentage : sig ... end

A variant with alternative serialization, which always uses the % format, regardless of the absolute value of t. Fully inter-operable with Percent.Almost_round_trippable.t: either can read the other's output and the precision is exactly the same for both.

OCaml

Innovation. Community. Security.