Commit c7d17945 authored by François Bobot's avatar François Bobot
Browse files

update dune version

parent a651a78a
S .
S extracted
S bench
B _build/
B _build/extracted
B _build/bench
PKG zarith
PKG core_bench
PKG compiler-libs
PKG utop
(library
(name farith)
(public_name farith)
(modules farith)
(libraries zarith farith_extracted)
(wrapped false)
)
(library
(name farith_big)
(public_name farith._big)
(modules farith_Big)
(libraries zarith)
(wrapped false)
)
(lang dune 1.0)
(library (
(library
(name farith_extracted)
(libraries (zarith farith_big))
(public_name farith._extracted)
(libraries zarith farith_big)
(wrapped false)
))
(flags "-w" "-33")
)
......@@ -74,9 +74,9 @@ module D = struct
let pp conf fmt x = pp fmt (cast_to_t conf x)
let of_string conf mode s =
let m,e = lex_float s in
finite conf mode m e
(* let of_string conf mode s =
* let m,e = lex_float s in
* finite conf mode m e *)
end
module type S = sig
......@@ -102,6 +102,7 @@ module type S = sig
val of_z : mode -> Z.t -> t (** Round. *)
val of_q : mode -> Q.t -> t (** Round. *)
val to_q : t -> Q.t (** Exact. *)
val conv : 't D.conf -> mode -> t -> 't
......@@ -165,6 +166,7 @@ end
module type Size =
sig
val mw : int (** mantissa size (in bits) *)
val ew : int (** exponent size (in bits) *)
end
......
......@@ -47,8 +47,11 @@ module D : sig
A value of this type is obtained by application of {!Farith.Make}
*)
val mw : 't conf -> int (** mantissa size *)
val ew : 't conf -> int (** exponent size *)
val mw : 't conf -> int
(** mantissa size *)
val ew : 't conf -> int
(** exponent size *)
(** {2 Total operators} *)
......@@ -72,6 +75,7 @@ module D : sig
(** Conversions from bitvector representation.
The given bitvector must be positive.
*)
val to_bits : 't conf -> 't -> Z.t
(** Convert the floating point to its bitvector representation *)
......@@ -263,8 +267,11 @@ end
module type Size =
sig
val mw : int (** mantissa size (in bits) *)
val ew : int (** exponent size (in bits) *)
val mw : int
(** mantissa size (in bits) *)
val ew : int
(** exponent size (in bits) *)
end
module Make (Size : Size) : S
......
......@@ -14,70 +14,69 @@
open Big_int_Z
type big_int = Big_int_Z.big_int
(** The type of big integers. *)
(* The type of big integers. *)
let zero = zero_big_int
(** The big integer [0]. *)
(* The big integer [0]. *)
let one = unit_big_int
(** The big integer [1]. *)
(* The big integer [1]. *)
let two = big_int_of_int 2
(** The big integer [2]. *)
(* The big integer [2]. *)
(** {6 Arithmetic operations} *)
(* {6 Arithmetic operations} *)
let opp = minus_big_int
(** Unary negation. *)
(* Unary negation. *)
let abs = abs_big_int
(** Absolute value. *)
(* Absolute value. *)
let add = add_big_int
(** Addition. *)
(* Addition. *)
let succ = succ_big_int
(** Successor (add 1). *)
(* Successor (add 1). *)
let add_int = add_int_big_int
(** Addition of a small integer to a big integer. *)
(* Addition of a small integer to a big integer. *)
let sub = sub_big_int
(** Subtraction. *)
(* Subtraction. *)
let pred = pred_big_int
(** Predecessor (subtract 1). *)
(* Predecessor (subtract 1). *)
let mult = mult_big_int
(** Multiplication of two big integers. *)
(* Multiplication of two big integers. *)
let mult_int = mult_int_big_int
(** Multiplication of a big integer by a small integer *)
let square = square_big_int
(** Return the square of the given big integer *)
(* Multiplication of a big integer by a small integer *)
let _square = square_big_int
(* Return the square of the given big integer *)
let sqrt = sqrt_big_int
(** [sqrt_big_int a] returns the integer square root of [a],
(* [sqrt_big_int a] returns the integer square root of [a],
that is, the largest big integer [r] such that [r * r <= a].
Raise [Invalid_argument] if [a] is negative. *)
let quomod = quomod_big_int
(** Euclidean division of two big integers.
(* Euclidean division of two big integers.
The first part of the result is the quotient,
the second part is the remainder.
Writing [(q,r) = quomod_big_int a b], we have
[a = q * b + r] and [0 <= r < |b|].
Raise [Division_by_zero] if the divisor is zero. *)
let div = div_big_int
(** Euclidean quotient of two big integers.
(* Euclidean quotient of two big integers.
This is the first result [q] of [quomod_big_int] (see above). *)
let modulo = mod_big_int
(** Euclidean modulus of two big integers.
(* Euclidean modulus of two big integers.
This is the second result [r] of [quomod_big_int] (see above). *)
let gcd = gcd_big_int
(** Greatest common divisor of two big integers. *)
(* Greatest common divisor of two big integers. *)
let power = power_big_int_positive_big_int
(** Exponentiation functions. Return the big integer
(* Exponentiation functions. Return the big integer
representing the first argument [a] raised to the power [b]
(the second argument). Depending
on the function, [a] and [b] can be either small integers
or big integers. Raise [Invalid_argument] if [b] is negative. *)
(** {6 Comparisons and tests} *)
(* {6 Comparisons and tests} *)
let sign = sign_big_int
(** Return [0] if the given big integer is zero,
(* Return [0] if the given big integer is zero,
[1] if it is positive, and [-1] if it is negative. *)
let compare = compare_big_int
(** [compare_big_int a b] returns [0] if [a] and [b] are equal,
(* [compare_big_int a b] returns [0] if [a] and [b] are equal,
[1] if [a] is greater than [b], and [-1] if [a] is smaller
than [b]. *)
let eq = eq_big_int
......@@ -85,27 +84,27 @@ let le = le_big_int
let ge = ge_big_int
let lt = lt_big_int
let gt = gt_big_int
(** Usual boolean comparisons between two big integers. *)
(* Usual boolean comparisons between two big integers. *)
let max = max_big_int
(** Return the greater of its two arguments. *)
(* Return the greater of its two arguments. *)
let min = min_big_int
(** Return the smaller of its two arguments. *)
(** {6 Conversions to and from strings} *)
(* Return the smaller of its two arguments. *)
(* {6 Conversions to and from strings} *)
let to_string = string_of_big_int
(** Return the string representation of the given big integer,
(* Return the string representation of the given big integer,
in decimal (base 10). *)
let of_string = big_int_of_string
(** Convert a string to a big integer, in decimal.
(* Convert a string to a big integer, in decimal.
The string consists of an optional [-] or [+] sign,
followed by one or several decimal digits. *)
(** {6 Conversions to and from other numerical types} *)
(* {6 Conversions to and from other numerical types} *)
let of_int = big_int_of_int
(** Convert a small integer to a big integer. *)
(* Convert a small integer to a big integer. *)
let is_int = is_int_big_int
(** Test whether the given big integer is small enough to
(* Test whether the given big integer is small enough to
be representable as a small integer (type [int])
without loss of precision. On a 32-bit platform,
[is_int_big_int a] returns [true] if and only if
......@@ -113,11 +112,11 @@ let is_int = is_int_big_int
[is_int_big_int a] returns [true] if and only if
[a] is between -2{^62} and 2{^62}-1. *)
let to_int = int_of_big_int
(** Convert a big integer to a small integer (type [int]).
(* Convert a big integer to a small integer (type [int]).
Raises [Failure "int_of_big_int"] if the big integer
is not representable as a small integer. *)
(** Functions used by extraction *)
(* Functions used by extraction *)
let double n = (Z.shift_left n 1)
let succ_double n = Z.succ (Z.shift_left n 1)
......@@ -216,8 +215,8 @@ let ldiff a b = Z.logand a (Z.lognot b)
module Z = Z (* zarith *)
(** Q *)
(** must be already normalize *)
(* Q *)
(* must be already normalize *)
let q_mk (den,num) = {Q.den; Q.num}
let q_case f q = f q.Q.den q.Q.num
let q_den q = q.Q.den
......
(library (
(name farith)
(modules (farith))
(libraries (zarith farith_extracted))
(wrapped false)
))
(library (
(name farith_big)
(modules (farith_Big))
(libraries (zarith))
(wrapped false)
))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment