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
0c0178c7
Commit
0c0178c7
authored
1 month ago
by
Maxime Jacquemin
Committed by
David Bühler
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
[Kernel] Updating the documentation of Typed_float.
parent
f2a0527e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libraries/floating_point/floating_point.c
+4
-1
4 additions, 1 deletion
src/libraries/floating_point/floating_point.c
src/libraries/floating_point/typed_float.mli
+9
-13
9 additions, 13 deletions
src/libraries/floating_point/typed_float.mli
with
13 additions
and
14 deletions
src/libraries/floating_point/floating_point.c
+
4
−
1
View file @
0c0178c7
...
...
@@ -88,7 +88,10 @@ value frama_c_get_round_mode(value _) {
}
// Floating-point formats supported by Frama-C. Must be synchronized with
// the ['f format] type of the [Floating_point] module.
// the ['f format] type of the [Floating_point] module, in the sens that it
// must contain at least one value for each constructor of ['f format], and
// those values have to be in the same order. For now, there is also a [Long]
// value, which is not yet used, but will probably be in the future.
typedef
enum
{
Single
,
Double
,
Long
}
precision
;
// Convert the Frama-C format into a precision.
...
...
This diff is collapsed.
Click to expand it.
src/libraries/floating_point/typed_float.mli
+
9
−
13
View file @
0c0178c7
...
...
@@ -25,21 +25,14 @@
The goal of this module is to provide a representation of floating-point
numbers that statically encode the format of the represented number. As
for now, the numbers are represented using the OCaml [float] type (which
are in the [binary64] format) and thus, all operations for the [Long]
format (or [binary80]) are unsound as they are performed using the
[binary64] format instead of [binary80] for x86 architectures.
are in the [binary64] format) and thus, the [Long] format (or [binary80])
is not yet supported.
This is TEMPORARY, and does not break anything in Frama-C as the historical
way of handling the [Long] format was to use the OCaml [float] type. Future
improvements of this module WILL INCLUDE a correct way to perform
computations in the [Long] format.
The main feature of this module currently used by Frama-C is the [parse]
function, which returns a witness that specifies the format one would like
to use and the one actually used to encode the parsed floating point number.
The format is nevertheless presents because Frama-C still needs to be able
to differentiate between the two formats. In particular, the parsing
process must be able to infer the correct format to store the
corresponding [fkind], and the logic must know the correct [fkind] to emit
relevant warnings that partially alleviate the incorrectness resulting
from Frama-C encoding of [Long] numbers. *)
@since Frama-C+dev *)
...
...
@@ -137,6 +130,9 @@ type 'f parsed_float =
;
format
:
'
f
format
}
(** A witness encoding the floating-point format represented by the string,
and the format actually used to parse it. For now, Long format is not
supported by this module, and is thus approximated using double precision. *)
type
(
'
format
,
'
encoded_as
)
parsed_format
=
|
Single_supported
:
(
single
,
single
)
parsed_format
|
Double_supported
:
(
double
,
double
)
parsed_format
...
...
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