
(FPCore (x y z) :precision binary64 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
double code(double x, double y, double z) {
return 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 * sqrt((((x * y) + (x * z)) + (y * z)))
end function
public static double code(double x, double y, double z) {
return 2.0 * Math.sqrt((((x * y) + (x * z)) + (y * z)));
}
def code(x, y, z): return 2.0 * math.sqrt((((x * y) + (x * z)) + (y * z)))
function code(x, y, z) return Float64(2.0 * sqrt(Float64(Float64(Float64(x * y) + Float64(x * z)) + Float64(y * z)))) end
function tmp = code(x, y, z) tmp = 2.0 * sqrt((((x * y) + (x * z)) + (y * z))); 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]
\begin{array}{l}
\\
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
double code(double x, double y, double z) {
return 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 * sqrt((((x * y) + (x * z)) + (y * z)))
end function
public static double code(double x, double y, double z) {
return 2.0 * Math.sqrt((((x * y) + (x * z)) + (y * z)));
}
def code(x, y, z): return 2.0 * math.sqrt((((x * y) + (x * z)) + (y * z)))
function code(x, y, z) return Float64(2.0 * sqrt(Float64(Float64(Float64(x * y) + Float64(x * z)) + Float64(y * z)))) end
function tmp = code(x, y, z) tmp = 2.0 * sqrt((((x * y) + (x * z)) + (y * z))); 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]
\begin{array}{l}
\\
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\end{array}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0
(*
2.0
(pow (exp (* 0.25 (- (log (- (- y) z)) (log (/ -1.0 x))))) 2.0))))
(if (<= y -2.4e+39)
t_0
(if (<= y -5.4e-173)
(* 2.0 (sqrt (* x (+ y (+ z (* y (/ z x)))))))
(if (<= y 3e-290)
t_0
(if (<= y 2.25e-235)
(* 2.0 (* (sqrt z) (sqrt y)))
(if (<= y 3e+57)
(*
2.0
(sqrt (fma (pow (cbrt x) 2.0) (* y (cbrt x)) (* z (+ y x)))))
(*
2.0
(*
z
(+
(/ 1.0 (sqrt (/ z (+ y x))))
(* 0.5 (* x (sqrt (/ y (pow z 3.0)))))))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = 2.0 * pow(exp((0.25 * (log((-y - z)) - log((-1.0 / x))))), 2.0);
double tmp;
if (y <= -2.4e+39) {
tmp = t_0;
} else if (y <= -5.4e-173) {
tmp = 2.0 * sqrt((x * (y + (z + (y * (z / x))))));
} else if (y <= 3e-290) {
tmp = t_0;
} else if (y <= 2.25e-235) {
tmp = 2.0 * (sqrt(z) * sqrt(y));
} else if (y <= 3e+57) {
tmp = 2.0 * sqrt(fma(pow(cbrt(x), 2.0), (y * cbrt(x)), (z * (y + x))));
} else {
tmp = 2.0 * (z * ((1.0 / sqrt((z / (y + x)))) + (0.5 * (x * sqrt((y / pow(z, 3.0)))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = Float64(2.0 * (exp(Float64(0.25 * Float64(log(Float64(Float64(-y) - z)) - log(Float64(-1.0 / x))))) ^ 2.0)) tmp = 0.0 if (y <= -2.4e+39) tmp = t_0; elseif (y <= -5.4e-173) tmp = Float64(2.0 * sqrt(Float64(x * Float64(y + Float64(z + Float64(y * Float64(z / x))))))); elseif (y <= 3e-290) tmp = t_0; elseif (y <= 2.25e-235) tmp = Float64(2.0 * Float64(sqrt(z) * sqrt(y))); elseif (y <= 3e+57) tmp = Float64(2.0 * sqrt(fma((cbrt(x) ^ 2.0), Float64(y * cbrt(x)), Float64(z * Float64(y + x))))); else tmp = Float64(2.0 * Float64(z * Float64(Float64(1.0 / sqrt(Float64(z / Float64(y + x)))) + Float64(0.5 * Float64(x * sqrt(Float64(y / (z ^ 3.0)))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(2.0 * N[Power[N[Exp[N[(0.25 * N[(N[Log[N[((-y) - z), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4e+39], t$95$0, If[LessEqual[y, -5.4e-173], N[(2.0 * N[Sqrt[N[(x * N[(y + N[(z + N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e-290], t$95$0, If[LessEqual[y, 2.25e-235], N[(2.0 * N[(N[Sqrt[z], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+57], N[(2.0 * N[Sqrt[N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[(y * N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[(N[(1.0 / N[Sqrt[N[(z / N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := 2 \cdot {\left(e^{0.25 \cdot \left(\log \left(\left(-y\right) - z\right) - \log \left(\frac{-1}{x}\right)\right)}\right)}^{2}\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{+39}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-173}:\\
\;\;\;\;2 \cdot \sqrt{x \cdot \left(y + \left(z + y \cdot \frac{z}{x}\right)\right)}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-290}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{-235}:\\
\;\;\;\;2 \cdot \left(\sqrt{z} \cdot \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+57}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{2}, y \cdot \sqrt[3]{x}, z \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \left(\frac{1}{\sqrt{\frac{z}{y + x}}} + 0.5 \cdot \left(x \cdot \sqrt{\frac{y}{{z}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < -2.4000000000000001e39 or -5.3999999999999999e-173 < y < 2.99999999999999992e-290Initial program 64.8%
associate-+l+64.8%
*-commutative64.8%
*-commutative64.8%
*-commutative64.8%
+-commutative64.8%
+-commutative64.8%
associate-+l+64.8%
*-commutative64.8%
*-commutative64.8%
+-commutative64.8%
+-commutative64.8%
*-commutative64.8%
associate-+l+64.8%
+-commutative64.8%
distribute-rgt-in65.0%
Simplified65.0%
add-sqr-sqrt64.7%
pow264.7%
pow1/264.7%
sqrt-pow164.7%
distribute-rgt-in64.6%
associate-+r+64.6%
*-commutative64.6%
distribute-lft-in64.6%
fma-define65.0%
metadata-eval65.0%
Applied egg-rr65.0%
Taylor expanded in x around -inf 48.3%
if -2.4000000000000001e39 < y < -5.3999999999999999e-173Initial program 83.8%
associate-+l+83.8%
*-commutative83.8%
*-commutative83.8%
*-commutative83.8%
+-commutative83.8%
+-commutative83.8%
associate-+l+83.8%
*-commutative83.8%
*-commutative83.8%
+-commutative83.8%
+-commutative83.8%
*-commutative83.8%
associate-+l+83.8%
+-commutative83.8%
distribute-rgt-in83.8%
Simplified83.8%
Taylor expanded in x around inf 75.6%
associate-/l*72.8%
Simplified72.8%
if 2.99999999999999992e-290 < y < 2.2499999999999999e-235Initial program 83.9%
associate-+l+83.9%
*-commutative83.9%
*-commutative83.9%
*-commutative83.9%
+-commutative83.9%
+-commutative83.9%
+-commutative83.9%
*-commutative83.9%
*-commutative83.9%
associate-+l+83.9%
+-commutative83.9%
fma-define83.9%
distribute-lft-out83.9%
Simplified83.9%
fma-undefine83.9%
+-commutative83.9%
Applied egg-rr83.9%
Taylor expanded in x around 0 11.4%
*-commutative11.4%
Simplified11.4%
sqrt-prod11.2%
Applied egg-rr11.2%
if 2.2499999999999999e-235 < y < 3e57Initial program 86.3%
associate-+l+86.3%
*-commutative86.3%
*-commutative86.3%
*-commutative86.3%
+-commutative86.3%
+-commutative86.3%
associate-+l+86.3%
*-commutative86.3%
*-commutative86.3%
+-commutative86.3%
+-commutative86.3%
*-commutative86.3%
associate-+l+86.3%
+-commutative86.3%
distribute-rgt-in86.3%
Simplified86.3%
add-cube-cbrt85.9%
associate-*l*86.0%
fma-define86.0%
pow286.0%
+-commutative86.0%
Applied egg-rr86.0%
if 3e57 < y Initial program 40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
*-commutative40.4%
associate-+l+40.4%
+-commutative40.4%
distribute-rgt-in40.6%
Simplified40.6%
Taylor expanded in z around inf 39.8%
+-commutative39.8%
associate-*l*44.0%
associate-/r*44.0%
+-commutative44.0%
Simplified44.0%
Taylor expanded in y around inf 44.7%
clear-num44.7%
sqrt-div44.7%
metadata-eval44.7%
Applied egg-rr44.7%
Final simplification57.2%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0
(*
2.0
(pow (exp (* 0.25 (- (log (- (- y) z)) (log (/ -1.0 x))))) 2.0))))
(if (<= y -1.9e+41)
t_0
(if (<= y -5.4e-173)
(* 2.0 (sqrt (* x (+ y (+ z (* y (/ z x)))))))
(if (<= y 2.15e-285)
t_0
(if (<= y 2.25e-235)
(* 2.0 (* (sqrt z) (sqrt y)))
(if (<= y 1.9e+56)
(* 2.0 (sqrt (* z (+ y x))))
(*
2.0
(*
z
(+
(/ 1.0 (sqrt (/ z (+ y x))))
(* 0.5 (* x (sqrt (/ y (pow z 3.0)))))))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = 2.0 * pow(exp((0.25 * (log((-y - z)) - log((-1.0 / x))))), 2.0);
double tmp;
if (y <= -1.9e+41) {
tmp = t_0;
} else if (y <= -5.4e-173) {
tmp = 2.0 * sqrt((x * (y + (z + (y * (z / x))))));
} else if (y <= 2.15e-285) {
tmp = t_0;
} else if (y <= 2.25e-235) {
tmp = 2.0 * (sqrt(z) * sqrt(y));
} else if (y <= 1.9e+56) {
tmp = 2.0 * sqrt((z * (y + x)));
} else {
tmp = 2.0 * (z * ((1.0 / sqrt((z / (y + x)))) + (0.5 * (x * sqrt((y / pow(z, 3.0)))))));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 * (exp((0.25d0 * (log((-y - z)) - log(((-1.0d0) / x))))) ** 2.0d0)
if (y <= (-1.9d+41)) then
tmp = t_0
else if (y <= (-5.4d-173)) then
tmp = 2.0d0 * sqrt((x * (y + (z + (y * (z / x))))))
else if (y <= 2.15d-285) then
tmp = t_0
else if (y <= 2.25d-235) then
tmp = 2.0d0 * (sqrt(z) * sqrt(y))
else if (y <= 1.9d+56) then
tmp = 2.0d0 * sqrt((z * (y + x)))
else
tmp = 2.0d0 * (z * ((1.0d0 / sqrt((z / (y + x)))) + (0.5d0 * (x * sqrt((y / (z ** 3.0d0)))))))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double t_0 = 2.0 * Math.pow(Math.exp((0.25 * (Math.log((-y - z)) - Math.log((-1.0 / x))))), 2.0);
double tmp;
if (y <= -1.9e+41) {
tmp = t_0;
} else if (y <= -5.4e-173) {
tmp = 2.0 * Math.sqrt((x * (y + (z + (y * (z / x))))));
} else if (y <= 2.15e-285) {
tmp = t_0;
} else if (y <= 2.25e-235) {
tmp = 2.0 * (Math.sqrt(z) * Math.sqrt(y));
} else if (y <= 1.9e+56) {
tmp = 2.0 * Math.sqrt((z * (y + x)));
} else {
tmp = 2.0 * (z * ((1.0 / Math.sqrt((z / (y + x)))) + (0.5 * (x * Math.sqrt((y / Math.pow(z, 3.0)))))));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): t_0 = 2.0 * math.pow(math.exp((0.25 * (math.log((-y - z)) - math.log((-1.0 / x))))), 2.0) tmp = 0 if y <= -1.9e+41: tmp = t_0 elif y <= -5.4e-173: tmp = 2.0 * math.sqrt((x * (y + (z + (y * (z / x)))))) elif y <= 2.15e-285: tmp = t_0 elif y <= 2.25e-235: tmp = 2.0 * (math.sqrt(z) * math.sqrt(y)) elif y <= 1.9e+56: tmp = 2.0 * math.sqrt((z * (y + x))) else: tmp = 2.0 * (z * ((1.0 / math.sqrt((z / (y + x)))) + (0.5 * (x * math.sqrt((y / math.pow(z, 3.0))))))) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = Float64(2.0 * (exp(Float64(0.25 * Float64(log(Float64(Float64(-y) - z)) - log(Float64(-1.0 / x))))) ^ 2.0)) tmp = 0.0 if (y <= -1.9e+41) tmp = t_0; elseif (y <= -5.4e-173) tmp = Float64(2.0 * sqrt(Float64(x * Float64(y + Float64(z + Float64(y * Float64(z / x))))))); elseif (y <= 2.15e-285) tmp = t_0; elseif (y <= 2.25e-235) tmp = Float64(2.0 * Float64(sqrt(z) * sqrt(y))); elseif (y <= 1.9e+56) tmp = Float64(2.0 * sqrt(Float64(z * Float64(y + x)))); else tmp = Float64(2.0 * Float64(z * Float64(Float64(1.0 / sqrt(Float64(z / Float64(y + x)))) + Float64(0.5 * Float64(x * sqrt(Float64(y / (z ^ 3.0)))))))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
t_0 = 2.0 * (exp((0.25 * (log((-y - z)) - log((-1.0 / x))))) ^ 2.0);
tmp = 0.0;
if (y <= -1.9e+41)
tmp = t_0;
elseif (y <= -5.4e-173)
tmp = 2.0 * sqrt((x * (y + (z + (y * (z / x))))));
elseif (y <= 2.15e-285)
tmp = t_0;
elseif (y <= 2.25e-235)
tmp = 2.0 * (sqrt(z) * sqrt(y));
elseif (y <= 1.9e+56)
tmp = 2.0 * sqrt((z * (y + x)));
else
tmp = 2.0 * (z * ((1.0 / sqrt((z / (y + x)))) + (0.5 * (x * sqrt((y / (z ^ 3.0)))))));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(2.0 * N[Power[N[Exp[N[(0.25 * N[(N[Log[N[((-y) - z), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.9e+41], t$95$0, If[LessEqual[y, -5.4e-173], N[(2.0 * N[Sqrt[N[(x * N[(y + N[(z + N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.15e-285], t$95$0, If[LessEqual[y, 2.25e-235], N[(2.0 * N[(N[Sqrt[z], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+56], N[(2.0 * N[Sqrt[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[(N[(1.0 / N[Sqrt[N[(z / N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := 2 \cdot {\left(e^{0.25 \cdot \left(\log \left(\left(-y\right) - z\right) - \log \left(\frac{-1}{x}\right)\right)}\right)}^{2}\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{+41}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-173}:\\
\;\;\;\;2 \cdot \sqrt{x \cdot \left(y + \left(z + y \cdot \frac{z}{x}\right)\right)}\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{-285}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{-235}:\\
\;\;\;\;2 \cdot \left(\sqrt{z} \cdot \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+56}:\\
\;\;\;\;2 \cdot \sqrt{z \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \left(\frac{1}{\sqrt{\frac{z}{y + x}}} + 0.5 \cdot \left(x \cdot \sqrt{\frac{y}{{z}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < -1.9000000000000001e41 or -5.3999999999999999e-173 < y < 2.15000000000000006e-285Initial program 65.0%
associate-+l+65.0%
*-commutative65.0%
*-commutative65.0%
*-commutative65.0%
+-commutative65.0%
+-commutative65.0%
associate-+l+65.0%
*-commutative65.0%
*-commutative65.0%
+-commutative65.0%
+-commutative65.0%
*-commutative65.0%
associate-+l+65.0%
+-commutative65.0%
distribute-rgt-in65.2%
Simplified65.2%
add-sqr-sqrt64.9%
pow264.9%
pow1/264.9%
sqrt-pow164.9%
distribute-rgt-in64.8%
associate-+r+64.8%
*-commutative64.8%
distribute-lft-in64.8%
fma-define65.2%
metadata-eval65.2%
Applied egg-rr65.2%
Taylor expanded in x around -inf 47.8%
if -1.9000000000000001e41 < y < -5.3999999999999999e-173Initial program 83.8%
associate-+l+83.8%
*-commutative83.8%
*-commutative83.8%
*-commutative83.8%
+-commutative83.8%
+-commutative83.8%
associate-+l+83.8%
*-commutative83.8%
*-commutative83.8%
+-commutative83.8%
+-commutative83.8%
*-commutative83.8%
associate-+l+83.8%
+-commutative83.8%
distribute-rgt-in83.8%
Simplified83.8%
Taylor expanded in x around inf 75.6%
associate-/l*72.8%
Simplified72.8%
if 2.15000000000000006e-285 < y < 2.2499999999999999e-235Initial program 83.8%
associate-+l+83.8%
*-commutative83.8%
*-commutative83.8%
*-commutative83.8%
+-commutative83.8%
+-commutative83.8%
+-commutative83.8%
*-commutative83.8%
*-commutative83.8%
associate-+l+83.8%
+-commutative83.8%
fma-define83.8%
distribute-lft-out83.8%
Simplified83.8%
fma-undefine83.8%
+-commutative83.8%
Applied egg-rr83.8%
Taylor expanded in x around 0 12.0%
*-commutative12.0%
Simplified12.0%
sqrt-prod11.6%
Applied egg-rr11.6%
if 2.2499999999999999e-235 < y < 1.89999999999999998e56Initial program 86.3%
associate-+l+86.3%
*-commutative86.3%
*-commutative86.3%
*-commutative86.3%
+-commutative86.3%
+-commutative86.3%
associate-+l+86.3%
*-commutative86.3%
*-commutative86.3%
+-commutative86.3%
+-commutative86.3%
*-commutative86.3%
associate-+l+86.3%
+-commutative86.3%
distribute-rgt-in86.3%
Simplified86.3%
Taylor expanded in z around inf 56.5%
+-commutative56.5%
Simplified56.5%
if 1.89999999999999998e56 < y Initial program 40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
*-commutative40.4%
associate-+l+40.4%
+-commutative40.4%
distribute-rgt-in40.6%
Simplified40.6%
Taylor expanded in z around inf 39.8%
+-commutative39.8%
associate-*l*44.0%
associate-/r*44.0%
+-commutative44.0%
Simplified44.0%
Taylor expanded in y around inf 44.7%
clear-num44.7%
sqrt-div44.7%
metadata-eval44.7%
Applied egg-rr44.7%
Final simplification50.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y -6.8e+72)
(* 2.0 (pow (exp (* 0.25 (- (log (- (- z) x)) (log (/ -1.0 y))))) 2.0))
(if (<= y 2.3e+56)
(* 2.0 (sqrt (fma x z (* y (+ z x)))))
(*
2.0
(*
z
(+
(/ 1.0 (sqrt (/ z (+ y x))))
(* 0.5 (* x (sqrt (/ y (pow z 3.0)))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -6.8e+72) {
tmp = 2.0 * pow(exp((0.25 * (log((-z - x)) - log((-1.0 / y))))), 2.0);
} else if (y <= 2.3e+56) {
tmp = 2.0 * sqrt(fma(x, z, (y * (z + x))));
} else {
tmp = 2.0 * (z * ((1.0 / sqrt((z / (y + x)))) + (0.5 * (x * sqrt((y / pow(z, 3.0)))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -6.8e+72) tmp = Float64(2.0 * (exp(Float64(0.25 * Float64(log(Float64(Float64(-z) - x)) - log(Float64(-1.0 / y))))) ^ 2.0)); elseif (y <= 2.3e+56) tmp = Float64(2.0 * sqrt(fma(x, z, Float64(y * Float64(z + x))))); else tmp = Float64(2.0 * Float64(z * Float64(Float64(1.0 / sqrt(Float64(z / Float64(y + x)))) + Float64(0.5 * Float64(x * sqrt(Float64(y / (z ^ 3.0)))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -6.8e+72], 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], If[LessEqual[y, 2.3e+56], N[(2.0 * N[Sqrt[N[(x * z + N[(y * N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[(N[(1.0 / N[Sqrt[N[(z / N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot {\left(e^{0.25 \cdot \left(\log \left(\left(-z\right) - x\right) - \log \left(\frac{-1}{y}\right)\right)}\right)}^{2}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+56}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, z, y \cdot \left(z + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \left(\frac{1}{\sqrt{\frac{z}{y + x}}} + 0.5 \cdot \left(x \cdot \sqrt{\frac{y}{{z}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < -6.7999999999999997e72Initial program 53.1%
associate-+l+53.1%
*-commutative53.1%
*-commutative53.1%
*-commutative53.1%
+-commutative53.1%
+-commutative53.1%
associate-+l+53.1%
*-commutative53.1%
*-commutative53.1%
+-commutative53.1%
+-commutative53.1%
*-commutative53.1%
associate-+l+53.1%
+-commutative53.1%
distribute-rgt-in53.2%
Simplified53.2%
add-sqr-sqrt53.1%
pow253.1%
pow1/253.1%
sqrt-pow153.2%
distribute-rgt-in53.0%
associate-+r+53.0%
*-commutative53.0%
distribute-lft-in53.1%
fma-define53.7%
metadata-eval53.7%
Applied egg-rr53.7%
Taylor expanded in y around -inf 87.0%
if -6.7999999999999997e72 < y < 2.30000000000000015e56Initial program 83.2%
associate-+l+83.2%
*-commutative83.2%
*-commutative83.2%
*-commutative83.2%
+-commutative83.2%
+-commutative83.2%
+-commutative83.2%
*-commutative83.2%
*-commutative83.2%
associate-+l+83.2%
+-commutative83.2%
fma-define83.2%
distribute-lft-out83.2%
Simplified83.2%
if 2.30000000000000015e56 < y Initial program 40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
*-commutative40.4%
associate-+l+40.4%
+-commutative40.4%
distribute-rgt-in40.6%
Simplified40.6%
Taylor expanded in z around inf 39.8%
+-commutative39.8%
associate-*l*44.0%
associate-/r*44.0%
+-commutative44.0%
Simplified44.0%
Taylor expanded in y around inf 44.7%
clear-num44.7%
sqrt-div44.7%
metadata-eval44.7%
Applied egg-rr44.7%
Final simplification75.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y -3.8e+77)
(*
2.0
(*
y
(-
(* 0.5 (* (sqrt (/ 1.0 (* (+ z x) (pow y 3.0)))) (* z x)))
(sqrt (/ (+ z x) y)))))
(if (<= y 1.9e+56)
(* 2.0 (sqrt (fma x z (* y (+ z x)))))
(*
2.0
(*
z
(+
(/ 1.0 (sqrt (/ z (+ y x))))
(* 0.5 (* x (sqrt (/ y (pow z 3.0)))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+77) {
tmp = 2.0 * (y * ((0.5 * (sqrt((1.0 / ((z + x) * pow(y, 3.0)))) * (z * x))) - sqrt(((z + x) / y))));
} else if (y <= 1.9e+56) {
tmp = 2.0 * sqrt(fma(x, z, (y * (z + x))));
} else {
tmp = 2.0 * (z * ((1.0 / sqrt((z / (y + x)))) + (0.5 * (x * sqrt((y / pow(z, 3.0)))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -3.8e+77) tmp = Float64(2.0 * Float64(y * Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / Float64(Float64(z + x) * (y ^ 3.0)))) * Float64(z * x))) - sqrt(Float64(Float64(z + x) / y))))); elseif (y <= 1.9e+56) tmp = Float64(2.0 * sqrt(fma(x, z, Float64(y * Float64(z + x))))); else tmp = Float64(2.0 * Float64(z * Float64(Float64(1.0 / sqrt(Float64(z / Float64(y + x)))) + Float64(0.5 * Float64(x * sqrt(Float64(y / (z ^ 3.0)))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -3.8e+77], N[(2.0 * N[(y * N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / N[(N[(z + x), $MachinePrecision] * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(N[(z + x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+56], N[(2.0 * N[Sqrt[N[(x * z + N[(y * N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[(N[(1.0 / N[Sqrt[N[(z / N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+77}:\\
\;\;\;\;2 \cdot \left(y \cdot \left(0.5 \cdot \left(\sqrt{\frac{1}{\left(z + x\right) \cdot {y}^{3}}} \cdot \left(z \cdot x\right)\right) - \sqrt{\frac{z + x}{y}}\right)\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+56}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, z, y \cdot \left(z + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \left(\frac{1}{\sqrt{\frac{z}{y + x}}} + 0.5 \cdot \left(x \cdot \sqrt{\frac{y}{{z}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < -3.8000000000000001e77Initial program 53.1%
associate-+l+53.1%
*-commutative53.1%
*-commutative53.1%
*-commutative53.1%
+-commutative53.1%
+-commutative53.1%
associate-+l+53.1%
*-commutative53.1%
*-commutative53.1%
+-commutative53.1%
+-commutative53.1%
*-commutative53.1%
associate-+l+53.1%
+-commutative53.1%
distribute-rgt-in53.2%
Simplified53.2%
Taylor expanded in y around inf 0.8%
+-commutative0.8%
*-commutative0.8%
+-commutative0.8%
Simplified0.8%
Taylor expanded in y around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt76.7%
+-commutative76.7%
Simplified76.7%
if -3.8000000000000001e77 < y < 1.89999999999999998e56Initial program 83.2%
associate-+l+83.2%
*-commutative83.2%
*-commutative83.2%
*-commutative83.2%
+-commutative83.2%
+-commutative83.2%
+-commutative83.2%
*-commutative83.2%
*-commutative83.2%
associate-+l+83.2%
+-commutative83.2%
fma-define83.2%
distribute-lft-out83.2%
Simplified83.2%
if 1.89999999999999998e56 < y Initial program 40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
*-commutative40.4%
associate-+l+40.4%
+-commutative40.4%
distribute-rgt-in40.6%
Simplified40.6%
Taylor expanded in z around inf 39.8%
+-commutative39.8%
associate-*l*44.0%
associate-/r*44.0%
+-commutative44.0%
Simplified44.0%
Taylor expanded in y around inf 44.7%
clear-num44.7%
sqrt-div44.7%
metadata-eval44.7%
Applied egg-rr44.7%
Final simplification73.7%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y 4.8e+58)
(* 2.0 (sqrt (fma x z (* y (+ z x)))))
(*
2.0
(*
z
(+
(/ 1.0 (sqrt (/ z (+ y x))))
(* 0.5 (* x (sqrt (/ y (pow z 3.0))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 4.8e+58) {
tmp = 2.0 * sqrt(fma(x, z, (y * (z + x))));
} else {
tmp = 2.0 * (z * ((1.0 / sqrt((z / (y + x)))) + (0.5 * (x * sqrt((y / pow(z, 3.0)))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 4.8e+58) tmp = Float64(2.0 * sqrt(fma(x, z, Float64(y * Float64(z + x))))); else tmp = Float64(2.0 * Float64(z * Float64(Float64(1.0 / sqrt(Float64(z / Float64(y + x)))) + Float64(0.5 * Float64(x * sqrt(Float64(y / (z ^ 3.0)))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 4.8e+58], N[(2.0 * N[Sqrt[N[(x * z + N[(y * N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[(N[(1.0 / N[Sqrt[N[(z / N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{+58}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, z, y \cdot \left(z + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \left(\frac{1}{\sqrt{\frac{z}{y + x}}} + 0.5 \cdot \left(x \cdot \sqrt{\frac{y}{{z}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < 4.8e58Initial program 75.3%
associate-+l+75.3%
*-commutative75.3%
*-commutative75.3%
*-commutative75.3%
+-commutative75.3%
+-commutative75.3%
+-commutative75.3%
*-commutative75.3%
*-commutative75.3%
associate-+l+75.3%
+-commutative75.3%
fma-define75.3%
distribute-lft-out75.4%
Simplified75.4%
if 4.8e58 < y Initial program 40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
*-commutative40.4%
associate-+l+40.4%
+-commutative40.4%
distribute-rgt-in40.6%
Simplified40.6%
Taylor expanded in z around inf 39.8%
+-commutative39.8%
associate-*l*44.0%
associate-/r*44.0%
+-commutative44.0%
Simplified44.0%
Taylor expanded in y around inf 44.7%
clear-num44.7%
sqrt-div44.7%
metadata-eval44.7%
Applied egg-rr44.7%
Final simplification68.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y 1.3e+20)
(* 2.0 (sqrt (fma x z (* y (+ z x)))))
(*
2.0
(* z (+ (* 0.5 (* x (sqrt (/ y (pow z 3.0))))) (sqrt (/ (+ y x) z)))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 1.3e+20) {
tmp = 2.0 * sqrt(fma(x, z, (y * (z + x))));
} else {
tmp = 2.0 * (z * ((0.5 * (x * sqrt((y / pow(z, 3.0))))) + sqrt(((y + x) / z))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 1.3e+20) tmp = Float64(2.0 * sqrt(fma(x, z, Float64(y * Float64(z + x))))); else tmp = Float64(2.0 * Float64(z * Float64(Float64(0.5 * Float64(x * sqrt(Float64(y / (z ^ 3.0))))) + sqrt(Float64(Float64(y + x) / z))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 1.3e+20], N[(2.0 * N[Sqrt[N[(x * z + N[(y * N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[(N[(0.5 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(y + x), $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{+20}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, z, y \cdot \left(z + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \left(0.5 \cdot \left(x \cdot \sqrt{\frac{y}{{z}^{3}}}\right) + \sqrt{\frac{y + x}{z}}\right)\right)\\
\end{array}
\end{array}
if y < 1.3e20Initial program 74.4%
associate-+l+74.4%
*-commutative74.4%
*-commutative74.4%
*-commutative74.4%
+-commutative74.4%
+-commutative74.4%
+-commutative74.4%
*-commutative74.4%
*-commutative74.4%
associate-+l+74.4%
+-commutative74.4%
fma-define74.5%
distribute-lft-out74.6%
Simplified74.6%
if 1.3e20 < y Initial program 47.2%
associate-+l+47.2%
*-commutative47.2%
*-commutative47.2%
*-commutative47.2%
+-commutative47.2%
+-commutative47.2%
associate-+l+47.2%
*-commutative47.2%
*-commutative47.2%
+-commutative47.2%
+-commutative47.2%
*-commutative47.2%
associate-+l+47.2%
+-commutative47.2%
distribute-rgt-in47.3%
Simplified47.3%
Taylor expanded in z around inf 37.0%
+-commutative37.0%
associate-*l*40.8%
associate-/r*40.8%
+-commutative40.8%
Simplified40.8%
Taylor expanded in y around inf 41.4%
Final simplification66.7%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y 0.028)
(* 2.0 (sqrt (fma x z (* y (+ z x)))))
(*
2.0
(* y (+ (sqrt (/ (+ z x) y)) (* 0.5 (* x (sqrt (/ z (pow y 3.0))))))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 0.028) {
tmp = 2.0 * sqrt(fma(x, z, (y * (z + x))));
} else {
tmp = 2.0 * (y * (sqrt(((z + x) / y)) + (0.5 * (x * sqrt((z / pow(y, 3.0)))))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 0.028) tmp = Float64(2.0 * sqrt(fma(x, z, Float64(y * Float64(z + x))))); else tmp = Float64(2.0 * Float64(y * Float64(sqrt(Float64(Float64(z + x) / y)) + Float64(0.5 * Float64(x * sqrt(Float64(z / (y ^ 3.0)))))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 0.028], N[(2.0 * N[Sqrt[N[(x * z + N[(y * N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(y * N[(N[Sqrt[N[(N[(z + x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[(x * N[Sqrt[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.028:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, z, y \cdot \left(z + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot \left(\sqrt{\frac{z + x}{y}} + 0.5 \cdot \left(x \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right)\\
\end{array}
\end{array}
if y < 0.0280000000000000006Initial program 74.4%
associate-+l+74.4%
*-commutative74.4%
*-commutative74.4%
*-commutative74.4%
+-commutative74.4%
+-commutative74.4%
+-commutative74.4%
*-commutative74.4%
*-commutative74.4%
associate-+l+74.4%
+-commutative74.4%
fma-define74.4%
distribute-lft-out74.5%
Simplified74.5%
if 0.0280000000000000006 < y Initial program 49.0%
associate-+l+49.0%
*-commutative49.0%
*-commutative49.0%
*-commutative49.0%
+-commutative49.0%
+-commutative49.0%
associate-+l+49.0%
*-commutative49.0%
*-commutative49.0%
+-commutative49.0%
+-commutative49.0%
*-commutative49.0%
associate-+l+49.0%
+-commutative49.0%
distribute-rgt-in49.1%
Simplified49.1%
Taylor expanded in y around inf 82.7%
+-commutative82.7%
*-commutative82.7%
+-commutative82.7%
Simplified82.7%
Taylor expanded in z around inf 83.5%
Final simplification76.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 3.25e+24) (* 2.0 (sqrt (fma x z (* y (+ z x))))) (* 2.0 (* z (+ (* 0.5 (* x (sqrt (/ y (pow z 3.0))))) (sqrt (/ y z)))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 3.25e+24) {
tmp = 2.0 * sqrt(fma(x, z, (y * (z + x))));
} else {
tmp = 2.0 * (z * ((0.5 * (x * sqrt((y / pow(z, 3.0))))) + sqrt((y / z))));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 3.25e+24) tmp = Float64(2.0 * sqrt(fma(x, z, Float64(y * Float64(z + x))))); else tmp = Float64(2.0 * Float64(z * Float64(Float64(0.5 * Float64(x * sqrt(Float64(y / (z ^ 3.0))))) + sqrt(Float64(y / z))))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 3.25e+24], N[(2.0 * N[Sqrt[N[(x * z + N[(y * N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * N[(N[(0.5 * N[(x * N[Sqrt[N[(y / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(y / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.25 \cdot 10^{+24}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, z, y \cdot \left(z + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot \left(0.5 \cdot \left(x \cdot \sqrt{\frac{y}{{z}^{3}}}\right) + \sqrt{\frac{y}{z}}\right)\right)\\
\end{array}
\end{array}
if y < 3.2499999999999998e24Initial program 74.7%
associate-+l+74.7%
*-commutative74.7%
*-commutative74.7%
*-commutative74.7%
+-commutative74.7%
+-commutative74.7%
+-commutative74.7%
*-commutative74.7%
*-commutative74.7%
associate-+l+74.7%
+-commutative74.7%
fma-define74.7%
distribute-lft-out74.8%
Simplified74.8%
if 3.2499999999999998e24 < y Initial program 45.4%
associate-+l+45.4%
*-commutative45.4%
*-commutative45.4%
*-commutative45.4%
+-commutative45.4%
+-commutative45.4%
associate-+l+45.4%
*-commutative45.4%
*-commutative45.4%
+-commutative45.4%
+-commutative45.4%
*-commutative45.4%
associate-+l+45.4%
+-commutative45.4%
distribute-rgt-in45.6%
Simplified45.6%
add-cube-cbrt45.5%
pow345.5%
+-commutative45.5%
Applied egg-rr45.5%
Taylor expanded in x around 0 45.4%
*-commutative45.4%
Simplified45.4%
Taylor expanded in z around inf 39.8%
Final simplification66.7%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 1.5e+50) (* 2.0 (sqrt (fma x z (* y (+ z x))))) (* 2.0 (* (sqrt z) (sqrt y)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 1.5e+50) {
tmp = 2.0 * sqrt(fma(x, z, (y * (z + x))));
} else {
tmp = 2.0 * (sqrt(z) * sqrt(y));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 1.5e+50) tmp = Float64(2.0 * sqrt(fma(x, z, Float64(y * Float64(z + x))))); else tmp = Float64(2.0 * Float64(sqrt(z) * sqrt(y))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 1.5e+50], N[(2.0 * N[Sqrt[N[(x * z + N[(y * N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[z], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.5 \cdot 10^{+50}:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, z, y \cdot \left(z + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{z} \cdot \sqrt{y}\right)\\
\end{array}
\end{array}
if y < 1.4999999999999999e50Initial program 75.3%
associate-+l+75.3%
*-commutative75.3%
*-commutative75.3%
*-commutative75.3%
+-commutative75.3%
+-commutative75.3%
+-commutative75.3%
*-commutative75.3%
*-commutative75.3%
associate-+l+75.3%
+-commutative75.3%
fma-define75.3%
distribute-lft-out75.4%
Simplified75.4%
if 1.4999999999999999e50 < y Initial program 40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
+-commutative40.4%
*-commutative40.4%
*-commutative40.4%
associate-+l+40.4%
+-commutative40.4%
fma-define40.6%
distribute-lft-out40.6%
Simplified40.6%
fma-undefine40.4%
+-commutative40.4%
Applied egg-rr40.4%
Taylor expanded in x around 0 21.9%
*-commutative21.9%
Simplified21.9%
sqrt-prod42.3%
Applied egg-rr42.3%
Final simplification68.4%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 3.5e+50) (* 2.0 (sqrt (+ (* y (+ z x)) (* z x)))) (* 2.0 (* (sqrt z) (sqrt y)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 3.5e+50) {
tmp = 2.0 * sqrt(((y * (z + x)) + (z * x)));
} else {
tmp = 2.0 * (sqrt(z) * sqrt(y));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 3.5d+50) then
tmp = 2.0d0 * sqrt(((y * (z + x)) + (z * x)))
else
tmp = 2.0d0 * (sqrt(z) * sqrt(y))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.5e+50) {
tmp = 2.0 * Math.sqrt(((y * (z + x)) + (z * x)));
} else {
tmp = 2.0 * (Math.sqrt(z) * Math.sqrt(y));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= 3.5e+50: tmp = 2.0 * math.sqrt(((y * (z + x)) + (z * x))) else: tmp = 2.0 * (math.sqrt(z) * math.sqrt(y)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 3.5e+50) tmp = Float64(2.0 * sqrt(Float64(Float64(y * Float64(z + x)) + Float64(z * x)))); else tmp = Float64(2.0 * Float64(sqrt(z) * sqrt(y))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= 3.5e+50)
tmp = 2.0 * sqrt(((y * (z + x)) + (z * x)));
else
tmp = 2.0 * (sqrt(z) * sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 3.5e+50], N[(2.0 * N[Sqrt[N[(N[(y * N[(z + x), $MachinePrecision]), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[z], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{+50}:\\
\;\;\;\;2 \cdot \sqrt{y \cdot \left(z + x\right) + z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{z} \cdot \sqrt{y}\right)\\
\end{array}
\end{array}
if y < 3.50000000000000006e50Initial program 75.3%
associate-+l+75.3%
*-commutative75.3%
*-commutative75.3%
*-commutative75.3%
+-commutative75.3%
+-commutative75.3%
+-commutative75.3%
*-commutative75.3%
*-commutative75.3%
associate-+l+75.3%
+-commutative75.3%
fma-define75.3%
distribute-lft-out75.4%
Simplified75.4%
fma-undefine75.3%
+-commutative75.3%
Applied egg-rr75.3%
if 3.50000000000000006e50 < y Initial program 40.4%
associate-+l+40.4%
*-commutative40.4%
*-commutative40.4%
*-commutative40.4%
+-commutative40.4%
+-commutative40.4%
+-commutative40.4%
*-commutative40.4%
*-commutative40.4%
associate-+l+40.4%
+-commutative40.4%
fma-define40.6%
distribute-lft-out40.6%
Simplified40.6%
fma-undefine40.4%
+-commutative40.4%
Applied egg-rr40.4%
Taylor expanded in x around 0 21.9%
*-commutative21.9%
Simplified21.9%
sqrt-prod42.3%
Applied egg-rr42.3%
Final simplification68.4%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y -4e-293) (* 2.0 (sqrt (* x (+ y z)))) (* 2.0 (sqrt (* z (+ y x))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -4e-293) {
tmp = 2.0 * sqrt((x * (y + z)));
} else {
tmp = 2.0 * sqrt((z * (y + x)));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-4d-293)) then
tmp = 2.0d0 * sqrt((x * (y + z)))
else
tmp = 2.0d0 * sqrt((z * (y + x)))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4e-293) {
tmp = 2.0 * Math.sqrt((x * (y + z)));
} else {
tmp = 2.0 * Math.sqrt((z * (y + x)));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= -4e-293: tmp = 2.0 * math.sqrt((x * (y + z))) else: tmp = 2.0 * math.sqrt((z * (y + x))) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -4e-293) tmp = Float64(2.0 * sqrt(Float64(x * Float64(y + z)))); else tmp = Float64(2.0 * sqrt(Float64(z * Float64(y + x)))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= -4e-293)
tmp = 2.0 * sqrt((x * (y + z)));
else
tmp = 2.0 * sqrt((z * (y + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -4e-293], N[(2.0 * N[Sqrt[N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Sqrt[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-293}:\\
\;\;\;\;2 \cdot \sqrt{x \cdot \left(y + z\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \sqrt{z \cdot \left(y + x\right)}\\
\end{array}
\end{array}
if y < -4.0000000000000002e-293Initial program 68.6%
associate-+l+68.6%
*-commutative68.6%
*-commutative68.6%
*-commutative68.6%
+-commutative68.6%
+-commutative68.6%
associate-+l+68.6%
*-commutative68.6%
*-commutative68.6%
+-commutative68.6%
+-commutative68.6%
*-commutative68.6%
associate-+l+68.6%
+-commutative68.6%
distribute-rgt-in68.8%
Simplified68.8%
Taylor expanded in x around inf 49.1%
if -4.0000000000000002e-293 < y Initial program 67.2%
associate-+l+67.2%
*-commutative67.2%
*-commutative67.2%
*-commutative67.2%
+-commutative67.2%
+-commutative67.2%
associate-+l+67.2%
*-commutative67.2%
*-commutative67.2%
+-commutative67.2%
+-commutative67.2%
*-commutative67.2%
associate-+l+67.2%
+-commutative67.2%
distribute-rgt-in67.3%
Simplified67.3%
Taylor expanded in z around inf 46.5%
+-commutative46.5%
Simplified46.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 2.15e-285) (* 2.0 (sqrt (* x (+ y z)))) (* 2.0 (sqrt (* y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 2.15e-285) {
tmp = 2.0 * sqrt((x * (y + z)));
} else {
tmp = 2.0 * sqrt((y * z));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.15d-285) then
tmp = 2.0d0 * sqrt((x * (y + z)))
else
tmp = 2.0d0 * sqrt((y * z))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.15e-285) {
tmp = 2.0 * Math.sqrt((x * (y + z)));
} else {
tmp = 2.0 * Math.sqrt((y * z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= 2.15e-285: tmp = 2.0 * math.sqrt((x * (y + z))) else: tmp = 2.0 * math.sqrt((y * z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 2.15e-285) tmp = Float64(2.0 * sqrt(Float64(x * Float64(y + z)))); else tmp = Float64(2.0 * sqrt(Float64(y * z))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= 2.15e-285)
tmp = 2.0 * sqrt((x * (y + z)));
else
tmp = 2.0 * sqrt((y * z));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 2.15e-285], N[(2.0 * N[Sqrt[N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.15 \cdot 10^{-285}:\\
\;\;\;\;2 \cdot \sqrt{x \cdot \left(y + z\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \sqrt{y \cdot z}\\
\end{array}
\end{array}
if y < 2.15000000000000006e-285Initial program 69.9%
associate-+l+69.9%
*-commutative69.9%
*-commutative69.9%
*-commutative69.9%
+-commutative69.9%
+-commutative69.9%
associate-+l+69.9%
*-commutative69.9%
*-commutative69.9%
+-commutative69.9%
+-commutative69.9%
*-commutative69.9%
associate-+l+69.9%
+-commutative69.9%
distribute-rgt-in70.0%
Simplified70.0%
Taylor expanded in x around inf 51.2%
if 2.15000000000000006e-285 < y Initial program 65.7%
associate-+l+65.7%
*-commutative65.7%
*-commutative65.7%
*-commutative65.7%
+-commutative65.7%
+-commutative65.7%
associate-+l+65.7%
*-commutative65.7%
*-commutative65.7%
+-commutative65.7%
+-commutative65.7%
*-commutative65.7%
associate-+l+65.7%
+-commutative65.7%
distribute-rgt-in65.8%
Simplified65.8%
Taylor expanded in x around 0 19.6%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y -2e-310) (* 2.0 (pow (* y x) 0.5)) (* 2.0 (sqrt (* y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -2e-310) {
tmp = 2.0 * pow((y * x), 0.5);
} else {
tmp = 2.0 * sqrt((y * z));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-2d-310)) then
tmp = 2.0d0 * ((y * x) ** 0.5d0)
else
tmp = 2.0d0 * sqrt((y * z))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2e-310) {
tmp = 2.0 * Math.pow((y * x), 0.5);
} else {
tmp = 2.0 * Math.sqrt((y * z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= -2e-310: tmp = 2.0 * math.pow((y * x), 0.5) else: tmp = 2.0 * math.sqrt((y * z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -2e-310) tmp = Float64(2.0 * (Float64(y * x) ^ 0.5)); else tmp = Float64(2.0 * sqrt(Float64(y * z))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= -2e-310)
tmp = 2.0 * ((y * x) ^ 0.5);
else
tmp = 2.0 * sqrt((y * z));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -2e-310], N[(2.0 * N[Power[N[(y * x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-310}:\\
\;\;\;\;2 \cdot {\left(y \cdot x\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \sqrt{y \cdot z}\\
\end{array}
\end{array}
if y < -1.999999999999994e-310Initial program 69.4%
associate-+l+69.4%
*-commutative69.4%
*-commutative69.4%
*-commutative69.4%
+-commutative69.4%
+-commutative69.4%
associate-+l+69.4%
*-commutative69.4%
*-commutative69.4%
+-commutative69.4%
+-commutative69.4%
*-commutative69.4%
associate-+l+69.4%
+-commutative69.4%
distribute-rgt-in69.5%
Simplified69.5%
Taylor expanded in z around 0 28.8%
*-commutative28.8%
Simplified28.8%
pow1/228.9%
Applied egg-rr28.9%
if -1.999999999999994e-310 < y Initial program 66.4%
associate-+l+66.4%
*-commutative66.4%
*-commutative66.4%
*-commutative66.4%
+-commutative66.4%
+-commutative66.4%
associate-+l+66.4%
*-commutative66.4%
*-commutative66.4%
+-commutative66.4%
+-commutative66.4%
*-commutative66.4%
associate-+l+66.4%
+-commutative66.4%
distribute-rgt-in66.5%
Simplified66.5%
Taylor expanded in x around 0 19.3%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* 2.0 (sqrt (+ (* z (+ y x)) (* y x)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
return 2.0 * sqrt(((z * (y + x)) + (y * x)));
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 * sqrt(((z * (y + x)) + (y * x)))
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return 2.0 * Math.sqrt(((z * (y + x)) + (y * x)));
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return 2.0 * math.sqrt(((z * (y + x)) + (y * x)))
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(2.0 * sqrt(Float64(Float64(z * Float64(y + x)) + Float64(y * x)))) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = 2.0 * sqrt(((z * (y + x)) + (y * x)));
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(2.0 * N[Sqrt[N[(N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
2 \cdot \sqrt{z \cdot \left(y + x\right) + y \cdot x}
\end{array}
Initial program 67.9%
associate-+l+67.9%
*-commutative67.9%
*-commutative67.9%
*-commutative67.9%
+-commutative67.9%
+-commutative67.9%
associate-+l+67.9%
*-commutative67.9%
*-commutative67.9%
+-commutative67.9%
+-commutative67.9%
*-commutative67.9%
associate-+l+67.9%
+-commutative67.9%
distribute-rgt-in68.0%
Simplified68.0%
Final simplification68.0%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y -2e-310) (* 2.0 (sqrt (* y x))) (* 2.0 (sqrt (* y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -2e-310) {
tmp = 2.0 * sqrt((y * x));
} else {
tmp = 2.0 * sqrt((y * z));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-2d-310)) then
tmp = 2.0d0 * sqrt((y * x))
else
tmp = 2.0d0 * sqrt((y * z))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2e-310) {
tmp = 2.0 * Math.sqrt((y * x));
} else {
tmp = 2.0 * Math.sqrt((y * z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= -2e-310: tmp = 2.0 * math.sqrt((y * x)) else: tmp = 2.0 * math.sqrt((y * z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -2e-310) tmp = Float64(2.0 * sqrt(Float64(y * x))); else tmp = Float64(2.0 * sqrt(Float64(y * z))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= -2e-310)
tmp = 2.0 * sqrt((y * x));
else
tmp = 2.0 * sqrt((y * z));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -2e-310], N[(2.0 * N[Sqrt[N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Sqrt[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-310}:\\
\;\;\;\;2 \cdot \sqrt{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \sqrt{y \cdot z}\\
\end{array}
\end{array}
if y < -1.999999999999994e-310Initial program 69.4%
associate-+l+69.4%
*-commutative69.4%
*-commutative69.4%
*-commutative69.4%
+-commutative69.4%
+-commutative69.4%
associate-+l+69.4%
*-commutative69.4%
*-commutative69.4%
+-commutative69.4%
+-commutative69.4%
*-commutative69.4%
associate-+l+69.4%
+-commutative69.4%
distribute-rgt-in69.5%
Simplified69.5%
Taylor expanded in z around 0 28.8%
*-commutative28.8%
Simplified28.8%
if -1.999999999999994e-310 < y Initial program 66.4%
associate-+l+66.4%
*-commutative66.4%
*-commutative66.4%
*-commutative66.4%
+-commutative66.4%
+-commutative66.4%
associate-+l+66.4%
*-commutative66.4%
*-commutative66.4%
+-commutative66.4%
+-commutative66.4%
*-commutative66.4%
associate-+l+66.4%
+-commutative66.4%
distribute-rgt-in66.5%
Simplified66.5%
Taylor expanded in x around 0 19.3%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* 2.0 (sqrt (* y x))))
assert(x < y && y < z);
double code(double x, double y, double z) {
return 2.0 * sqrt((y * x));
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 * sqrt((y * x))
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return 2.0 * Math.sqrt((y * x));
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return 2.0 * math.sqrt((y * x))
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(2.0 * sqrt(Float64(y * x))) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = 2.0 * sqrt((y * x));
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(2.0 * N[Sqrt[N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
2 \cdot \sqrt{y \cdot x}
\end{array}
Initial program 67.9%
associate-+l+67.9%
*-commutative67.9%
*-commutative67.9%
*-commutative67.9%
+-commutative67.9%
+-commutative67.9%
associate-+l+67.9%
*-commutative67.9%
*-commutative67.9%
+-commutative67.9%
+-commutative67.9%
*-commutative67.9%
associate-+l+67.9%
+-commutative67.9%
distribute-rgt-in68.0%
Simplified68.0%
Taylor expanded in z around 0 26.4%
*-commutative26.4%
Simplified26.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(* 0.25 (* (* (pow y -0.75) (* (pow z -0.75) x)) (+ y z)))
(* (pow z 0.25) (pow y 0.25)))))
(if (< z 7.636950090573675e+176)
(* 2.0 (sqrt (+ (* (+ x y) z) (* x y))))
(* (* t_0 t_0) 2.0))))
double code(double x, double y, double z) {
double t_0 = (0.25 * ((pow(y, -0.75) * (pow(z, -0.75) * x)) * (y + z))) + (pow(z, 0.25) * pow(y, 0.25));
double tmp;
if (z < 7.636950090573675e+176) {
tmp = 2.0 * sqrt((((x + y) * z) + (x * y)));
} else {
tmp = (t_0 * t_0) * 2.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (0.25d0 * (((y ** (-0.75d0)) * ((z ** (-0.75d0)) * x)) * (y + z))) + ((z ** 0.25d0) * (y ** 0.25d0))
if (z < 7.636950090573675d+176) then
tmp = 2.0d0 * sqrt((((x + y) * z) + (x * y)))
else
tmp = (t_0 * t_0) * 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (0.25 * ((Math.pow(y, -0.75) * (Math.pow(z, -0.75) * x)) * (y + z))) + (Math.pow(z, 0.25) * Math.pow(y, 0.25));
double tmp;
if (z < 7.636950090573675e+176) {
tmp = 2.0 * Math.sqrt((((x + y) * z) + (x * y)));
} else {
tmp = (t_0 * t_0) * 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = (0.25 * ((math.pow(y, -0.75) * (math.pow(z, -0.75) * x)) * (y + z))) + (math.pow(z, 0.25) * math.pow(y, 0.25)) tmp = 0 if z < 7.636950090573675e+176: tmp = 2.0 * math.sqrt((((x + y) * z) + (x * y))) else: tmp = (t_0 * t_0) * 2.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(0.25 * Float64(Float64((y ^ -0.75) * Float64((z ^ -0.75) * x)) * Float64(y + z))) + Float64((z ^ 0.25) * (y ^ 0.25))) tmp = 0.0 if (z < 7.636950090573675e+176) tmp = Float64(2.0 * sqrt(Float64(Float64(Float64(x + y) * z) + Float64(x * y)))); else tmp = Float64(Float64(t_0 * t_0) * 2.0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (0.25 * (((y ^ -0.75) * ((z ^ -0.75) * x)) * (y + z))) + ((z ^ 0.25) * (y ^ 0.25)); tmp = 0.0; if (z < 7.636950090573675e+176) tmp = 2.0 * sqrt((((x + y) * z) + (x * y))); else tmp = (t_0 * t_0) * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(0.25 * N[(N[(N[Power[y, -0.75], $MachinePrecision] * N[(N[Power[z, -0.75], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[z, 0.25], $MachinePrecision] * N[Power[y, 0.25], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, 7.636950090573675e+176], N[(2.0 * N[Sqrt[N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.25 \cdot \left(\left({y}^{-0.75} \cdot \left({z}^{-0.75} \cdot x\right)\right) \cdot \left(y + z\right)\right) + {z}^{0.25} \cdot {y}^{0.25}\\
\mathbf{if}\;z < 7.636950090573675 \cdot 10^{+176}:\\
\;\;\;\;2 \cdot \sqrt{\left(x + y\right) \cdot z + x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot 2\\
\end{array}
\end{array}
herbie shell --seed 2024110
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:descartes from diagrams-contrib-1.3.0.5"
:precision binary64
:alt
(! :herbie-platform default (if (< z 763695009057367500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* 2 (sqrt (+ (* (+ x y) z) (* x y)))) (* (* (+ (* 1/4 (* (* (pow y -3/4) (* (pow z -3/4) x)) (+ y z))) (* (pow z 1/4) (pow y 1/4))) (+ (* 1/4 (* (* (pow y -3/4) (* (pow z -3/4) x)) (+ y z))) (* (pow z 1/4) (pow y 1/4)))) 2)))
(* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))