Commit 8b7ef425 authored by Eva Darulova's avatar Eva Darulova
Browse files

removing default precision in ErrorFunctions as this is bound to lead to unwanted bugs

parent 9fae1946
...@@ -51,7 +51,7 @@ object RangeErrorPhase extends DaisyPhase with ErrorFunctions { ...@@ -51,7 +51,7 @@ object RangeErrorPhase extends DaisyPhase with ErrorFunctions {
// setting trait variables // setting trait variables
trackRoundoffErrs = true trackRoundoffErrs = true
uniformPrecision = Float64 var uniformPrecision: Precision = Float64
// process relevant options // process relevant options
for (opt <- ctx.options) opt match { for (opt <- ctx.options) opt match {
...@@ -132,13 +132,13 @@ object RangeErrorPhase extends DaisyPhase with ErrorFunctions { ...@@ -132,13 +132,13 @@ object RangeErrorPhase extends DaisyPhase with ErrorFunctions {
(rangeMethod, errorMethod) match { (rangeMethod, errorMethod) match {
case ("interval", "affine") => case ("interval", "affine") =>
errorIntervalAffine(fnc.body.get, inputValMap, inputErrorMap) errorIntervalAffine(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision)
case ("affine", "affine") => case ("affine", "affine") =>
errorAffineAffine(fnc.body.get, inputValMap, inputErrorMap) errorAffineAffine(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision)
case ("smt", "affine") => case ("smt", "affine") =>
errorSMTAffine(fnc.body.get, inputValMap, inputErrorMap) errorSMTAffine(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision)
// default is to use the method that attaches the info to trees. // default is to use the method that attaches the info to trees.
case ("subdiv", _) => case ("subdiv", _) =>
......
...@@ -27,7 +27,7 @@ trait ErrorFunctions { ...@@ -27,7 +27,7 @@ trait ErrorFunctions {
var trackRoundoffErrs: Boolean = true var trackRoundoffErrs: Boolean = true
var attachToTree: Boolean = false var attachToTree: Boolean = false
var dynamicSamplesDefault: Int = 100000 var dynamicSamplesDefault: Int = 100000
var uniformPrecision: Precision = Float64 //var defaultUniformPrecision: Precision = Float64
var reporter: Reporter var reporter: Reporter
val debugSection: DebugSection val debugSection: DebugSection
...@@ -43,7 +43,8 @@ trait ErrorFunctions { ...@@ -43,7 +43,8 @@ trait ErrorFunctions {
def errorIntervalAffine( def errorIntervalAffine(
expr: Expr, expr: Expr,
inputValMap: Map[Identifier, Interval], inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational]): Rational = { inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision): Rational = {
val (_, error) = evaluate[Interval, AffineForm]( val (_, error) = evaluate[Interval, AffineForm](
expr, expr,
inputValMap, inputValMap,
...@@ -70,7 +71,8 @@ trait ErrorFunctions { ...@@ -70,7 +71,8 @@ trait ErrorFunctions {
def errorAffineAffine( def errorAffineAffine(
expr: Expr, expr: Expr,
inputValMap: Map[Identifier, Interval], inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational]): Rational = { inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision): Rational = {
val (_, error) = evaluate[AffineForm, AffineForm]( val (_, error) = evaluate[AffineForm, AffineForm](
expr, expr,
inputValMap.map(x => (x._1 -> AffineForm(x._2))), inputValMap.map(x => (x._1 -> AffineForm(x._2))),
...@@ -97,7 +99,8 @@ trait ErrorFunctions { ...@@ -97,7 +99,8 @@ trait ErrorFunctions {
def errorSMTAffine( def errorSMTAffine(
expr: Expr, expr: Expr,
inputValMap: Map[Identifier, Interval], inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational]): Rational = { inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision): Rational = {
val (_, error) = evaluate[SMTRange, AffineForm]( val (_, error) = evaluate[SMTRange, AffineForm](
expr, expr,
inputValMap.map({ case (id, int) => (id -> SMTRange(Variable(id), int)) }), inputValMap.map({ case (id, int) => (id -> SMTRange(Variable(id), int)) }),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment