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)
|
||||
- Dave Aitken (@actionshrimp)
|
||||
- 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.(/.)
|
||||
end
|
||||
include Infix
|
||||
|
||||
|
|
@ -35,6 +40,8 @@ let is_nan x = (x : t) <> x
|
|||
|
||||
let add = (+.)
|
||||
let sub = (-.)
|
||||
let mul = ( *. )
|
||||
let div = (/.)
|
||||
let neg = (~-.)
|
||||
let abs = Pervasives.abs_float
|
||||
let scale = ( *. )
|
||||
|
|
|
|||
|
|
@ -130,6 +130,21 @@ module Infix : sig
|
|||
|
||||
val (>=) : t -> t -> bool
|
||||
(** @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
|
||||
|
||||
include module type of Infix
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue