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 {
// setting trait variables
trackRoundoffErrs = true
uniformPrecision = Float64
var uniformPrecision: Precision = Float64
// process relevant options
for (opt <- ctx.options) opt match {
......@@ -132,13 +132,13 @@ object RangeErrorPhase extends DaisyPhase with ErrorFunctions {
(rangeMethod, errorMethod) match {
case ("interval", "affine") =>
errorIntervalAffine(fnc.body.get, inputValMap, inputErrorMap)
errorIntervalAffine(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision)
case ("affine", "affine") =>
errorAffineAffine(fnc.body.get, inputValMap, inputErrorMap)
errorAffineAffine(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision)
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.
case ("subdiv", _) =>
......
......@@ -27,7 +27,7 @@ trait ErrorFunctions {
var trackRoundoffErrs: Boolean = true
var attachToTree: Boolean = false
var dynamicSamplesDefault: Int = 100000
var uniformPrecision: Precision = Float64
//var defaultUniformPrecision: Precision = Float64
var reporter: Reporter
val debugSection: DebugSection
......@@ -43,7 +43,8 @@ trait ErrorFunctions {
def errorIntervalAffine(
expr: Expr,
inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational]): Rational = {
inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision): Rational = {
val (_, error) = evaluate[Interval, AffineForm](
expr,
inputValMap,
......@@ -70,7 +71,8 @@ trait ErrorFunctions {
def errorAffineAffine(
expr: Expr,
inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational]): Rational = {
inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision): Rational = {
val (_, error) = evaluate[AffineForm, AffineForm](
expr,
inputValMap.map(x => (x._1 -> AffineForm(x._2))),
......@@ -97,7 +99,8 @@ trait ErrorFunctions {
def errorSMTAffine(
expr: Expr,
inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational]): Rational = {
inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision): Rational = {
val (_, error) = evaluate[SMTRange, AffineForm](
expr,
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