\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -2.04179898258906648865287012115961201463 \cdot 10^{153}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -3.379561403631358792480741892956065284459 \cdot 10^{-65}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\right)\right)\\
\mathbf{elif}\;y \le 9.959621465941042556551382638800450476793 \cdot 10^{-80}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 2.371593609881423098610405616408534144725 \cdot 10^{60}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(y, y \cdot 4, x \cdot x\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r25796401 = x;
double r25796402 = r25796401 * r25796401;
double r25796403 = y;
double r25796404 = 4.0;
double r25796405 = r25796403 * r25796404;
double r25796406 = r25796405 * r25796403;
double r25796407 = r25796402 - r25796406;
double r25796408 = r25796402 + r25796406;
double r25796409 = r25796407 / r25796408;
return r25796409;
}
double f(double x, double y) {
double r25796410 = y;
double r25796411 = -2.0417989825890665e+153;
bool r25796412 = r25796410 <= r25796411;
double r25796413 = -1.0;
double r25796414 = -3.379561403631359e-65;
bool r25796415 = r25796410 <= r25796414;
double r25796416 = x;
double r25796417 = r25796416 * r25796416;
double r25796418 = 4.0;
double r25796419 = r25796410 * r25796418;
double r25796420 = r25796419 * r25796410;
double r25796421 = r25796417 - r25796420;
double r25796422 = r25796417 + r25796420;
double r25796423 = r25796421 / r25796422;
double r25796424 = expm1(r25796423);
double r25796425 = log1p(r25796424);
double r25796426 = 9.959621465941043e-80;
bool r25796427 = r25796410 <= r25796426;
double r25796428 = 1.0;
double r25796429 = 2.371593609881423e+60;
bool r25796430 = r25796410 <= r25796429;
double r25796431 = fma(r25796410, r25796419, r25796417);
double r25796432 = r25796421 / r25796431;
double r25796433 = log1p(r25796432);
double r25796434 = expm1(r25796433);
double r25796435 = r25796430 ? r25796434 : r25796413;
double r25796436 = r25796427 ? r25796428 : r25796435;
double r25796437 = r25796415 ? r25796425 : r25796436;
double r25796438 = r25796412 ? r25796413 : r25796437;
return r25796438;
}




Bits error versus x




Bits error versus y
| Original | 31.6 |
|---|---|
| Target | 31.3 |
| Herbie | 12.8 |
if y < -2.0417989825890665e+153 or 2.371593609881423e+60 < y Initial program 52.9
Taylor expanded around 0 10.5
if -2.0417989825890665e+153 < y < -3.379561403631359e-65Initial program 16.2
rmApplied log1p-expm1-u16.2
if -3.379561403631359e-65 < y < 9.959621465941043e-80Initial program 25.4
Taylor expanded around inf 12.3
if 9.959621465941043e-80 < y < 2.371593609881423e+60Initial program 15.9
Taylor expanded around 0 15.9
Simplified15.9
rmApplied expm1-log1p-u15.9
Final simplification12.8
herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:herbie-target
(if (< (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4.0))) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4.0)))) 2.0) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))
(/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))