(FPCore (x y z) :precision binary64 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ y z))))
(if (<= x 9.6e-306)
(* 2.0 (fabs (sqrt (fma y z t_0))))
(* 2.0 (hypot (sqrt t_0) (* (sqrt y) (sqrt z)))))))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 = x * (y + z);
double tmp;
if (x <= 9.6e-306) {
tmp = 2.0 * fabs(sqrt(fma(y, z, t_0)));
} else {
tmp = 2.0 * hypot(sqrt(t_0), (sqrt(y) * sqrt(z)));
}
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(x * Float64(y + z)) tmp = 0.0 if (x <= 9.6e-306) tmp = Float64(2.0 * abs(sqrt(fma(y, z, t_0)))); else tmp = Float64(2.0 * hypot(sqrt(t_0), Float64(sqrt(y) * sqrt(z)))); 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[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 9.6e-306], N[(2.0 * N[Abs[N[Sqrt[N[(y * z + t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Sqrt[N[Sqrt[t$95$0], $MachinePrecision] ^ 2 + N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]]
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\begin{array}{l}
t_0 := x \cdot \left(y + z\right)\\
\mathbf{if}\;x \leq 9.6 \cdot 10^{-306}:\\
\;\;\;\;2 \cdot \left|\sqrt{\mathsf{fma}\left(y, z, t_0\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{hypot}\left(\sqrt{t_0}, \sqrt{y} \cdot \sqrt{z}\right)\\
\end{array}
| Original | 20.1 |
|---|---|
| Target | 11.3 |
| Herbie | 16.0 |
if x < 9.5999999999999998e-306Initial program 19.7
Applied egg-rr32.5
Applied egg-rr19.7
if 9.5999999999999998e-306 < x Initial program 21.4
Applied egg-rr21.5
Applied egg-rr4.9
Final simplification16.0
herbie shell --seed 2022192
(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)))))