package mlpost

  1. Overview
  2. Docs

Abstract numeric values

Numerics are a symbolic representation of numeric values. In many cases, but not always, an object of type Num.t is intended to be a length in some unit. In addition, values of type Num.t may actually be unknown to Mlpost. This is why there is no function that gives back a float.

type t = float

The Mlpost numeric type is an abstract datatype

Conversion functions

val of_float : float -> t

Convert a float into a Num.t

val bp : float -> t

The base unit in Mlpost is bp.

val pt : float -> t

pt are PostScript points. This is the same unit as the pt unit in TeX

val cm : float -> t
val mm : float -> t
val inch : float -> t

The following are units dependent of the font used

val em : float -> t

the width of an "m"

val ex : float -> t

the height of an "x"

Useful operations on Nums

val addn : t -> t -> t
val subn : t -> t -> t
val multn : t -> t -> t
val multf : float -> t -> t
val divf : t -> float -> t
val neg : t -> t
val divn : t -> t -> t
val maxn : t -> t -> t
val minn : t -> t -> t
val gmean : t -> t -> t

the geometric mean of two nums : sqrt(a * a + b * b)

val if_null : t -> t -> t -> t

if_null n n1 n2 is equal to n1 if n is null, n2 othewise

Infix operators

module Infix : sig ... end

Infix symbols for convenience

Useful constants and functions

val zero : t
val one : t
val two : t

Shortcuts for bp 0., bp 1. and bp 2..

val pi : float

3 .14159

val deg2rad : float -> float

3 .14159

Converts degrees into radians

type scale = float -> t
module Scale : sig ... end