(FPCore (x y z) :precision binary64 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
(FPCore (x y z)
:precision binary64
(let* ((t_0
(*
2.0
(pow (exp (* 0.25 (- (log (- (- z) y)) (log (/ -1.0 x))))) 2.0))))
(if (<= y -1.9e+102)
t_0
(if (<= y -2.2e-194)
(* 2.0 (fabs (sqrt (fma x y (pow (cbrt (* z (+ y x))) 3.0)))))
(if (<= y 4.4e-297)
t_0
(if (<= y 1.6e-173)
(* 2.0 (pow (exp (* 0.25 (- (log (+ y x)) (log (/ 1.0 z))))) 2.0))
(if (<= y 5.5e+73)
(* 2.0 (fabs (sqrt (fma z (+ y x) (* y x)))))
(*
2.0
(pow
(exp (* 0.25 (- (log (+ z x)) (log (/ 1.0 y)))))
2.0)))))))))double code(double x, double y, double z) {
return 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
}
double code(double x, double y, double z) {
double t_0 = 2.0 * pow(exp((0.25 * (log((-z - y)) - log((-1.0 / x))))), 2.0);
double tmp;
if (y <= -1.9e+102) {
tmp = t_0;
} else if (y <= -2.2e-194) {
tmp = 2.0 * fabs(sqrt(fma(x, y, pow(cbrt((z * (y + x))), 3.0))));
} else if (y <= 4.4e-297) {
tmp = t_0;
} else if (y <= 1.6e-173) {
tmp = 2.0 * pow(exp((0.25 * (log((y + x)) - log((1.0 / z))))), 2.0);
} else if (y <= 5.5e+73) {
tmp = 2.0 * fabs(sqrt(fma(z, (y + x), (y * x))));
} else {
tmp = 2.0 * pow(exp((0.25 * (log((z + x)) - log((1.0 / y))))), 2.0);
}
return tmp;
}
function code(x, y, z) return Float64(2.0 * sqrt(Float64(Float64(Float64(x * y) + Float64(x * z)) + Float64(y * z)))) end
function code(x, y, z) t_0 = Float64(2.0 * (exp(Float64(0.25 * Float64(log(Float64(Float64(-z) - y)) - log(Float64(-1.0 / x))))) ^ 2.0)) tmp = 0.0 if (y <= -1.9e+102) tmp = t_0; elseif (y <= -2.2e-194) tmp = Float64(2.0 * abs(sqrt(fma(x, y, (cbrt(Float64(z * Float64(y + x))) ^ 3.0))))); elseif (y <= 4.4e-297) tmp = t_0; elseif (y <= 1.6e-173) tmp = Float64(2.0 * (exp(Float64(0.25 * Float64(log(Float64(y + x)) - log(Float64(1.0 / z))))) ^ 2.0)); elseif (y <= 5.5e+73) tmp = Float64(2.0 * abs(sqrt(fma(z, Float64(y + x), Float64(y * x))))); else tmp = Float64(2.0 * (exp(Float64(0.25 * Float64(log(Float64(z + x)) - log(Float64(1.0 / y))))) ^ 2.0)); end return tmp end
code[x_, y_, z_] := N[(2.0 * N[Sqrt[N[(N[(N[(x * y), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(2.0 * N[Power[N[Exp[N[(0.25 * N[(N[Log[N[((-z) - y), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.9e+102], t$95$0, If[LessEqual[y, -2.2e-194], N[(2.0 * N[Abs[N[Sqrt[N[(x * y + N[Power[N[Power[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e-297], t$95$0, If[LessEqual[y, 1.6e-173], N[(2.0 * N[Power[N[Exp[N[(0.25 * N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] - N[Log[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+73], N[(2.0 * N[Abs[N[Sqrt[N[(z * N[(y + x), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Power[N[Exp[N[(0.25 * N[(N[Log[N[(z + x), $MachinePrecision]], $MachinePrecision] - N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\begin{array}{l}
t_0 := 2 \cdot {\left(e^{0.25 \cdot \left(\log \left(\left(-z\right) - y\right) - \log \left(\frac{-1}{x}\right)\right)}\right)}^{2}\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-194}:\\
\;\;\;\;2 \cdot \left|\sqrt{\mathsf{fma}\left(x, y, {\left(\sqrt[3]{z \cdot \left(y + x\right)}\right)}^{3}\right)}\right|\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-297}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-173}:\\
\;\;\;\;2 \cdot {\left(e^{0.25 \cdot \left(\log \left(y + x\right) - \log \left(\frac{1}{z}\right)\right)}\right)}^{2}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+73}:\\
\;\;\;\;2 \cdot \left|\sqrt{\mathsf{fma}\left(z, y + x, y \cdot x\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {\left(e^{0.25 \cdot \left(\log \left(z + x\right) - \log \left(\frac{1}{y}\right)\right)}\right)}^{2}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 19.8 |
|---|---|
| Target | 11.7 |
| Herbie | 5.4 |
if y < -1.89999999999999989e102 or -2.2000000000000001e-194 < y < 4.3999999999999997e-297Initial program 46.9
Simplified46.9
Applied egg-rr47.0
Taylor expanded in x around -inf 6.8
if -1.89999999999999989e102 < y < -2.2000000000000001e-194Initial program 5.6
Simplified5.6
Applied egg-rr6.0
Applied egg-rr5.6
Applied egg-rr5.6
if 4.3999999999999997e-297 < y < 1.6e-173Initial program 12.0
Simplified12.0
Applied egg-rr12.3
Taylor expanded in z around inf 6.2
if 1.6e-173 < y < 5.5000000000000003e73Initial program 2.9
Simplified2.9
Applied egg-rr3.3
Applied egg-rr2.9
Taylor expanded in x around 0 2.9
Simplified2.9
if 5.5000000000000003e73 < y Initial program 51.6
Simplified51.6
Applied egg-rr51.7
Taylor expanded in y around inf 7.1
Final simplification5.4
herbie shell --seed 2022169
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:descartes from diagrams-contrib-1.3.0.5"
:precision binary64
:herbie-target
(if (< z 7.636950090573675e+176) (* 2.0 (sqrt (+ (* (+ x y) z) (* x y)))) (* (* (+ (* 0.25 (* (* (pow y -0.75) (* (pow z -0.75) x)) (+ y z))) (* (pow z 0.25) (pow y 0.25))) (+ (* 0.25 (* (* (pow y -0.75) (* (pow z -0.75) x)) (+ y z))) (* (pow z 0.25) (pow y 0.25)))) 2.0))
(* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))