Commit c8288af4 authored by ='s avatar =

Fixes 10/16 comments

parent 93c93964
......@@ -30,6 +30,7 @@ hol4/*/.*
hol4/heap
hol4/output/heap
hol4/output/certificate_*
./daisy
rawdata/*
.ensime*
/daisy
......
......@@ -42,7 +42,7 @@ case class Context(
// encoding the analysis result
intermediateAbsoluteErrors: Map[Identifier, Map[Expr, Rational]]= Map(),
intermediateRanges: Map[Identifier, Map[Expr, Interval]] = Map(),
precision: Map[Identifier, Map[Identifier, FinitePrecision.Precision]] = Map(),
precisions: Map[Identifier, Map[Identifier, FinitePrecision.Precision]] = Map(),
constantPrecision: FinitePrecision.Precision = FinitePrecision.Float64,
// the analysed/computed roundoff errors for each function
......
......@@ -202,14 +202,14 @@ object Main {
} else if (ctx.findOption(optionValidators) != None) {
analysis.SpecsProcessingPhase andThen
transform.SSATransformerPhase andThen
analysis.ChoosePrecisionPhase andThen
analysis.AssignMixedPrecisionPhase andThen
analysis.RangeErrorPhase andThen
InfoPhase andThen
backend.CertificatePhase andThen
backend.CodeGenerationPhase
} else {
analysis.SpecsProcessingPhase andThen
analysis.ChoosePrecisionPhase andThen
analysis.AssignMixedPrecisionPhase andThen
analysis.RangeErrorPhase andThen
InfoPhase
}
......
......@@ -15,18 +15,18 @@ import lang.Identifiers._
import lang.TreeOps.allVariablesOf
object ChoosePrecisionPhase extends DaisyPhase {
object AssignMixedPrecisionPhase extends DaisyPhase {
override val name = "Choose Precision"
override val name = "Mixed-precision assignment phase"
override val description = "Chooses the precision of each variable"
var reporter: Reporter = null
override def run(ctx:Context, prg:Program): (Context, Program) = {
override def run(ctx: Context, prg: Program): (Context, Program) = {
reporter = ctx.reporter
reporter.info(s"\nStarting $name phase")
val timer = ctx.timers.chooseprecision.start
val timer = ctx.timers.assignMixedPrecision.start
val fncsToConsider: Seq[String] = functionsToConsider(ctx, prg)
......@@ -38,8 +38,9 @@ object ChoosePrecisionPhase extends DaisyPhase {
case _ =>
}
if(randomMP && precFile != "")
if(randomMP && precFile != "") {
reporter.fatalError("You can only use precFile XOR randomMP.")
}
var varPrecisionMap: Map[Identifier, Map[Identifier, Precision]] = Map()
......@@ -48,10 +49,11 @@ object ChoosePrecisionPhase extends DaisyPhase {
if(precFile != ""){
val (fncIdMap, varIdMap) = buildIdentifierMap(prg)
varPrecisionMap = parseFile(precFile, fncIdMap, varIdMap, reporter, prg.id)
for (fnc <- prg.defs) if (!fnc.precondition.isEmpty && !fnc.body.isEmpty) {
val oldMap = varPrecisionMap(fnc.id)
varPrecisionMap = varPrecisionMap - fnc.id + (fnc.id -> typeCheckAndComplete(fnc, oldMap, uniformPrecision, uniformPrecision, reporter))
}
for (fnc <- prg.defs)
if (!fnc.precondition.isEmpty && !fnc.body.isEmpty && fncsToConsider.contains(fnc.id.toString)) {
val oldMap = varPrecisionMap(fnc.id)
varPrecisionMap = varPrecisionMap - fnc.id + (fnc.id -> typeCheckAndComplete(fnc, oldMap, uniformPrecision, uniformPrecision, reporter))
}
} else {
prg.defs.filter(fnc =>
!fnc.precondition.isEmpty &&
......@@ -82,36 +84,36 @@ object ChoosePrecisionPhase extends DaisyPhase {
FunDef(id, retT, params, pre, newb, post, isField)}))
timer.stop
(ctx.copy(precision=varPrecisionMap), newprg)
(ctx.copy(precisions=varPrecisionMap), newprg)
}
def randomType(e:Expr, m:Map[Identifier, Precision], c:Precision) : (Map[Identifier,Precision], Precision) = {
def randomType(e: Expr, m: Map[Identifier, Precision], constantPrecision: Precision): (Map[Identifier,Precision], Precision) = {
e match {
case Variable(id) => (m, m(id))
case RealLiteral(r) => (m, c)
case RealLiteral(r) => (m, constantPrecision)
case ArithOperator(Seq(l, r), recons) =>
val (map_l, t_l) = randomType(l, m, c)
val (map_r, t_r) = randomType(r, map_l, c)
val (map_l, t_l) = randomType(l, m, constantPrecision)
val (map_r, t_r) = randomType(r, map_l, constantPrecision)
val prec = getUpperBound(t_l, t_r)
(map_r, prec)
case ArithOperator(Seq(u), recons) =>
randomType(u, m, c)
randomType(u, m, constantPrecision)
case Let(id, value, body) =>
val (map_value, type_value) = randomType(value, m, c)
val (map_value, type_value) = randomType(value, m, constantPrecision)
val prec_id = getRandomPrecision(highestPrec=type_value)
if(prec_id < type_value) {
}
val new_map = map_value + (id -> prec_id)
randomType(body, new_map, c)
randomType(body, new_map, constantPrecision)
}
}
def introduceDowncast(e:Expr, m:Map[Identifier, Precision], c:Precision) : (Expr, Precision) = {
def introduceDowncast(e: Expr, m: Map[Identifier, Precision], c: Precision): (Expr, Precision) = {
e match {
case Variable(id) => (e, m(id))
case RealLiteral(r) => (e, c)
......@@ -134,8 +136,8 @@ object ChoosePrecisionPhase extends DaisyPhase {
}
}
def buildIdentifierMap(prg:Program) : (Map[String, Identifier], Map[String, Map[String, Identifier]]) = {
def buildIdentifierMapFunction(f:FunDef): Map[String, Identifier] = {
def buildIdentifierMap(prg: Program): (Map[String, Identifier], Map[String, Map[String, Identifier]]) = {
def buildIdentifierMapFunction(f: FunDef): Map[String, Identifier] = {
allVariablesOf(f.body.get).map(id => ((id.toString) -> id)).toMap
}
......@@ -143,9 +145,9 @@ object ChoosePrecisionPhase extends DaisyPhase {
prg.defs.map(fnc => (fnc.id.name -> buildIdentifierMapFunction(fnc))).toMap)
}
def typeCheckAndComplete(fnc:FunDef, varMap: Map[Identifier, Precision], defaultPrecision:Precision, constantPrecision:Precision, reporter:Reporter) : Map[Identifier, Precision] = {
def typeCheckAndComplete(fnc: FunDef, varMap: Map[Identifier, Precision], defaultPrecision: Precision, constantPrecision: Precision, reporter: Reporter): Map[Identifier, Precision] = {
def recurse(e:Expr, defPrec:Precision, cPrec:Precision, precMap:Map[Identifier, Precision]) : (Map[Identifier, Precision], Precision) = {
def recurse(e: Expr, defPrec: Precision, cPrec: Precision, precMap: Map[Identifier, Precision]): (Map[Identifier, Precision], Precision) = {
e match {
case Variable(id) =>
precMap.get(id) match {
......@@ -175,7 +177,7 @@ object ChoosePrecisionPhase extends DaisyPhase {
}
}
def checkParams(p:Seq[ValDef], defPrec:Precision, precMap:Map[Identifier, Precision]) : Map[Identifier, Precision] = {
def checkParams(p: Seq[ValDef], defPrec: Precision, precMap: Map[Identifier, Precision]): Map[Identifier, Precision] = {
p.map(e => e match { case ValDef(v) =>
precMap.get(v) match {
case None => (v -> defPrec)
......@@ -191,13 +193,13 @@ object ChoosePrecisionPhase extends DaisyPhase {
}
}
def parseFile(f:String, fncIdMap:Map[String, Identifier], varIdMap:Map[String, Map[String, Identifier]], reporter:Reporter, dummyId:Identifier) : Map[Identifier, Map[Identifier, Precision]] = {
def parseFile(f: String, fncIdMap: Map[String, Identifier], varIdMap: Map[String, Map[String, Identifier]], reporter: Reporter, dummyId: Identifier): Map[Identifier, Map[Identifier, Precision]] = {
val bufferedSource = io.Source.fromFile(f)
var currentFunction = ""
var currentTypes:Array[String] = Array()
var currentIdentifier:Identifier = dummyId
var currentFunctionMap:Map[Identifier, Precision] = Map()
var typeMap:Map[Identifier, Map[Identifier, Precision]] = Map()
var currentTypes: Array[String] = Array()
var currentIdentifier: Identifier = dummyId
var currentFunctionMap: Map[Identifier, Precision] = Map()
var typeMap: Map[Identifier, Map[Identifier, Precision]] = Map()
// input format:
// functionName:
......
......@@ -101,7 +101,7 @@ object RangeErrorPhase extends DaisyPhase with RoundoffEvaluators with IntervalS
// first identifier is for function only, second one for
// variables/parameters used inside a given function
var varPrecisionMap: Map[Identifier, Map[Identifier, Precision]] = ctx.precision
var varPrecisionMap: Map[Identifier, Map[Identifier, Precision]] = ctx.precisions
val res: Map[Identifier, (Rational, Interval)] = prg.defs.filter(fnc =>
!fnc.precondition.isEmpty &&
......@@ -143,18 +143,18 @@ object RangeErrorPhase extends DaisyPhase with RoundoffEvaluators with IntervalS
val (resError: Rational, resRange: Interval, rangeMap:Map[Expr, Interval], errorMap:Map[Expr, Interval]) = (rangeMethod, errorMethod) match {
case ("interval", "interval") =>
if(mixedPrecision) {
mixedPrecRoundoff_IA_IA(fnc.body.get, inputValMap, inputErrorMap, precisionMap, uniformPrecision, trackRoundoffErrs)
mixedPrecRoundoff_IA_IA(fnc.body.get, inputValMap, inputErrorMap, precisionMap, uniformPrecision, trackRoundoffErrs, reporter)
} else {
uniformRoundoff_IA_IA(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision, trackRoundoffErrs)
uniformRoundoff_IA_IA(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision, trackRoundoffErrs, reporter)
}
case ("interval", "affine") =>
uniformRoundoff_IA_AA(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision, trackRoundoffErrs)
uniformRoundoff_IA_AA(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision, trackRoundoffErrs, reporter)
case ("affine", "affine") =>
uniformRoundoff_AA_AA(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision, trackRoundoffErrs)
uniformRoundoff_AA_AA(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision, trackRoundoffErrs, reporter)
case ("smt", "affine") =>
uniformRoundoff_SMT_AA(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision, trackRoundoffErrs)
uniformRoundoff_SMT_AA(fnc.body.get, inputValMap, inputErrorMap, uniformPrecision, trackRoundoffErrs, reporter)
// default is to use the method that attaches the info to trees.
case ("subdiv", _) =>
......@@ -163,7 +163,8 @@ object RangeErrorPhase extends DaisyPhase with RoundoffEvaluators with IntervalS
inputValMap,
inputErrorMap,
trackRoundoffErrs,
uniformPrecision)
uniformPrecision,
reporter)
(tmp._2, tmp._1)
case _ =>
......
......@@ -75,7 +75,7 @@ object CodeGenerationPhase extends DaisyPhase {
// if we have floating-point code, we need to just change the types
val fileLocation = "./output/" + prg.id + ".scala"
ctx.reporter.info("generating code in " + fileLocation)
val typedPrg = assignMixedPrecision(prg, ctx.precision, ctx.constantPrecision)
val typedPrg = assignMixedPrecision(prg, ctx.precisions, ctx.constantPrecision)
writeScalaFile(fileLocation, typedPrg)
typedPrg
}
......
......@@ -2,7 +2,8 @@ package daisy
package lang
import Trees._
import daisy.lang.Types.RealType
import daisy.lang.Types._
import daisy.utils.FinitePrecision._
object ScalaPrinter {
......@@ -37,6 +38,10 @@ class ScalaPrinter extends PrettyPrinter {
case Or(exprs) => ppNary(exprs, "(", " || ", ")") // \lor
case Not(Equals(l, r)) => ppBinary(l, r, " != ") // \neq
case Not(expr) => ppUnary(expr, "!(", ")") // \neg
case Downcast(expr, FinitePrecisionType(Float32)) => ppUnary(expr, "", ".toFloat")
case Downcast(expr, FinitePrecisionType(Float64)) => ppUnary(expr, "", ".toDouble")
case Downcast(expr, FinitePrecisionType(DoubleDouble)) => ppUnary(expr, "DblDouble(", ")")
// this should never be called by this printer, i.e. all RealTypes
// should have been transformed before
......
......@@ -42,7 +42,8 @@ trait IntervalSubdivision extends RoundoffEvaluators {
initErrorMap: Map[Identifier, Rational],
//trackInitialErrs: Boolean,
trackRoundoffErrs: Boolean,
uniformPrecision: Precision): (Interval, Rational) = {
uniformPrecision: Precision,
reporter:Reporter): (Interval, Rational) = {
// TODO: this should not be hardcoded
val numSplits = 10
......@@ -76,7 +77,7 @@ trait IntervalSubdivision extends RoundoffEvaluators {
val (resError, resInterval,_ ,_) = uniformRoundoff_IA_AA(expr,
inputsSubdiv.head, getInputErrors(inputsSubdiv.head), uniformPrecision)
inputsSubdiv.head, getInputErrors(inputsSubdiv.head), uniformPrecision, reporter=reporter)
// val (resInterval, resError) = evaluate[Interval, AffineForm](
// expr, inputsSubdiv.head,
// getInputErrors(inputsSubdiv.head).map(x => (x._1 -> AffineForm.fromError(x._2))),
......@@ -89,7 +90,7 @@ trait IntervalSubdivision extends RoundoffEvaluators {
for (m <- inputsSubdiv.tail) {
val (tmpError, tmpRange,_, _) = uniformRoundoff_IA_AA(expr, m,
getInputErrors(m), uniformPrecision)
getInputErrors(m), uniformPrecision, reporter=reporter)
// evaluate[Interval, AffineForm](
// expr, m,
......
......@@ -25,7 +25,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision,
trackRoundoffErrors: Boolean = true): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
trackRoundoffErrors: Boolean = true,
reporter: Reporter): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
val (resRange, intermediateRanges) = evalRange[Interval](expr,
inputValMap.map(x => (x._1 -> Interval(x._2))), Interval.apply)
......@@ -37,7 +38,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
fromError = Interval.fromError,
interval2T = Interval.apply,
constantsPrecision = uniformPrecision,
trackRoundoffErrors)
trackRoundoffErrors,
reporter)
(Interval.maxAbs(resRoundoff.toInterval),resRange, intermediateRanges, allErrors)
}
......@@ -55,7 +57,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
inputErrorMap: Map[Identifier, Rational],
precisionMap: Map[Identifier, Precision],
constantsPrecision: Precision,
trackRoundoffErrors: Boolean = true): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
trackRoundoffErrors: Boolean = true,
reporter: Reporter): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
val (resRange, intermediateRanges) = evalRange[Interval](expr,
inputValMap.map(x => (x._1 -> Interval(x._2))), Interval.apply)
......@@ -67,7 +70,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
fromError = Interval.fromError,
interval2T = Interval.apply,
constantsPrecision = constantsPrecision,
trackRoundoffErrors)
trackRoundoffErrors,
reporter)
(Interval.maxAbs(resRoundoff.toInterval),resRange, intermediateRanges, allErrors)
}
......@@ -89,7 +93,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision,
trackRoundoffErrors: Boolean = true): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
trackRoundoffErrors: Boolean = true,
reporter: Reporter): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
val (resRange, intermediateRanges) = evalRange[Interval](expr, inputValMap, Interval.apply)
//println(intermediateRanges.mkString("\n"))
......@@ -101,7 +106,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
fromError = AffineForm.fromError,
interval2T = AffineForm.apply,
constantsPrecision = uniformPrecision,
trackRoundoffErrors)
trackRoundoffErrors,
reporter)
(Interval.maxAbs(resRoundoff.toInterval), resRange, intermediateRanges,
allErrors.map(x => (x._1 -> x._2.toInterval)))
......@@ -121,7 +127,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision,
trackRoundoffErrors: Boolean = true): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
trackRoundoffErrors: Boolean = true,
reporter: Reporter): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
val (resRange, intermediateRanges) = evalRange[AffineForm](expr,
inputValMap.map(x => (x._1 -> AffineForm(x._2))), AffineForm.apply)
......@@ -134,7 +141,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
fromError = AffineForm.fromError,
interval2T = AffineForm.apply,
constantsPrecision = uniformPrecision,
trackRoundoffErrors)
trackRoundoffErrors,
reporter)
(Interval.maxAbs(resRoundoff.toInterval), resRange.toInterval,
intermediateRanges.map(x => (x._1 -> x._2.toInterval)),
......@@ -155,7 +163,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
inputValMap: Map[Identifier, Interval],
inputErrorMap: Map[Identifier, Rational],
uniformPrecision: Precision,
trackRoundoffErrors: Boolean = true): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
trackRoundoffErrors: Boolean = true,
reporter: Reporter): (Rational, Interval, Map[Expr, Interval], Map[Expr, Interval]) = {
val (resRange, intermediateRanges) = evalRange[SMTRange](expr,
inputValMap.map({ case (id, int) => (id -> SMTRange(Variable(id), int)) }),
......@@ -169,7 +178,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
fromError = AffineForm.fromError,
interval2T = AffineForm.apply,
constantsPrecision = uniformPrecision,
trackRoundoffErrors)
trackRoundoffErrors,
reporter)
(Interval.maxAbs(resRoundoff.toInterval), resRange.toInterval,
intermediateRanges.map(x => (x._1 -> x._2.toInterval)),
......@@ -194,8 +204,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
fromError: Rational => T,
interval2T: Interval => T,
constantsPrecision: Precision,
trackRoundoffErrors: Boolean // if false, propagate only initial errors
): (T, Map[Expr, T]) = {
trackRoundoffErrors: Boolean, // if false, propagate only initial errors
reporter: Reporter): (T, Map[Expr, T]) = {
var intermediateErrors: Map[Expr, T] = Map.empty
......@@ -211,7 +221,7 @@ trait RoundoffEvaluators extends RangeEvaluators {
propagatedError
}
def eval(e: Expr, errorMap: Map[Identifier, T]): (T, Precision) = (e: @unchecked) match {
def eval(e: Expr, errorMap: Map[Identifier, T], reporter: Reporter): (T, Precision) = (e: @unchecked) match {
case x @ RealLiteral(r) =>
//val rndoff = if (isExactInFloats(r, constantsPrecision) || !trackRoundoffErrors) {
......@@ -232,8 +242,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
case x @ Plus(lhs, rhs) =>
val range = rangeMap(x)
val (rndoffLhs, precLhs) = eval(lhs, errorMap)
val (rndoffRhs, precRhs) = eval(rhs, errorMap)
val (rndoffLhs, precLhs) = eval(lhs, errorMap, reporter)
val (rndoffRhs, precRhs) = eval(rhs, errorMap, reporter)
val propagatedError = rndoffLhs + rndoffRhs
val prec = getUpperBound(precLhs, precRhs) // Scala semantics
......@@ -244,8 +254,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
case x @ Minus(lhs, rhs) =>
val range = rangeMap(x)
val (rndoffLhs, precLhs) = eval(lhs, errorMap)
val (rndoffRhs, precRhs) = eval(rhs, errorMap)
val (rndoffLhs, precLhs) = eval(lhs, errorMap, reporter)
val (rndoffRhs, precRhs) = eval(rhs, errorMap, reporter)
val propagatedError = rndoffLhs - rndoffRhs
val prec = getUpperBound(precLhs, precRhs)
......@@ -258,8 +268,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
val rangeLhs = rangeMap(lhs)
val rangeRhs = rangeMap(rhs)
val (rndoffLhs, precLhs) = eval(lhs, errorMap)
val (rndoffRhs, precRhs) = eval(rhs, errorMap)
val (rndoffLhs, precLhs) = eval(lhs, errorMap, reporter)
val (rndoffRhs, precRhs) = eval(rhs, errorMap, reporter)
val propagatedError = interval2T(rangeLhs) * rndoffRhs +
interval2T(rangeRhs) * rndoffLhs +
......@@ -276,8 +286,8 @@ trait RoundoffEvaluators extends RangeEvaluators {
val rangeLhs = rangeMap(lhs)
val rangeRhs = rangeMap(rhs)
val (rndoffLhs, precLhs) = eval(lhs, errorMap)
val (rndoffRhs, precRhs) = eval(rhs, errorMap)
val (rndoffLhs, precLhs) = eval(lhs, errorMap, reporter)
val (rndoffRhs, precRhs) = eval(rhs, errorMap, reporter)
// inverse, i.e. we are computing x * (1/y)
val rightInterval = rangeRhs + rndoffRhs.toInterval // the actual interval, incl errors
......@@ -303,7 +313,7 @@ trait RoundoffEvaluators extends RangeEvaluators {
(rndoff, prec)
case x @ UMinus(t) =>
val (rndoff, prec) = eval(t, errorMap)
val (rndoff, prec) = eval(t, errorMap, reporter)
intermediateErrors += (x -> - rndoff)
(- rndoff, prec)
......@@ -311,7 +321,7 @@ trait RoundoffEvaluators extends RangeEvaluators {
// TODO: needs to fail for fixed-point precision
val range = rangeMap(x)
val rangeT = rangeMap(t)
val (errorT, prec) = eval(t, errorMap)
val (errorT, prec) = eval(t, errorMap, reporter)
val tInterval = rangeT
val a = min(abs(tInterval.xlo), abs(tInterval.xhi))
......@@ -325,7 +335,7 @@ trait RoundoffEvaluators extends RangeEvaluators {
(rndoff, prec)
case x @ Downcast(e, t) =>
val (eRndoff, ePrec) = eval(e, errorMap)
val (eRndoff, ePrec) = eval(e, errorMap, reporter)
t match {
case FinitePrecisionType(tpe) =>
val rndoff = computeNewError(rangeMap(e), eRndoff, tpe)
......@@ -334,10 +344,12 @@ trait RoundoffEvaluators extends RangeEvaluators {
}
case x @ Let(id, value, body) =>
val (valueRndoff, valuePrec) = eval(value, errorMap)
val (valueRndoff, valuePrec) = eval(value, errorMap, reporter)
val idPrec = precisionMap(id)
assert(idPrec == valuePrec)
if(idPrec != valuePrec) {
reporter.warning(s"Precision of variable ${id.toString} does not match the precision of the assigned value. This should not happen.")
}
val rndoff = valueRndoff
// val rndoff = if (idPrec < valuePrec) { // we need to cast down
......@@ -347,10 +359,10 @@ trait RoundoffEvaluators extends RangeEvaluators {
// valueRndoff
// }
eval(body, errorMap + (id -> rndoff))
eval(body, errorMap + (id -> rndoff), reporter)
}
val (resRndoff, resPrecision) = eval(expr, initErrorMap)
val (resRndoff, resPrecision) = eval(expr, initErrorMap, reporter)
(resRndoff, intermediateErrors)
}
......
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