\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 -4.758167358261969805068202523877348166337 \cdot 10^{148}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.63689029313189507811324572738338926855 \cdot 10^{-160}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\right)\right)\\
\mathbf{elif}\;y \le 1.575397687437991456648509198388754062127 \cdot 10^{-55}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 8.134021215145637850375061461407044861883 \cdot 10^{-38}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\right)\right)\\
\mathbf{elif}\;y \le 98355.24381927796639502048492431640625:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r397638 = x;
double r397639 = r397638 * r397638;
double r397640 = y;
double r397641 = 4.0;
double r397642 = r397640 * r397641;
double r397643 = r397642 * r397640;
double r397644 = r397639 - r397643;
double r397645 = r397639 + r397643;
double r397646 = r397644 / r397645;
return r397646;
}
double f(double x, double y) {
double r397647 = y;
double r397648 = -4.75816735826197e+148;
bool r397649 = r397647 <= r397648;
double r397650 = -1.0;
double r397651 = -1.636890293131895e-160;
bool r397652 = r397647 <= r397651;
double r397653 = x;
double r397654 = r397653 * r397653;
double r397655 = 4.0;
double r397656 = r397647 * r397655;
double r397657 = r397656 * r397647;
double r397658 = r397654 - r397657;
double r397659 = fma(r397653, r397653, r397657);
double r397660 = r397658 / r397659;
double r397661 = log1p(r397660);
double r397662 = expm1(r397661);
double r397663 = 1.5753976874379915e-55;
bool r397664 = r397647 <= r397663;
double r397665 = 1.0;
double r397666 = 8.134021215145638e-38;
bool r397667 = r397647 <= r397666;
double r397668 = expm1(r397660);
double r397669 = log1p(r397668);
double r397670 = 98355.24381927797;
bool r397671 = r397647 <= r397670;
double r397672 = r397671 ? r397665 : r397650;
double r397673 = r397667 ? r397669 : r397672;
double r397674 = r397664 ? r397665 : r397673;
double r397675 = r397652 ? r397662 : r397674;
double r397676 = r397649 ? r397650 : r397675;
return r397676;
}




Bits error versus x




Bits error versus y
| Original | 31.2 |
|---|---|
| Target | 30.9 |
| Herbie | 13.9 |
if y < -4.75816735826197e+148 or 98355.24381927797 < y Initial program 47.9
Simplified47.9
Taylor expanded around 0 13.3
if -4.75816735826197e+148 < y < -1.636890293131895e-160Initial program 16.0
Simplified16.0
rmApplied expm1-log1p-u16.1
if -1.636890293131895e-160 < y < 1.5753976874379915e-55 or 8.134021215145638e-38 < y < 98355.24381927797Initial program 24.9
Simplified24.9
Taylor expanded around inf 12.6
if 1.5753976874379915e-55 < y < 8.134021215145638e-38Initial program 20.1
Simplified20.1
rmApplied log1p-expm1-u20.1
Final simplification13.9
herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< (/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))) 0.974323384962678118) (- (/ (* x x) (+ (* x x) (* (* y y) 4))) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4)))) 2) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))))
(/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))))