mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
Add infix operators to CCFloat
This commit is contained in:
parent
62ba3c00af
commit
dabb7de24a
3 changed files with 23 additions and 0 deletions
|
|
@ -28,3 +28,4 @@
|
||||||
- Rand (@rand00)
|
- Rand (@rand00)
|
||||||
- Dave Aitken (@actionshrimp)
|
- Dave Aitken (@actionshrimp)
|
||||||
- Etienne Millon (@emillon)
|
- Etienne Millon (@emillon)
|
||||||
|
- Christopher Zimmermann (@madroach)
|
||||||
|
|
|
||||||
|
|
@ -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 = ( *. )
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue