package core

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

Module Percent.Almost_round_trippableSource

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%"
Sourcetype nonrec t = t
include Sexplib0.Sexpable.S with type t := t
Sourceval t_of_sexp : Sexplib0.Sexp.t -> t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
Sourceval to_string : t -> Base.String.t
Sourceval of_string : Base.String.t -> t
Sourcemodule 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.