From adf27ea0c129b3947171f774172f688eedcaa6a6 Mon Sep 17 00:00:00 2001 From: Agathe Herrou Date: Fri, 29 Mar 2024 16:56:29 +0100 Subject: [PATCH] Deals with empty intervals --- interval/intervalAbs.cpp | 3 +++ interval/intervalAcos.cpp | 2 +- interval/intervalAcosh.cpp | 2 +- interval/intervalAdd.cpp | 2 +- interval/intervalAnd.cpp | 2 +- interval/intervalAsinh.cpp | 3 +++ interval/intervalAtan.cpp | 2 +- interval/intervalAtan2.cpp | 3 +++ interval/intervalAtanh.cpp | 2 +- interval/intervalCeil.cpp | 2 +- interval/intervalCos.cpp | 2 +- interval/intervalCosh.cpp | 2 +- interval/intervalDelay.cpp | 2 +- interval/intervalEq.cpp | 2 +- interval/intervalFloor.cpp | 2 +- interval/intervalGe.cpp | 2 +- interval/intervalGt.cpp | 2 +- interval/intervalHSlider.cpp | 7 +++++-- interval/intervalIntCast.cpp | 2 +- interval/intervalInv.cpp | 2 +- interval/intervalLog.cpp | 2 +- interval/intervalLog10.cpp | 2 +- interval/intervalLsh.cpp | 3 +++ interval/intervalMax.cpp | 2 +- interval/intervalMem.cpp | 2 +- interval/intervalMin.cpp | 2 +- interval/intervalMul.cpp | 2 +- interval/intervalNe.cpp | 2 +- interval/intervalNeg.cpp | 2 +- interval/intervalNot.cpp | 2 +- interval/intervalNumEntry.cpp | 3 +++ interval/intervalOr.cpp | 2 +- interval/intervalPow.cpp | 6 ++++++ interval/intervalRint.cpp | 3 +++ interval/intervalRound.cpp | 3 +++ interval/intervalRsh.cpp | 3 +++ interval/intervalSin.cpp | 3 +++ interval/intervalSinh.cpp | 2 +- interval/intervalSqrt.cpp | 6 +++--- interval/intervalSub.cpp | 2 +- interval/intervalTan.cpp | 2 +- interval/intervalTanh.cpp | 2 +- interval/intervalVSlider.cpp | 3 +++ interval/intervalXor.cpp | 2 +- 44 files changed, 75 insertions(+), 36 deletions(-) diff --git a/interval/intervalAbs.cpp b/interval/intervalAbs.cpp index c41d6fa..1da4f87 100644 --- a/interval/intervalAbs.cpp +++ b/interval/intervalAbs.cpp @@ -28,6 +28,9 @@ namespace itv { interval interval_algebra::Abs(const interval& x) { + if (x.isEmpty()) + return empty(); + // precision stays the same if (x.lo() >= 0) { return x; diff --git a/interval/intervalAcos.cpp b/interval/intervalAcos.cpp index 19bef86..afd2163 100644 --- a/interval/intervalAcos.cpp +++ b/interval/intervalAcos.cpp @@ -32,7 +32,7 @@ interval interval_algebra::Acos(const interval& x) { interval i = intersection(AcosDomain, x); // TODO: warn about interval violations if (i.isEmpty()) { - return i; + return empty(); } double v = 0; // value at which the min slope is attained, zero if it is present diff --git a/interval/intervalAcosh.cpp b/interval/intervalAcosh.cpp index 5727175..27418a1 100644 --- a/interval/intervalAcosh.cpp +++ b/interval/intervalAcosh.cpp @@ -32,7 +32,7 @@ interval interval_algebra::Acosh(const interval& x) { interval i = intersection(domain, x); if (i.isEmpty()) { - return i; + return empty(); } // the min slope is attained at the highest bound of the interval diff --git a/interval/intervalAdd.cpp b/interval/intervalAdd.cpp index 8f7c7a3..fcbde07 100644 --- a/interval/intervalAdd.cpp +++ b/interval/intervalAdd.cpp @@ -38,7 +38,7 @@ static double addint(double x, double y) interval interval_algebra::Add(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return {}; + return empty(); } if (x.lsb() >= 0 and y.lsb() >= 0) { // if both intervals are integers diff --git a/interval/intervalAnd.cpp b/interval/intervalAnd.cpp index 8eed1d8..ba58637 100644 --- a/interval/intervalAnd.cpp +++ b/interval/intervalAnd.cpp @@ -130,7 +130,7 @@ interval interval_algebra::And(const interval& x, const interval& y) interval interval_algebra::And(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return {}; + return empty(); } int x0 = saturatedIntCast(x.lo()); int x1 = saturatedIntCast(x.hi()); diff --git a/interval/intervalAsinh.cpp b/interval/intervalAsinh.cpp index bc18391..be978b7 100644 --- a/interval/intervalAsinh.cpp +++ b/interval/intervalAsinh.cpp @@ -29,6 +29,9 @@ static const interval domain(-HUGE_VAL, HUGE_VAL); interval interval_algebra::Asinh(const interval& x) { + if (x.isEmpty()) + return empty(); + double v = maxValAbs(x); // value at which the min slope is attained, here the bound of highest absolute value int sign = signMaxValAbs(x); // whether we compute the difference between f(v) and f(v+ε) or f(v-ε) diff --git a/interval/intervalAtan.cpp b/interval/intervalAtan.cpp index 9c5b32f..6839e05 100644 --- a/interval/intervalAtan.cpp +++ b/interval/intervalAtan.cpp @@ -32,7 +32,7 @@ namespace itv { interval interval_algebra::Atan(const interval& x) { if (x.isEmpty()) { - return x; + return empty(); } double v = maxValAbs(x); // value at which the min slope is attained, here the bound of highest absolute value diff --git a/interval/intervalAtan2.cpp b/interval/intervalAtan2.cpp index b9562ec..0f9a24f 100644 --- a/interval/intervalAtan2.cpp +++ b/interval/intervalAtan2.cpp @@ -31,6 +31,9 @@ namespace itv { // (where (x,y) are the cartesian coordinates of the point we wish to retrieve the angle of) interval interval_algebra::Atan2(const interval& y, const interval& x) { + if (x.isEmpty() || y.isEmpty()) + return empty(); + double lo = -M_PI; double hi = M_PI; diff --git a/interval/intervalAtanh.cpp b/interval/intervalAtanh.cpp index 0e57131..32eaa06 100644 --- a/interval/intervalAtanh.cpp +++ b/interval/intervalAtanh.cpp @@ -33,7 +33,7 @@ interval interval_algebra::Atanh(const interval& x) { interval i = intersection(domain, x); if (i.isEmpty()) { - return i; + return empty(); } double v = minValAbs(x); diff --git a/interval/intervalCeil.cpp b/interval/intervalCeil.cpp index aeaf20f..e2e1187 100644 --- a/interval/intervalCeil.cpp +++ b/interval/intervalCeil.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Ceil(const interval& x) { if (x.isEmpty()) { - return x; + return empty(); } return {ceil(x.lo()), ceil(x.hi()), -1 }; // even though the output of floor are mathematical integers, // they are implemented as floats and thus should not be given precision 0, diff --git a/interval/intervalCos.cpp b/interval/intervalCos.cpp index 8c92e67..d14d247 100644 --- a/interval/intervalCos.cpp +++ b/interval/intervalCos.cpp @@ -38,7 +38,7 @@ interval interval_algebra::Cos(const interval& x) if (precision == INT_MIN or taylor_lsb) precision = 2*x.lsb() - 1; // if x.lsb() is so small that the automatic computation doesn't work if (x.isEmpty()) { - return {}; + return empty(); } if (x.size() >= 2*M_PI) { return {-1, 1, precision}; diff --git a/interval/intervalCosh.cpp b/interval/intervalCosh.cpp index a2e1fe2..250217f 100644 --- a/interval/intervalCosh.cpp +++ b/interval/intervalCosh.cpp @@ -31,7 +31,7 @@ interval interval_algebra::Cosh(const interval& x) double v = 0; // absolute lowest slope is at zero if (x.isEmpty()) { - return x; + return empty(); } if (x.hasZero()) { diff --git a/interval/intervalDelay.cpp b/interval/intervalDelay.cpp index 5c81dca..1b745d1 100644 --- a/interval/intervalDelay.cpp +++ b/interval/intervalDelay.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Delay(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return {}; + return empty(); } if (y.isZero()) { return x; diff --git a/interval/intervalEq.cpp b/interval/intervalEq.cpp index 3b5b584..6792d49 100644 --- a/interval/intervalEq.cpp +++ b/interval/intervalEq.cpp @@ -34,7 +34,7 @@ static double myEq(double x, double y) interval interval_algebra::Eq(const interval& x, const interval& y) { // boolean value => precision 0 - if (x.isEmpty() || y.isEmpty()) return interval{}; + if (x.isEmpty() || y.isEmpty()) return empty(); if (x.lo() == x.hi() && x.lo() == y.lo() && x.lo() == y.hi()) return interval{1,1,0}; if (x.hi() < y.lo() || x.lo() > y.hi()) return interval{0, 0, 0}; return interval{0, 1, 0}; diff --git a/interval/intervalFloor.cpp b/interval/intervalFloor.cpp index 4681c14..0aafdcd 100644 --- a/interval/intervalFloor.cpp +++ b/interval/intervalFloor.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Floor(const interval& x) { if (x.isEmpty()) { - return x; + return empty(); } return {floor(x.lo()), floor(x.hi()), -1}; // even though the output of floor are mathematical integers, // they are implemented as floats and thus should not be given precision 0, diff --git a/interval/intervalGe.cpp b/interval/intervalGe.cpp index 6483758..8d8c729 100644 --- a/interval/intervalGe.cpp +++ b/interval/intervalGe.cpp @@ -34,7 +34,7 @@ static double myGe(double x, double y) interval interval_algebra::Ge(const interval& x, const interval& y) { // boolean value => precision 0 - if (x.isEmpty() || y.isEmpty()) return interval{}; + if (x.isEmpty() || y.isEmpty()) return empty(); if (x.lo() >= y.hi()) return interval{1,1,0}; if (x.hi() < y.lo()) return interval{0,0,0}; return interval{0, 1, 0}; diff --git a/interval/intervalGt.cpp b/interval/intervalGt.cpp index eadcd58..5c89a29 100644 --- a/interval/intervalGt.cpp +++ b/interval/intervalGt.cpp @@ -34,7 +34,7 @@ static double myGt(double x, double y) interval interval_algebra::Gt(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return interval{}; + return empty(); } if (x.lo() > y.hi()) { return interval{1,1,0}; diff --git a/interval/intervalHSlider.cpp b/interval/intervalHSlider.cpp index ebd6749..85c14ae 100644 --- a/interval/intervalHSlider.cpp +++ b/interval/intervalHSlider.cpp @@ -24,13 +24,16 @@ namespace itv { interval interval_algebra::HSlider(const interval& name, const interval& init, const interval& lo, const interval& hi, const interval& step) { - // elements of a slider with range [lo; hi] and step step are of the form lo + k·step <= hi with k an integer + if (init.isEmpty() || lo.isEmpty() || hi.isEmpty() || step.isEmpty()) + return empty(); + + // elements of a slider with range [lo; hi] and step s are of the form lo + k·s <= hi with k an integer // the precision needed to represent such elements is the minimum between int lsb = std::min(step.lsb(), lo.lsb()); // the precision of the lower bound and that of the step if (step.lo() > 0) { // if we don't have negative or zero steps lsb = std::min(lsb, (int)log2(step.lo())); // and that associated to the smallest value the step can take } - return {lo.lo(), hi.hi(), lsb}; // TODO: step, init + return {lo.lo(), hi.hi(), lsb}; } } // namespace itv diff --git a/interval/intervalIntCast.cpp b/interval/intervalIntCast.cpp index b13794f..4ad3aa2 100644 --- a/interval/intervalIntCast.cpp +++ b/interval/intervalIntCast.cpp @@ -31,7 +31,7 @@ namespace itv { interval interval_algebra::IntCast(const interval& x) { if (x.isEmpty()) { - return {}; + return empty(); } return {double(saturatedIntCast(x.lo())), double(saturatedIntCast(x.hi())), 0}; // integer intervals have 0 bits of precision diff --git a/interval/intervalInv.cpp b/interval/intervalInv.cpp index c62a559..6f05d70 100644 --- a/interval/intervalInv.cpp +++ b/interval/intervalInv.cpp @@ -35,7 +35,7 @@ static double inv(double x) interval interval_algebra::Inv(const interval& x) { if (x.isEmpty()) { - return {}; + return empty(); } int sign = signMaxValAbs(x); diff --git a/interval/intervalLog.cpp b/interval/intervalLog.cpp index 3a75fb9..2998d66 100644 --- a/interval/intervalLog.cpp +++ b/interval/intervalLog.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Log(const interval& x) { if (x.isEmpty()) { - return {}; + return empty(); } // lowest slope is at the highest bound of the interval diff --git a/interval/intervalLog10.cpp b/interval/intervalLog10.cpp index cb70280..95f645c 100644 --- a/interval/intervalLog10.cpp +++ b/interval/intervalLog10.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Log10(const interval& x) { if (x.isEmpty()) { - return {}; + return empty(); } // lowest slope is at the highest bound of the interval diff --git a/interval/intervalLsh.cpp b/interval/intervalLsh.cpp index 86e375c..302de61 100644 --- a/interval/intervalLsh.cpp +++ b/interval/intervalLsh.cpp @@ -34,6 +34,9 @@ static double lsh(double x, double y) interval interval_algebra::Lsh(const interval& x, const interval& y) { + if (x.isEmpty() || y.isEmpty()) + return empty(); + interval j{pow(2, y.lo()), pow(2, y.hi())}; interval z = Mul(x, j); diff --git a/interval/intervalMax.cpp b/interval/intervalMax.cpp index ffddd3b..359bb5a 100644 --- a/interval/intervalMax.cpp +++ b/interval/intervalMax.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Max(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return {}; + return empty(); } return { diff --git a/interval/intervalMem.cpp b/interval/intervalMem.cpp index be77c23..e33c203 100644 --- a/interval/intervalMem.cpp +++ b/interval/intervalMem.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Mem(const interval& x) { if (x.isEmpty()) { - return {}; + return empty(); } interval z = reunion(x, interval{0}); return {z.lo(), z.hi(), x.lsb()}; diff --git a/interval/intervalMin.cpp b/interval/intervalMin.cpp index c1abf7b..6c8247d 100644 --- a/interval/intervalMin.cpp +++ b/interval/intervalMin.cpp @@ -28,7 +28,7 @@ namespace itv { interval interval_algebra::Min(const interval& x, const interval& y) { - if (x.isEmpty() || y.isEmpty()) return {}; + if (x.isEmpty() || y.isEmpty()) return empty(); return {std::min(x.lo(), y.lo()), std::min(x.hi(), y.hi()), std::min(x.lsb(), y.lsb())}; // resulting interval should be as precise as the most precise of the operands } diff --git a/interval/intervalMul.cpp b/interval/intervalMul.cpp index d551f9d..862f8bb 100644 --- a/interval/intervalMul.cpp +++ b/interval/intervalMul.cpp @@ -43,7 +43,7 @@ static double specialmultint(double a, double b) interval interval_algebra::Mul(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return {}; + return empty(); } if (x.lsb() >= 0 and y.lsb() >= 0) // operation between integers diff --git a/interval/intervalNe.cpp b/interval/intervalNe.cpp index fa31be8..afbc5e6 100644 --- a/interval/intervalNe.cpp +++ b/interval/intervalNe.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Ne(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return {}; + return empty(); } if ((x.hi() < y.lo()) || x.lo() > y.hi()) { return interval{1, 1, 0}; diff --git a/interval/intervalNeg.cpp b/interval/intervalNeg.cpp index b422c76..8594c31 100644 --- a/interval/intervalNeg.cpp +++ b/interval/intervalNeg.cpp @@ -27,7 +27,7 @@ namespace itv { interval interval_algebra::Neg(const interval& x) { if (x.isEmpty()) { - return {}; + return empty(); } return {-x.hi(), -x.lo(), x.lsb()}; diff --git a/interval/intervalNot.cpp b/interval/intervalNot.cpp index 8ca1a2c..a943b9e 100644 --- a/interval/intervalNot.cpp +++ b/interval/intervalNot.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Not(const interval& x) { if (x.isEmpty()) { - return x; + return empty(); } int x0 = saturatedIntCast(x.lo()); int x1 = saturatedIntCast(x.hi()); diff --git a/interval/intervalNumEntry.cpp b/interval/intervalNumEntry.cpp index a9a51f2..9ed19bc 100644 --- a/interval/intervalNumEntry.cpp +++ b/interval/intervalNumEntry.cpp @@ -22,6 +22,9 @@ namespace itv { interval interval_algebra::NumEntry(const interval& name, const interval& init, const interval& lo, const interval& hi, const interval& step) { + if (init.isEmpty() || lo.isEmpty() || hi.isEmpty() || step.isEmpty()) + return empty(); + // elements of a slider with range [lo; hi] and step step are of the form lo + k·step <= hi with k an integer // the precision needed to represent such elements is the minimum between int lsb = std::min(step.lsb(), lo.lsb()); // the precision of the lower bound and that of the step diff --git a/interval/intervalOr.cpp b/interval/intervalOr.cpp index 99a15c5..40a8ce0 100644 --- a/interval/intervalOr.cpp +++ b/interval/intervalOr.cpp @@ -38,7 +38,7 @@ static double myOr(double x, double y) interval interval_algebra::Or(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return {}; + return empty(); } int x0 = saturatedIntCast(x.lo()); int x1 = saturatedIntCast(x.hi()); diff --git a/interval/intervalPow.cpp b/interval/intervalPow.cpp index 25e8edc..5600b88 100644 --- a/interval/intervalPow.cpp +++ b/interval/intervalPow.cpp @@ -74,6 +74,9 @@ static interval ipow(const interval& x, int y) */ interval interval_algebra::fPow(const interval& x, const interval& y) { + if (x.isEmpty() || y.isEmpty()) + return empty(); + assert(x.lo() > 0); // x all positive return Exp(Mul(y, Log(x))); @@ -81,6 +84,9 @@ interval interval_algebra::fPow(const interval& x, const interval& y) interval interval_algebra::iPow(const interval& x, const interval& y) { + if (x.isEmpty() || y.isEmpty()) + return empty(); + int y0 = std::max(0, saturatedIntCast(y.lo())); int y1 = std::max(0, saturatedIntCast(y.hi())); interval z = ipow(x, y0); diff --git a/interval/intervalRint.cpp b/interval/intervalRint.cpp index 9b2ca0b..7510a77 100644 --- a/interval/intervalRint.cpp +++ b/interval/intervalRint.cpp @@ -28,6 +28,9 @@ namespace itv { interval interval_algebra::Rint(const interval& x) { + if (x.isEmpty()) + return empty(); + return {rint(x.lo()), rint(x.hi()), 0}; // round to nearest integral value => integer => precision 0 } diff --git a/interval/intervalRound.cpp b/interval/intervalRound.cpp index 0881cf3..1e39bba 100644 --- a/interval/intervalRound.cpp +++ b/interval/intervalRound.cpp @@ -28,6 +28,9 @@ namespace itv { interval interval_algebra::Round(const interval& x) { + if (x.isEmpty()) + return empty(); + return {round(x.lo()), round(x.hi()), 0}; // round to integral value (regardless of rounding direction) => integer => precision 0 } diff --git a/interval/intervalRsh.cpp b/interval/intervalRsh.cpp index 3792d64..e3197de 100644 --- a/interval/intervalRsh.cpp +++ b/interval/intervalRsh.cpp @@ -33,6 +33,9 @@ static double rsh(double x, double y) interval interval_algebra::Rsh(const interval& x, const interval& y) { + if (x.isEmpty() || y.isEmpty()) + return empty(); + interval j{pow(2, -y.hi()), pow(2, -y.lo())}; interval z = Mul(x, j); diff --git a/interval/intervalSin.cpp b/interval/intervalSin.cpp index 124e71b..38661f1 100644 --- a/interval/intervalSin.cpp +++ b/interval/intervalSin.cpp @@ -34,6 +34,9 @@ static double sinPi(double x) interval interval_algebra::Sin(const interval& x) { + if (x.isEmpty()) + return empty(); + int precision = exactPrecisionUnary(sin, 0.5, pow(2, x.lsb())); if (precision == INT_MIN or taylor_lsb) precision = 2*x.lsb() - 1; // if x.lsb() is so small that the automatic computation doesn't work diff --git a/interval/intervalSinh.cpp b/interval/intervalSinh.cpp index e73bce6..603d83c 100644 --- a/interval/intervalSinh.cpp +++ b/interval/intervalSinh.cpp @@ -29,7 +29,7 @@ namespace itv { interval interval_algebra::Sinh(const interval& x) { if (x.isEmpty()) { - return x; + return empty(); } double v = 0; // absolute lowest slope is at zero diff --git a/interval/intervalSqrt.cpp b/interval/intervalSqrt.cpp index b71447f..3b412c6 100644 --- a/interval/intervalSqrt.cpp +++ b/interval/intervalSqrt.cpp @@ -33,11 +33,11 @@ interval interval_algebra::Sqrt(const interval& x) interval i = intersection(SqrtDomain, x); if (i.isEmpty()) { - return i; + return empty(); } - if (i.lo() < 0) { + /* if (i.lo() < 0) { return {}; // sqrt of negative numbers - } + }*/ // lowest slope at the highest bound of the interval int precision = exactPrecisionUnary(sqrt, i.hi(), -pow(2, i.lsb())); diff --git a/interval/intervalSub.cpp b/interval/intervalSub.cpp index 42ff294..ac5dcc5 100644 --- a/interval/intervalSub.cpp +++ b/interval/intervalSub.cpp @@ -32,7 +32,7 @@ static double sub(double a, double b) interval interval_algebra::Sub(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return {}; + return empty(); } return {x.lo() - y.hi(), x.hi() - y.lo(), std::min(x.lsb(), y.lsb())}; diff --git a/interval/intervalTan.cpp b/interval/intervalTan.cpp index 7c2360f..b67042e 100644 --- a/interval/intervalTan.cpp +++ b/interval/intervalTan.cpp @@ -35,7 +35,7 @@ static double tanPi(double x) interval interval_algebra::Tan(const interval& x) { if (x.isEmpty()) { - return x; + return empty(); } if (x.size() >= M_PI) { // spans asymptots and contains an integer multiple of pi // std::cout << "Spanning more than one period" << std::endl; diff --git a/interval/intervalTanh.cpp b/interval/intervalTanh.cpp index a786e7f..b7067a3 100644 --- a/interval/intervalTanh.cpp +++ b/interval/intervalTanh.cpp @@ -30,7 +30,7 @@ namespace itv { interval interval_algebra::Tanh(const interval& x) { if (x.isEmpty()) { - return {}; + return empty(); } // value at which the lowest slope is attained: bound of the interval with the highest absolute value diff --git a/interval/intervalVSlider.cpp b/interval/intervalVSlider.cpp index b3537c0..1362532 100644 --- a/interval/intervalVSlider.cpp +++ b/interval/intervalVSlider.cpp @@ -23,6 +23,9 @@ namespace itv { interval interval_algebra::VSlider(const interval& name, const interval& init, const interval& lo, const interval& hi, const interval& step) { + if (init.isEmpty() || lo.isEmpty() || hi.isEmpty() || step.isEmpty()) + return empty(); + // elements of a slider with range [lo; hi] and step step are of the form lo + k·step <= hi with k an integer // the precision needed to represent such elements is the minimum between int lsb = std::min(step.lsb(), lo.lsb()); // the precision of the lower bound and that of the step diff --git a/interval/intervalXor.cpp b/interval/intervalXor.cpp index 386456a..ed968e0 100644 --- a/interval/intervalXor.cpp +++ b/interval/intervalXor.cpp @@ -38,7 +38,7 @@ static double myXor(double x, double y) interval interval_algebra::Xor(const interval& x, const interval& y) { if (x.isEmpty() || y.isEmpty()) { - return {}; + return empty(); } auto x0 = saturatedIntCast(x.lo()); auto x1 = saturatedIntCast(x.hi());