\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 \leq -6.782623048135753 \cdot 10^{+135}:\\
\;\;\;\;-1 + 0.5 \cdot \left(\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{y} \cdot \sqrt[3]{y}}\right) \cdot \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right)\right)\\
\mathbf{elif}\;y \leq -2.0471170134376602 \cdot 10^{-106}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{x \cdot x + \left(y \cdot y\right) \cdot -4}{x \cdot x + \left(y \cdot y\right) \cdot 4}\right)}^{3}}\\
\mathbf{elif}\;y \leq 1.5065991278181313 \cdot 10^{-140}:\\
\;\;\;\;\sqrt[3]{1}\\
\mathbf{elif}\;y \leq 7.090214672623547 \cdot 10^{+79}:\\
\;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{-1 + 0.5 \cdot \left(\frac{x}{y} \cdot \frac{x}{y}\right)} \cdot \left(\sqrt[3]{-1 + 0.5 \cdot \left(\frac{x}{y} \cdot \frac{x}{y}\right)} \cdot \sqrt[3]{-1 + 0.5 \cdot \left(\frac{x}{y} \cdot \frac{x}{y}\right)}\right)\\
\end{array}(FPCore (x y) :precision binary64 (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))
(FPCore (x y)
:precision binary64
(if (<= y -6.782623048135753e+135)
(+
-1.0
(*
0.5
(*
(*
(/ (* (cbrt x) (cbrt x)) (* (cbrt y) (cbrt y)))
(/ (* (cbrt x) (cbrt x)) (* (cbrt y) (cbrt y))))
(* (/ (cbrt x) (cbrt y)) (/ (cbrt x) (cbrt y))))))
(if (<= y -2.0471170134376602e-106)
(cbrt
(pow (/ (+ (* x x) (* (* y y) -4.0)) (+ (* x x) (* (* y y) 4.0))) 3.0))
(if (<= y 1.5065991278181313e-140)
(cbrt 1.0)
(if (<= y 7.090214672623547e+79)
(/ (- (* x x) (* y (* y 4.0))) (+ (* x x) (* y (* y 4.0))))
(*
(cbrt (+ -1.0 (* 0.5 (* (/ x y) (/ x y)))))
(*
(cbrt (+ -1.0 (* 0.5 (* (/ x y) (/ x y)))))
(cbrt (+ -1.0 (* 0.5 (* (/ x y) (/ x y))))))))))))double code(double x, double y) {
return ((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y));
}
double code(double x, double y) {
double tmp;
if (y <= -6.782623048135753e+135) {
tmp = -1.0 + (0.5 * ((((cbrt(x) * cbrt(x)) / (cbrt(y) * cbrt(y))) * ((cbrt(x) * cbrt(x)) / (cbrt(y) * cbrt(y)))) * ((cbrt(x) / cbrt(y)) * (cbrt(x) / cbrt(y)))));
} else if (y <= -2.0471170134376602e-106) {
tmp = cbrt(pow((((x * x) + ((y * y) * -4.0)) / ((x * x) + ((y * y) * 4.0))), 3.0));
} else if (y <= 1.5065991278181313e-140) {
tmp = cbrt(1.0);
} else if (y <= 7.090214672623547e+79) {
tmp = ((x * x) - (y * (y * 4.0))) / ((x * x) + (y * (y * 4.0)));
} else {
tmp = cbrt(-1.0 + (0.5 * ((x / y) * (x / y)))) * (cbrt(-1.0 + (0.5 * ((x / y) * (x / y)))) * cbrt(-1.0 + (0.5 * ((x / y) * (x / y)))));
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.9 |
|---|---|
| Target | 31.6 |
| Herbie | 12.6 |
if y < -6.78262304813575286e135Initial program 59.6
Taylor expanded around 0 16.9
Simplified16.9
rmApplied times-frac_binary648.9
Simplified9.2
Simplified8.9
rmApplied add-cube-cbrt_binary648.9
Applied add-cube-cbrt_binary648.9
Applied times-frac_binary648.9
Applied fabs-mul_binary648.9
Applied add-cube-cbrt_binary648.9
Applied add-cube-cbrt_binary648.9
Applied times-frac_binary648.9
Applied fabs-mul_binary648.9
Applied swap-sqr_binary648.9
if -6.78262304813575286e135 < y < -2.04711701343766017e-106Initial program 16.7
rmApplied add-cbrt-cube_binary6416.7
Simplified16.7
if -2.04711701343766017e-106 < y < 1.50659912781813125e-140Initial program 27.5
rmApplied add-cbrt-cube_binary6427.5
Simplified27.5
Taylor expanded around inf 9.5
if 1.50659912781813125e-140 < y < 7.0902146726235471e79Initial program 16.7
rmApplied +-commutative_binary6416.7
if 7.0902146726235471e79 < y Initial program 49.4
Taylor expanded around 0 17.5
Simplified17.5
rmApplied times-frac_binary6411.9
Simplified12.1
Simplified11.9
rmApplied add-cube-cbrt_binary6411.9
Final simplification12.6
herbie shell --seed 2021139
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:precision binary64
: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))))