\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -3.4362841072323272 \cdot 10^{150}:\\
\;\;\;\;-1 \cdot y\\
\mathbf{elif}\;y \le -1.7874287404230692 \cdot 10^{-225}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{elif}\;y \le 5.8993776144081826 \cdot 10^{-308}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \le 2.4345784437110915 \cdot 10^{-199}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;y \le 1.7970794289179904 \cdot 10^{-166}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \le 1.0688990210562475 \cdot 10^{-162}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;y \le 2.23402097896517821 \cdot 10^{109}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}double f(double x, double y) {
double r954461 = x;
double r954462 = r954461 * r954461;
double r954463 = y;
double r954464 = r954463 * r954463;
double r954465 = r954462 + r954464;
double r954466 = sqrt(r954465);
return r954466;
}
double f(double x, double y) {
double r954467 = y;
double r954468 = -3.436284107232327e+150;
bool r954469 = r954467 <= r954468;
double r954470 = -1.0;
double r954471 = r954470 * r954467;
double r954472 = -1.7874287404230692e-225;
bool r954473 = r954467 <= r954472;
double r954474 = x;
double r954475 = r954474 * r954474;
double r954476 = r954467 * r954467;
double r954477 = r954475 + r954476;
double r954478 = sqrt(r954477);
double r954479 = 5.899377614408183e-308;
bool r954480 = r954467 <= r954479;
double r954481 = 2.4345784437110915e-199;
bool r954482 = r954467 <= r954481;
double r954483 = r954470 * r954474;
double r954484 = 1.7970794289179904e-166;
bool r954485 = r954467 <= r954484;
double r954486 = 1.0688990210562475e-162;
bool r954487 = r954467 <= r954486;
double r954488 = 2.2340209789651782e+109;
bool r954489 = r954467 <= r954488;
double r954490 = r954489 ? r954478 : r954467;
double r954491 = r954487 ? r954483 : r954490;
double r954492 = r954485 ? r954474 : r954491;
double r954493 = r954482 ? r954483 : r954492;
double r954494 = r954480 ? r954474 : r954493;
double r954495 = r954473 ? r954478 : r954494;
double r954496 = r954469 ? r954471 : r954495;
return r954496;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.7 |
|---|---|
| Target | 17.7 |
| Herbie | 18.1 |
if y < -3.436284107232327e+150Initial program 62.6
rmApplied flip-+64.0
Simplified64.0
Taylor expanded around -inf 8.8
if -3.436284107232327e+150 < y < -1.7874287404230692e-225 or 1.0688990210562475e-162 < y < 2.2340209789651782e+109Initial program 17.2
if -1.7874287404230692e-225 < y < 5.899377614408183e-308 or 2.4345784437110915e-199 < y < 1.7970794289179904e-166Initial program 31.5
Taylor expanded around inf 33.7
if 5.899377614408183e-308 < y < 2.4345784437110915e-199 or 1.7970794289179904e-166 < y < 1.0688990210562475e-162Initial program 31.3
Taylor expanded around -inf 35.2
if 2.2340209789651782e+109 < y Initial program 53.4
Taylor expanded around 0 9.8
Final simplification18.1
herbie shell --seed 2020060
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:precision binary64
:herbie-target
(if (< x -1.123695082659983e+145) (- x) (if (< x 1.116557621183362e+93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))