Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
4a35a5c2
Commit
4a35a5c2
authored
1 month ago
by
Maxime Jacquemin
Browse files
Options
Downloads
Patches
Plain Diff
[Kernel] Add comments in field.ml
parent
b16cfe1b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libraries/arithmetic/field.ml
+28
-6
28 additions, 6 deletions
src/libraries/arithmetic/field.ml
with
28 additions
and
6 deletions
src/libraries/arithmetic/field.ml
+
28
−
6
View file @
4a35a5c2
...
...
@@ -20,6 +20,16 @@
(* *)
(**************************************************************************)
(** This module provides a generic signature describing mathematical fields,
i.e algebraic structure that behave like rationals, reals or complex
numbers. The signature also provides several functions that are not
directly part of fields definition, but are useful nonetheless, in
particular when using fields to model floating point computations.
@since Frama-C+dev *)
(** This type is used to return bounds for mathematical functions that
cannot be exactly computed using rationals, like the square root
for instance. *)
type
'
t
bounds
=
{
lower
:
'
t
;
upper
:
'
t
}
module
type
S
=
sig
...
...
@@ -27,31 +37,43 @@ module type S = sig
include
Datatype
.
S_with_collections
type
scalar
=
t
(** Useful constants in the field. Two is provided for users that model
floating point computations using abstractions over the field. *)
val
zero
:
scalar
val
one
:
scalar
val
two
:
scalar
val
pos_inf
:
scalar
val
neg_inf
:
scalar
(** Constructors interacting with standard OCaml types. *)
val
of_int
:
int
->
scalar
val
of_float
:
float
->
scalar
val
to_float
:
scalar
->
float
val
of_string
:
string
->
scalar
(** Standard arithmetic unary operations. *)
val
neg
:
scalar
->
scalar
val
abs
:
scalar
->
scalar
val
max
:
scalar
->
scalar
->
scalar
val
min
:
scalar
->
scalar
->
scalar
val
pow2
:
int
->
scalar
val
log2
:
scalar
->
int
bounds
val
sqrt
:
scalar
->
scalar
bounds
(** Standard arithmetic binary operations. *)
val
(
+
)
:
scalar
->
scalar
->
scalar
val
(
-
)
:
scalar
->
scalar
->
scalar
val
(
*
)
:
scalar
->
scalar
->
scalar
val
(
/
)
:
scalar
->
scalar
->
scalar
(** [pow2 e] computes the scalar [2 ^ e]. *)
val
pow2
:
int
->
scalar
(** [log2 f] computes the integer [l] and [u] such as
[l = floor(log₂ f)] and [u = ceiling(log₂ f)]. *)
val
log2
:
scalar
->
int
bounds
(** [sqrt f] computes bounds of the square root of [f]. *)
val
sqrt
:
scalar
->
scalar
bounds
val
max
:
scalar
->
scalar
->
scalar
val
min
:
scalar
->
scalar
->
scalar
val
(
=
)
:
scalar
->
scalar
->
bool
val
(
!=
)
:
scalar
->
scalar
->
bool
val
(
<=
)
:
scalar
->
scalar
->
bool
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment