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
13eb8d94
Commit
13eb8d94
authored
5 years ago
by
David Bühler
Committed by
Andre Maroneze
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Eva] Eval_terms: minor simplification by creating and using efloat as ereal.
parent
7847868f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/value/legacy/eval_terms.ml
+12
-12
12 additions, 12 deletions
src/plugins/value/legacy/eval_terms.ml
with
12 additions
and
12 deletions
src/plugins/value/legacy/eval_terms.ml
+
12
−
12
View file @
13eb8d94
...
...
@@ -446,9 +446,13 @@ let einteger v =
(* Note: some reals cannot be exactly represented as floats; in which
case we do not know their under-approximation. *)
let
ereal
v
=
let
efloating_point
etype
fval
=
let
v
=
V
.
inject_float
fval
in
let
eunder
=
under_from_over
v
in
{
etype
=
Cil
.
doubleType
;
eunder
;
eover
=
v
;
ldeps
=
empty_logic_deps
}
{
etype
;
eunder
;
eover
=
v
;
ldeps
=
empty_logic_deps
}
let
ereal
=
efloating_point
Cil
.
doubleType
let
efloat
=
efloating_point
Cil
.
floatType
let
is_true
=
function
|
`True
|
`TrueReduced
_
->
true
...
...
@@ -725,7 +729,7 @@ let rec eval_term ~alarm_mode env t =
let
r_lower
=
Fval
.
F
.
of_float
r_lower
in
let
r_upper
=
Fval
.
F
.
of_float
r_upper
in
let
f
=
Fval
.
inject
Fval
.
Real
r_lower
r_upper
in
ereal
(
V
.
inject_ival
(
Ival
.
inject_float
f
))
ereal
f
end
(* | TConst ((CStr | CWstr) Missing cases *)
...
...
@@ -745,17 +749,13 @@ let rec eval_term ~alarm_mode env t =
eover
=
loc_bits_to_loc_bytes
r
.
eover
}
(* Special case for the constants \pi, \e, \infinity and \NaN. *)
|
TLval
(
TVar
{
lv_name
=
"
\\
pi"
}
,
_
)
->
ereal
(
V
.
inject_float
Fval
.
pi
)
|
TLval
(
TVar
{
lv_name
=
"
\\
e"
}
,
_
)
->
ereal
(
V
.
inject_float
Fval
.
e
)
|
TLval
(
TVar
{
lv_name
=
"
\\
pi"
}
,
_
)
->
ereal
Fval
.
pi
|
TLval
(
TVar
{
lv_name
=
"
\\
e"
}
,
_
)
->
ereal
Fval
.
e
|
TLval
(
TVar
{
lv_name
=
"
\\
plus_infinity"
}
,
_
)
->
let
v
=
V
.
inject_float
(
Fval
.
pos_infinity
Float_sig
.
Single
)
in
{
etype
=
Cil
.
floatType
;
eunder
=
v
;
eover
=
v
;
ldeps
=
empty_logic_deps
}
efloat
Fval
.(
pos_infinity
Single
)
|
TLval
(
TVar
{
lv_name
=
"
\\
minus_infinity"
}
,
_
)
->
let
v
=
V
.
inject_float
(
Fval
.
neg_infinity
Float_sig
.
Single
)
in
{
etype
=
Cil
.
floatType
;
eunder
=
v
;
eover
=
v
;
ldeps
=
empty_logic_deps
}
|
TLval
(
TVar
{
lv_name
=
"
\\
NaN"
}
,
_
)
->
let
v
=
V
.
inject_float
Fval
.
nan
in
{
etype
=
Cil
.
floatType
;
eunder
=
v
;
eover
=
v
;
ldeps
=
empty_logic_deps
}
efloat
Fval
.(
neg_infinity
Single
)
|
TLval
(
TVar
{
lv_name
=
"
\\
NaN"
}
,
_
)
->
efloat
Fval
.
nan
|
TLval
_
->
let
lval
=
eval_tlval
~
alarm_mode
env
t
in
...
...
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