Add infix operators to CCFloat

This commit is contained in:
Christopher Zimmermann 2018-02-17 19:14:06 +01:00
parent 62ba3c00af
commit dabb7de24a
3 changed files with 23 additions and 0 deletions

View file

@ -28,3 +28,4 @@
- Rand (@rand00) - Rand (@rand00)
- Dave Aitken (@actionshrimp) - Dave Aitken (@actionshrimp)
- Etienne Millon (@emillon) - Etienne Millon (@emillon)
- Christopher Zimmermann (@madroach)

View file

@ -16,6 +16,11 @@ module Infix = struct
let (>) = Pervasives.(>) let (>) = Pervasives.(>)
let (<=) = Pervasives.(<=) let (<=) = Pervasives.(<=)
let (>=) = Pervasives.(>=) let (>=) = Pervasives.(>=)
let (~-) = Pervasives.(~-.)
let (+) = Pervasives.(+.)
let (-) = Pervasives.(-.)
let ( * ) = Pervasives.( *. )
let (/) = Pervasives.(/.)
end end
include Infix include Infix
@ -35,6 +40,8 @@ let is_nan x = (x : t) <> x
let add = (+.) let add = (+.)
let sub = (-.) let sub = (-.)
let mul = ( *. )
let div = (/.)
let neg = (~-.) let neg = (~-.)
let abs = Pervasives.abs_float let abs = Pervasives.abs_float
let scale = ( *. ) let scale = ( *. )

View file

@ -130,6 +130,21 @@ module Infix : sig
val (>=) : t -> t -> bool val (>=) : t -> t -> bool
(** @since 0.17 *) (** @since 0.17 *)
val (+) : t -> t -> t
(** Addition. @since NEXT_RELEASE *)
val (-) : t -> t -> t
(** Subtraction. @since NEXT_RELEASE *)
val (~-) : t -> t
(** Unary negation. @since NEXT_RELEASE *)
val ( * ) : t -> t -> t
(** Multiplication. @since NEXT_RELEASE *)
val (/) : t -> t -> t
(** Division. @since NEXT_RELEASE *)
end end
include module type of Infix include module type of Infix