Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
FloVer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
AVA
FloVer
Commits
cc169913
Commit
cc169913
authored
Feb 06, 2018
by
Heiko Becker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new code for computation of real literal error, commented out
parent
3dd47a73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
5 deletions
+38
-5
src/main/scala/daisy/tools/RoundoffEvaluators.scala
src/main/scala/daisy/tools/RoundoffEvaluators.scala
+38
-5
No files found.
src/main/scala/daisy/tools/RoundoffEvaluators.scala
View file @
cc169913
...
...
@@ -11,6 +11,40 @@ import daisy.utils.CachingMap
trait
RoundoffEvaluators
extends
RangeEvaluators
{
/**
* Calculates the roundoff error for a given uniform precision
* using interval arithmetic for ranges and affine arithmetic for errors.
*
* @param expr expression for which to compute roundoff
* @param inputValMap real-valued ranges of all input variables
* @param inputErrorMap errors of all input variables (incl. roundoff)
* @param uniformPrecision precision for the entire computation
*
* @return (max. absolute roundoff error bound, real-valued result interval)
*/
def
uniformRoundoff_IA_IA
(
expr
:
Expr
,
inputValMap
:
Map
[
Identifier
,
Interval
],
inputErrorMap
:
Map
[
Identifier
,
Rational
],
uniformPrecision
:
Precision
,
trackRoundoffErrors
:
Boolean
=
true
,
approxRoundoff
:
Boolean
=
false
)
:
(
Rational
,
Interval
)
=
{
val
(
resRange
,
intermediateRanges
)
=
evalRange
[
Interval
](
expr
,
inputValMap
,
Interval
.
apply
)
val
(
resRoundoff
,
_
)
=
evalRoundoff
[
Interval
](
expr
,
intermediateRanges
,
Map
.
empty
.
withDefaultValue
(
uniformPrecision
),
inputErrorMap
.
mapValues
(
Interval
.+/-),
zeroError
=
Interval
.
zero
,
fromError
=
Interval
.+/-,
interval2T
=
Interval
.
apply
,
constantsPrecision
=
uniformPrecision
,
trackRoundoffErrors
,
approxRoundoff
)
(
Interval
.
maxAbs
(
resRoundoff
.
toInterval
),
resRange
)
}
/**
* Calculates the roundoff error for a given uniform precision
* using interval arithmetic for ranges and affine arithmetic for errors.
...
...
@@ -172,14 +206,13 @@ trait RoundoffEvaluators extends RangeEvaluators {
def
eval
(
e
:
Expr
)
:
(
T
,
Precision
)
=
intermediateErrors
.
getOrAdd
(
e
,
{
case
x
@
RealLiteral
(
r
)
=>
val
rndoff
=
//if (
isExactInFloats(r, constantsPrecision
) || !trackRoundoffErrors) {
val
error
=
//if (
constantsPrecision.canRepresent(r
) || !trackRoundoffErrors) {
//zeroError
//} else {
//} else {
fromError
(
constantsPrecision
.
absRoundoff
(
r
))
//}
intermediateErrors
+=
x
->
(
rndoff
,
constantsPrecision
)
(
rndoff
,
constantsPrecision
)
(
error
,
constantsPrecision
)
case
x
@
Plus
(
lhs
,
rhs
)
=>
val
(
errorLhs
,
precLhs
)
=
eval
(
lhs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment