Commit 092865e2 authored by ='s avatar =

Fixed one error in the computation of absRoundoff for float32...

parent 1d8addee
......@@ -4,6 +4,7 @@ package utils
import Rational.{max, abs, double2Fraction}
import java.math.BigInteger
import scala.util.Random
//import math.BigInt.{abs => bigAbs}
object FinitePrecision {
......@@ -93,7 +94,7 @@ object FinitePrecision {
}
def absRoundoff(r: Rational): Rational = {
// PERFORMANCE: this may not be the fastest way
Rational.fromDouble(math.ulp(1.0)/2)*Rational.abs(r)
Rational.fromDouble(math.ulp(1.0.floatValue)/2)*Rational.abs(r)
//Rational.fromDouble(math.ulp(Rational.abs(r).floatValue)/2)
}
......@@ -210,4 +211,8 @@ object FinitePrecision {
}
}
def getRandomPrecision() = {
val choices = List(Float32, Float64, DoubleDouble)
choices(Random.nextInt(choices.size))
}
}
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