package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=37966e98ffeebcedc09bd6e9b2b81f69
sha512=40d4d826c25f680766c07eccbabdf5e8a4fa023016e8a164e4e4f6b3781c8484dc4df437055721dfd19b9db8fb7fe3b61236c4833186d346fc7204a68d01eaaa
doc/mopsa.mopsa_utils/Mopsa_utils/ItvUtils/FloatItv/index.html
Module ItvUtils.FloatItv
FloatItv - Floating-point interval arithmetics with rounding.
We rely on C code to provide functions with correct rounding (rounding direction and rounding precision).
module F = Floatmodule B = ItvUtils.IntBoundmodule II = ItvUtils.IntItvTypes
The type of non-empty intervals: a lower bound and an upper bound. The bounds can be -∞ and +∞. In particular, we can have -∞,-∞ and +∞,+∞ (useful to model sets of floating-point numbers). We must have lo ≤ up. The bounds shall not be NaN.
type t_with_bot = t Core.Bot.with_botThe type of possibly empty intervals.
val is_valid : t -> boolConstructors
val mk : float -> float -> tval zero : tval one : tval two : tval mone : tval zero_one : tval mone_zero : tval mone_one : tval mhalf_half : tval zero_inf : tval minf_zero : tval minf_inf : tUseful intervals
val of_float : float -> float -> tConstructs a non-empty interval. We must have lo ≤ up, or an exception is raised. NaN bounds are transformed into infinities.
val of_float_bot : float -> float -> t_with_botConstructs a possibly empty interval (no rounding). NaN bounds are transformed into infinities.
val hull : float -> float -> tConstructs the smallest interval containing a and b.
val cst : float -> tSingleton interval.
Predicates
val equal_bot : t_with_bot -> t_with_bot -> boolval included_bot : t_with_bot -> t_with_bot -> boolval intersect_bot : t_with_bot -> t_with_bot -> boolval contains : float -> t -> boolWhether the interval contains a certain value.
A total ordering of intervals (lexical ordering) returning -1, 0, or 1. Can be used as compare for sets, maps, etc. (The hypothesis that bounds cannot be NaN is important to make the order total.
val compare_bot : t Core.Bot.with_bot -> t Core.Bot.with_bot -> intTotal ordering on possibly empty intervals.
val is_zero : t -> boolval is_positive : t -> boolval is_negative : t -> boolval is_positive_strict : t -> boolval is_negative_strict : t -> boolval is_nonzero : t -> boolInterval sign.
val contains_positive : t -> boolval contains_negative : t -> boolval contains_positive_strict : t -> boolval contains_negative_strict : t -> boolval contains_zero : t -> boolval contains_nonzero : t -> boolWhether the interval contains an element of the specified sign.
val is_singleton : t -> boolWhether the interval contains a single element.
val is_bounded : t -> boolWhether the interval has finite bounds.
val is_in_range : t -> float -> float -> boolWhether the interval is included in the range lo,up.
C comparison tests. Returns true if the test may succeed, false if it cannot.
Printing
type print_format = F.print_formatval dfl_fmt : F.print_formatval hex_fmt : F.print_formatval to_string : print_format -> t -> stringval print : print_format -> out_channel -> t -> unitval fprint : print_format -> Format.formatter -> t -> unitval bprint : print_format -> Buffer.t -> t -> unitval to_string_bot : print_format -> t Core.Bot.with_bot -> stringval print_bot : print_format -> out_channel -> t Core.Bot.with_bot -> unitval fprint_bot :
print_format ->
Format.formatter ->
t Core.Bot.with_bot ->
unitval bprint_bot : print_format -> Buffer.t -> t Core.Bot.with_bot -> unitOperations without rounding
val fmod : t -> t -> t_with_botRemainder (fmod).
val to_int_itv : t -> II.t Core.Bot.with_botval join_bot : t_with_bot -> t_with_bot -> t_with_botJoin of possibly empty intervals.
val join_list : t list -> t_with_botJoin of a list of (non-empty) intervals.
val meet : t -> t -> t_with_botIntersection of non-emtpty intervals (possibly empty)
val meet_bot : t_with_bot -> t_with_bot -> t_with_botIntersection of possibly empty intervals.
val meet_list : t list -> t_with_botMeet of a list of (non-empty) intervals.
val positive : t -> t_with_botval negative : t -> t_with_botPositive and negative part.
val meet_zero : t -> t_with_botIntersects with
.
val widen_bot : t_with_bot -> t_with_bot -> t_with_botval bwd_default_unary : t -> t -> t_with_botFallback for backward unary operators
Fallback for backward binary operators
val bwd_neg : t -> t -> t_with_botBackward negation.
val bwd_abs : t -> t -> t_with_botBackward absolute value.
Rounding-dependent functions
Interval operations support six rounding modes. The first four correspond to rounding both bounds in the same direction: to nearest, upwards, downards, or to zero. To this, we add outer rounding (lower bound downwards and upper bound upwards) and inner rounding (lower bound upwards and upper bound downwards).
Rounding can be performed for single-precision or double-precision.
Outer interval arithmetic can model soundly real arithmetic. In this case, infinities model unbounded intervals.
Directed roundings and outer arithmetics can model soundly float arithmetic. In this case, infinite bounds signal the precence of infinite float values. Directed roundings can produce -∞,-∞ or +∞,+∞ (denoting a set of floats reduced to an infinite float).
Inner rounding can return empty intervals. Divisions and square roots can return empty intervals for any rounding mode.
We do not track NaN. NaN bounds, as in -∞,-∞ + +∞,+∞, are transformed into infinities.
val mkop : unit -> tval wrap_op1_bot : ('a -> t -> 'b) -> 'a -> t Core.Bot.with_botval wrap_op2_bot : ('a -> 'b -> t -> 'c) -> 'a -> 'b -> t Core.Bot.with_botval wrap_sqrt :
(float -> float) ->
(float -> float) ->
t ->
t Core.Bot.with_botval wrap_div_unmerged_bot :
('a -> t -> 'b Core.Bot.with_bot) ->
'a ->
t ->
'b listval wrap_div : ('a -> t -> t) -> 'a -> t -> t_with_botval wrap_div_bot : ('a -> t -> t Core.Bot.with_bot) -> 'a -> t -> t_with_botmodule Double : sig ... endIntervals with rounding to double.
module Single : sig ... endIntervals with rounding to float.
Operations with rounding mode as argument
type prec = [ | `SINGLE(*32-bit single precision
*)| `DOUBLE(*64-bit double precision
*)| `REAL(*real arithmetic (outward double rounding is used)
*)
]Precision.
type round = [ | `NEAR(*To nearest
*)| `UP(*Upwards
*)| `DOWN(*Downwards
*)| `ZERO(*Towards 0
*)| `ANY(*Any rounding mode
*)
]Rounding direction. This is ignored for real arithmetic.
val div : prec -> round -> t -> t -> t_with_botDivision.
Division. Returns a list of intervals to remain precise.
val sqrt : prec -> round -> t -> t_with_botSquare root.
val meet_nonzero : prec -> t -> t Core.Bot.with_botval bwd_round_int : prec -> round -> t -> t -> t_with_botBackward rounding to integer.
val bwd_round : prec -> round -> t -> t -> t_with_botBackward rounding to float.
val bwd_square : prec -> round -> t -> t -> t_with_botBackward square.
val bwd_sqrt : prec -> round -> t -> t -> t_with_botBackward square root.
Backward conversion from int.
val bwd_to_z : prec -> Z.t -> Z.t -> t -> t_with_botBackward conversion to integer.