(FPCore (x y) :precision binary64 (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))
(FPCore (x y)
:precision binary64
(let* ((t_0
(log
(sqrt
(exp
(/ (fma -4.0 (* y y) (* x x)) (pow (hypot x (* y 2.0)) 2.0)))))))
(if (<= x -4.3416912027427956e+26)
1.0
(if (<= x 5.608377203181558e-58)
-1.0
(if (<= x 5.032080348772434e+85)
(+ t_0 t_0)
(if (<= x 1.1936372032097385e+132) -1.0 1.0))))))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 t_0 = log(sqrt(exp((fma(-4.0, (y * y), (x * x)) / pow(hypot(x, (y * 2.0)), 2.0)))));
double tmp;
if (x <= -4.3416912027427956e+26) {
tmp = 1.0;
} else if (x <= 5.608377203181558e-58) {
tmp = -1.0;
} else if (x <= 5.032080348772434e+85) {
tmp = t_0 + t_0;
} else if (x <= 1.1936372032097385e+132) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
function code(x, y) return Float64(Float64(Float64(x * x) - Float64(Float64(y * 4.0) * y)) / Float64(Float64(x * x) + Float64(Float64(y * 4.0) * y))) end
function code(x, y) t_0 = log(sqrt(exp(Float64(fma(-4.0, Float64(y * y), Float64(x * x)) / (hypot(x, Float64(y * 2.0)) ^ 2.0))))) tmp = 0.0 if (x <= -4.3416912027427956e+26) tmp = 1.0; elseif (x <= 5.608377203181558e-58) tmp = -1.0; elseif (x <= 5.032080348772434e+85) tmp = Float64(t_0 + t_0); elseif (x <= 1.1936372032097385e+132) tmp = -1.0; else tmp = 1.0; end return tmp end
code[x_, y_] := N[(N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[Log[N[Sqrt[N[Exp[N[(N[(-4.0 * N[(y * y), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] / N[Power[N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4.3416912027427956e+26], 1.0, If[LessEqual[x, 5.608377203181558e-58], -1.0, If[LessEqual[x, 5.032080348772434e+85], N[(t$95$0 + t$95$0), $MachinePrecision], If[LessEqual[x, 1.1936372032097385e+132], -1.0, 1.0]]]]]
\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}
\begin{array}{l}
t_0 := \log \left(\sqrt{e^{\frac{\mathsf{fma}\left(-4, y \cdot y, x \cdot x\right)}{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}}}\right)\\
\mathbf{if}\;x \leq -4.3416912027427956 \cdot 10^{+26}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.608377203181558 \cdot 10^{-58}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 5.032080348772434 \cdot 10^{+85}:\\
\;\;\;\;t_0 + t_0\\
\mathbf{elif}\;x \leq 1.1936372032097385 \cdot 10^{+132}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}




Bits error versus x




Bits error versus y
| Original | 31.2 |
|---|---|
| Target | 30.9 |
| Herbie | 15.4 |
if x < -4.3416912027427956e26 or 1.1936372032097385e132 < x Initial program 48.2
Simplified48.2
Taylor expanded in y around 0 12.6
if -4.3416912027427956e26 < x < 5.6083772031815579e-58 or 5.03208034877243396e85 < x < 1.1936372032097385e132Initial program 22.8
Simplified22.8
Taylor expanded in y around inf 17.4
if 5.6083772031815579e-58 < x < 5.03208034877243396e85Initial program 15.6
Simplified15.6
Applied egg-rr15.6
Final simplification15.4
herbie shell --seed 2022133
(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))))