
(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 10 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 -1.1e+34)
t_0
(if (<= y -4.9e-191)
(* 2.0 (sqrt (+ (* y x) (* z (+ y x)))))
(if (<= y -2.2e-282) t_0 (* 2.0 (* (sqrt (+ y x)) (sqrt z))))))))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.1e+34) {
tmp = t_0;
} else if (y <= -4.9e-191) {
tmp = 2.0 * sqrt(((y * x) + (z * (y + x))));
} else if (y <= -2.2e-282) {
tmp = t_0;
} else {
tmp = 2.0 * (sqrt((y + x)) * sqrt(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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 * (exp((0.25d0 * (log((-y - z)) - log(((-1.0d0) / x))))) ** 2.0d0)
if (y <= (-1.1d+34)) then
tmp = t_0
else if (y <= (-4.9d-191)) then
tmp = 2.0d0 * sqrt(((y * x) + (z * (y + x))))
else if (y <= (-2.2d-282)) then
tmp = t_0
else
tmp = 2.0d0 * (sqrt((y + x)) * sqrt(z))
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.1e+34) {
tmp = t_0;
} else if (y <= -4.9e-191) {
tmp = 2.0 * Math.sqrt(((y * x) + (z * (y + x))));
} else if (y <= -2.2e-282) {
tmp = t_0;
} else {
tmp = 2.0 * (Math.sqrt((y + x)) * Math.sqrt(z));
}
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.1e+34: tmp = t_0 elif y <= -4.9e-191: tmp = 2.0 * math.sqrt(((y * x) + (z * (y + x)))) elif y <= -2.2e-282: tmp = t_0 else: tmp = 2.0 * (math.sqrt((y + x)) * math.sqrt(z)) 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.1e+34) tmp = t_0; elseif (y <= -4.9e-191) tmp = Float64(2.0 * sqrt(Float64(Float64(y * x) + Float64(z * Float64(y + x))))); elseif (y <= -2.2e-282) tmp = t_0; else tmp = Float64(2.0 * Float64(sqrt(Float64(y + x)) * sqrt(z))); 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.1e+34)
tmp = t_0;
elseif (y <= -4.9e-191)
tmp = 2.0 * sqrt(((y * x) + (z * (y + x))));
elseif (y <= -2.2e-282)
tmp = t_0;
else
tmp = 2.0 * (sqrt((y + x)) * sqrt(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_] := 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.1e+34], t$95$0, If[LessEqual[y, -4.9e-191], N[(2.0 * N[Sqrt[N[(N[(y * x), $MachinePrecision] + N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.2e-282], t$95$0, N[(2.0 * N[(N[Sqrt[N[(y + x), $MachinePrecision]], $MachinePrecision] * N[Sqrt[z], $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.1 \cdot 10^{+34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -4.9 \cdot 10^{-191}:\\
\;\;\;\;2 \cdot \sqrt{y \cdot x + z \cdot \left(y + x\right)}\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-282}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{y + x} \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if y < -1.1000000000000001e34 or -4.9e-191 < y < -2.19999999999999981e-282Initial 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.1%
Simplified53.1%
add-sqr-sqrt52.7%
pow252.7%
pow1/252.7%
sqrt-pow152.8%
distribute-rgt-in52.7%
associate-+r+52.7%
*-commutative52.7%
distribute-lft-in52.8%
fma-define52.9%
metadata-eval52.9%
Applied egg-rr52.9%
Taylor expanded in x around -inf 47.6%
if -1.1000000000000001e34 < y < -4.9e-191Initial program 88.5%
associate-+l+88.5%
*-commutative88.5%
*-commutative88.5%
*-commutative88.5%
+-commutative88.5%
+-commutative88.5%
associate-+l+88.5%
*-commutative88.5%
*-commutative88.5%
+-commutative88.5%
+-commutative88.5%
*-commutative88.5%
associate-+l+88.5%
+-commutative88.5%
distribute-rgt-in88.5%
Simplified88.5%
if -2.19999999999999981e-282 < y Initial program 60.2%
associate-+l+60.2%
*-commutative60.2%
*-commutative60.2%
*-commutative60.2%
+-commutative60.2%
+-commutative60.2%
associate-+l+60.2%
*-commutative60.2%
*-commutative60.2%
+-commutative60.2%
+-commutative60.2%
*-commutative60.2%
associate-+l+60.2%
+-commutative60.2%
distribute-rgt-in60.2%
Simplified60.2%
Taylor expanded in z around inf 38.5%
+-commutative38.5%
Simplified38.5%
*-commutative38.5%
sqrt-prod47.9%
Applied egg-rr47.9%
Final simplification55.7%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y -2.05e+33)
(* 2.0 (pow (exp (* 0.25 (- (log (- (- z) x)) (log (/ -1.0 y))))) 2.0))
(if (<= y 1.18e-294)
(* 2.0 (sqrt (+ (* y x) (* z (+ y x)))))
(* 2.0 (* (sqrt (+ y x)) (sqrt z))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -2.05e+33) {
tmp = 2.0 * pow(exp((0.25 * (log((-z - x)) - log((-1.0 / y))))), 2.0);
} else if (y <= 1.18e-294) {
tmp = 2.0 * sqrt(((y * x) + (z * (y + x))));
} else {
tmp = 2.0 * (sqrt((y + x)) * sqrt(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.05d+33)) then
tmp = 2.0d0 * (exp((0.25d0 * (log((-z - x)) - log(((-1.0d0) / y))))) ** 2.0d0)
else if (y <= 1.18d-294) then
tmp = 2.0d0 * sqrt(((y * x) + (z * (y + x))))
else
tmp = 2.0d0 * (sqrt((y + x)) * sqrt(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.05e+33) {
tmp = 2.0 * Math.pow(Math.exp((0.25 * (Math.log((-z - x)) - Math.log((-1.0 / y))))), 2.0);
} else if (y <= 1.18e-294) {
tmp = 2.0 * Math.sqrt(((y * x) + (z * (y + x))));
} else {
tmp = 2.0 * (Math.sqrt((y + x)) * Math.sqrt(z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= -2.05e+33: tmp = 2.0 * math.pow(math.exp((0.25 * (math.log((-z - x)) - math.log((-1.0 / y))))), 2.0) elif y <= 1.18e-294: tmp = 2.0 * math.sqrt(((y * x) + (z * (y + x)))) else: tmp = 2.0 * (math.sqrt((y + x)) * math.sqrt(z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -2.05e+33) tmp = Float64(2.0 * (exp(Float64(0.25 * Float64(log(Float64(Float64(-z) - x)) - log(Float64(-1.0 / y))))) ^ 2.0)); elseif (y <= 1.18e-294) tmp = Float64(2.0 * sqrt(Float64(Float64(y * x) + Float64(z * Float64(y + x))))); else tmp = Float64(2.0 * Float64(sqrt(Float64(y + x)) * sqrt(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.05e+33)
tmp = 2.0 * (exp((0.25 * (log((-z - x)) - log((-1.0 / y))))) ^ 2.0);
elseif (y <= 1.18e-294)
tmp = 2.0 * sqrt(((y * x) + (z * (y + x))));
else
tmp = 2.0 * (sqrt((y + x)) * sqrt(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.05e+33], 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, 1.18e-294], N[(2.0 * N[Sqrt[N[(N[(y * x), $MachinePrecision] + N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[N[(y + x), $MachinePrecision]], $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{+33}:\\
\;\;\;\;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 1.18 \cdot 10^{-294}:\\
\;\;\;\;2 \cdot \sqrt{y \cdot x + z \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{y + x} \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if y < -2.04999999999999997e33Initial program 43.9%
associate-+l+43.9%
*-commutative43.9%
*-commutative43.9%
*-commutative43.9%
+-commutative43.9%
+-commutative43.9%
associate-+l+43.9%
*-commutative43.9%
*-commutative43.9%
+-commutative43.9%
+-commutative43.9%
*-commutative43.9%
associate-+l+43.9%
+-commutative43.9%
distribute-rgt-in44.0%
Simplified44.0%
add-sqr-sqrt43.7%
pow243.7%
pow1/243.7%
sqrt-pow143.8%
distribute-rgt-in43.7%
associate-+r+43.7%
*-commutative43.7%
distribute-lft-in43.8%
fma-define44.0%
metadata-eval44.0%
Applied egg-rr44.0%
Taylor expanded in y around -inf 83.4%
if -2.04999999999999997e33 < y < 1.18000000000000002e-294Initial program 82.7%
associate-+l+82.7%
*-commutative82.7%
*-commutative82.7%
*-commutative82.7%
+-commutative82.7%
+-commutative82.7%
associate-+l+82.7%
*-commutative82.7%
*-commutative82.7%
+-commutative82.7%
+-commutative82.7%
*-commutative82.7%
associate-+l+82.7%
+-commutative82.7%
distribute-rgt-in82.7%
Simplified82.7%
if 1.18000000000000002e-294 < y Initial program 59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
*-commutative59.2%
associate-+l+59.2%
+-commutative59.2%
distribute-rgt-in59.3%
Simplified59.3%
Taylor expanded in z around inf 36.0%
+-commutative36.0%
Simplified36.0%
*-commutative36.0%
sqrt-prod48.6%
Applied egg-rr48.6%
Final simplification68.1%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= y -9e+74)
(* 2.0 (hypot (sqrt (* z x)) (* x (sqrt (/ y (- x z))))))
(if (<= y 1.18e-294)
(* 2.0 (sqrt (+ (* y x) (* z (+ y x)))))
(* 2.0 (* (sqrt (+ y x)) (sqrt z))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -9e+74) {
tmp = 2.0 * hypot(sqrt((z * x)), (x * sqrt((y / (x - z)))));
} else if (y <= 1.18e-294) {
tmp = 2.0 * sqrt(((y * x) + (z * (y + x))));
} else {
tmp = 2.0 * (sqrt((y + x)) * sqrt(z));
}
return tmp;
}
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9e+74) {
tmp = 2.0 * Math.hypot(Math.sqrt((z * x)), (x * Math.sqrt((y / (x - z)))));
} else if (y <= 1.18e-294) {
tmp = 2.0 * Math.sqrt(((y * x) + (z * (y + x))));
} else {
tmp = 2.0 * (Math.sqrt((y + x)) * Math.sqrt(z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= -9e+74: tmp = 2.0 * math.hypot(math.sqrt((z * x)), (x * math.sqrt((y / (x - z))))) elif y <= 1.18e-294: tmp = 2.0 * math.sqrt(((y * x) + (z * (y + x)))) else: tmp = 2.0 * (math.sqrt((y + x)) * math.sqrt(z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -9e+74) tmp = Float64(2.0 * hypot(sqrt(Float64(z * x)), Float64(x * sqrt(Float64(y / Float64(x - z)))))); elseif (y <= 1.18e-294) tmp = Float64(2.0 * sqrt(Float64(Float64(y * x) + Float64(z * Float64(y + x))))); else tmp = Float64(2.0 * Float64(sqrt(Float64(y + x)) * sqrt(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 <= -9e+74)
tmp = 2.0 * hypot(sqrt((z * x)), (x * sqrt((y / (x - z)))));
elseif (y <= 1.18e-294)
tmp = 2.0 * sqrt(((y * x) + (z * (y + x))));
else
tmp = 2.0 * (sqrt((y + x)) * sqrt(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, -9e+74], N[(2.0 * N[Sqrt[N[Sqrt[N[(z * x), $MachinePrecision]], $MachinePrecision] ^ 2 + N[(x * N[Sqrt[N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.18e-294], N[(2.0 * N[Sqrt[N[(N[(y * x), $MachinePrecision] + N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[N[(y + x), $MachinePrecision]], $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+74}:\\
\;\;\;\;2 \cdot \mathsf{hypot}\left(\sqrt{z \cdot x}, x \cdot \sqrt{\frac{y}{x - z}}\right)\\
\mathbf{elif}\;y \leq 1.18 \cdot 10^{-294}:\\
\;\;\;\;2 \cdot \sqrt{y \cdot x + z \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{y + x} \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if y < -8.9999999999999999e74Initial program 41.3%
associate-+l+41.3%
*-commutative41.3%
*-commutative41.3%
*-commutative41.3%
+-commutative41.3%
+-commutative41.3%
+-commutative41.3%
*-commutative41.3%
*-commutative41.3%
associate-+l+41.3%
+-commutative41.3%
fma-define41.5%
distribute-lft-out41.6%
Simplified41.6%
*-commutative41.6%
flip-+37.7%
associate-*l/27.3%
pow227.3%
pow227.3%
Applied egg-rr27.3%
Taylor expanded in x around inf 10.3%
fma-undefine10.2%
add-sqr-sqrt3.5%
add-sqr-sqrt3.4%
hypot-define4.8%
associate-/l*6.1%
sqrt-prod10.7%
sqrt-pow113.3%
metadata-eval13.3%
pow113.3%
Applied egg-rr13.3%
if -8.9999999999999999e74 < y < 1.18000000000000002e-294Initial program 81.7%
associate-+l+81.7%
*-commutative81.7%
*-commutative81.7%
*-commutative81.7%
+-commutative81.7%
+-commutative81.7%
associate-+l+81.7%
*-commutative81.7%
*-commutative81.7%
+-commutative81.7%
+-commutative81.7%
*-commutative81.7%
associate-+l+81.7%
+-commutative81.7%
distribute-rgt-in81.7%
Simplified81.7%
if 1.18000000000000002e-294 < y Initial program 59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
*-commutative59.2%
associate-+l+59.2%
+-commutative59.2%
distribute-rgt-in59.3%
Simplified59.3%
Taylor expanded in z around inf 36.0%
+-commutative36.0%
Simplified36.0%
*-commutative36.0%
sqrt-prod48.6%
Applied egg-rr48.6%
Final simplification52.7%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 3.3e-302) (* 2.0 (sqrt (* x (+ y (+ z (* y (/ z x))))))) (* 2.0 (* (sqrt (+ y x)) (sqrt z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 3.3e-302) {
tmp = 2.0 * sqrt((x * (y + (z + (y * (z / x))))));
} else {
tmp = 2.0 * (sqrt((y + x)) * sqrt(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 <= 3.3d-302) then
tmp = 2.0d0 * sqrt((x * (y + (z + (y * (z / x))))))
else
tmp = 2.0d0 * (sqrt((y + x)) * sqrt(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 <= 3.3e-302) {
tmp = 2.0 * Math.sqrt((x * (y + (z + (y * (z / x))))));
} else {
tmp = 2.0 * (Math.sqrt((y + x)) * Math.sqrt(z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= 3.3e-302: tmp = 2.0 * math.sqrt((x * (y + (z + (y * (z / x)))))) else: tmp = 2.0 * (math.sqrt((y + x)) * math.sqrt(z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 3.3e-302) tmp = Float64(2.0 * sqrt(Float64(x * Float64(y + Float64(z + Float64(y * Float64(z / x))))))); else tmp = Float64(2.0 * Float64(sqrt(Float64(y + x)) * sqrt(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 <= 3.3e-302)
tmp = 2.0 * sqrt((x * (y + (z + (y * (z / x))))));
else
tmp = 2.0 * (sqrt((y + x)) * sqrt(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, 3.3e-302], N[(2.0 * N[Sqrt[N[(x * N[(y + N[(z + N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[N[(y + x), $MachinePrecision]], $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{-302}:\\
\;\;\;\;2 \cdot \sqrt{x \cdot \left(y + \left(z + y \cdot \frac{z}{x}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{y + x} \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if y < 3.3000000000000002e-302Initial 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.4%
Simplified66.4%
Taylor expanded in x around inf 60.5%
associate-/l*57.3%
Simplified57.3%
if 3.3000000000000002e-302 < y Initial program 59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
*-commutative59.2%
associate-+l+59.2%
+-commutative59.2%
distribute-rgt-in59.3%
Simplified59.3%
Taylor expanded in z around inf 36.0%
+-commutative36.0%
Simplified36.0%
*-commutative36.0%
sqrt-prod48.6%
Applied egg-rr48.6%
Final simplification53.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 1.18e-294) (* 2.0 (sqrt (* x (+ y (+ 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.18e-294) {
tmp = 2.0 * sqrt((x * (y + (z + (y * (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 <= 1.18d-294) then
tmp = 2.0d0 * sqrt((x * (y + (z + (y * (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 <= 1.18e-294) {
tmp = 2.0 * Math.sqrt((x * (y + (z + (y * (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 <= 1.18e-294: tmp = 2.0 * math.sqrt((x * (y + (z + (y * (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 <= 1.18e-294) tmp = Float64(2.0 * sqrt(Float64(x * Float64(y + Float64(z + Float64(y * 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 <= 1.18e-294)
tmp = 2.0 * sqrt((x * (y + (z + (y * (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, 1.18e-294], N[(2.0 * N[Sqrt[N[(x * N[(y + N[(z + N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $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.18 \cdot 10^{-294}:\\
\;\;\;\;2 \cdot \sqrt{x \cdot \left(y + \left(z + y \cdot \frac{z}{x}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{z} \cdot \sqrt{y}\right)\\
\end{array}
\end{array}
if y < 1.18000000000000002e-294Initial 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.4%
Simplified66.4%
Taylor expanded in x around inf 60.5%
associate-/l*57.3%
Simplified57.3%
if 1.18000000000000002e-294 < y Initial program 59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
*-commutative59.2%
associate-+l+59.2%
+-commutative59.2%
distribute-rgt-in59.3%
Simplified59.3%
add-sqr-sqrt58.9%
pow258.9%
pow1/258.9%
sqrt-pow159.0%
distribute-rgt-in58.9%
associate-+r+58.9%
*-commutative58.9%
distribute-lft-in59.0%
fma-define59.1%
metadata-eval59.1%
Applied egg-rr59.1%
Taylor expanded in x around 0 19.2%
*-commutative19.2%
Simplified19.2%
sqrt-prod34.3%
Applied egg-rr34.3%
Final simplification47.3%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 1.18e-294) (* 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 <= 1.18e-294) {
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 <= 1.18d-294) 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 <= 1.18e-294) {
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 <= 1.18e-294: 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 <= 1.18e-294) 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 <= 1.18e-294)
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, 1.18e-294], 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 1.18 \cdot 10^{-294}:\\
\;\;\;\;2 \cdot \sqrt{x \cdot \left(y + z\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \sqrt{y \cdot z}\\
\end{array}
\end{array}
if y < 1.18000000000000002e-294Initial 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.4%
Simplified66.4%
Taylor expanded in x around inf 47.1%
if 1.18000000000000002e-294 < y Initial program 59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
associate-+l+59.2%
*-commutative59.2%
*-commutative59.2%
+-commutative59.2%
+-commutative59.2%
*-commutative59.2%
associate-+l+59.2%
+-commutative59.2%
distribute-rgt-in59.3%
Simplified59.3%
Taylor expanded in x around 0 19.2%
Final simplification35.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-282) (* 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 <= -2e-282) {
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 <= (-2d-282)) 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 <= -2e-282) {
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 <= -2e-282: 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 <= -2e-282) 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 <= -2e-282)
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, -2e-282], 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 -2 \cdot 10^{-282}:\\
\;\;\;\;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 < -2e-282Initial program 66.0%
associate-+l+66.0%
*-commutative66.0%
*-commutative66.0%
*-commutative66.0%
+-commutative66.0%
+-commutative66.0%
associate-+l+66.0%
*-commutative66.0%
*-commutative66.0%
+-commutative66.0%
+-commutative66.0%
*-commutative66.0%
associate-+l+66.0%
+-commutative66.0%
distribute-rgt-in66.0%
Simplified66.0%
Taylor expanded in x around inf 45.5%
if -2e-282 < y Initial program 60.2%
associate-+l+60.2%
*-commutative60.2%
*-commutative60.2%
*-commutative60.2%
+-commutative60.2%
+-commutative60.2%
associate-+l+60.2%
*-commutative60.2%
*-commutative60.2%
+-commutative60.2%
+-commutative60.2%
*-commutative60.2%
associate-+l+60.2%
+-commutative60.2%
distribute-rgt-in60.2%
Simplified60.2%
Taylor expanded in z around inf 38.5%
+-commutative38.5%
Simplified38.5%
Final simplification42.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) (* z (+ y x))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
return 2.0 * sqrt(((y * x) + (z * (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) + (z * (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) + (z * (y + x))));
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return 2.0 * math.sqrt(((y * x) + (z * (y + x))))
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(2.0 * sqrt(Float64(Float64(y * x) + Float64(z * Float64(y + x))))) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = 2.0 * sqrt(((y * x) + (z * (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[(y * x), $MachinePrecision] + N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
2 \cdot \sqrt{y \cdot x + z \cdot \left(y + x\right)}
\end{array}
Initial program 63.3%
associate-+l+63.3%
*-commutative63.3%
*-commutative63.3%
*-commutative63.3%
+-commutative63.3%
+-commutative63.3%
associate-+l+63.3%
*-commutative63.3%
*-commutative63.3%
+-commutative63.3%
+-commutative63.3%
*-commutative63.3%
associate-+l+63.3%
+-commutative63.3%
distribute-rgt-in63.3%
Simplified63.3%
Final simplification63.3%
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 66.2%
associate-+l+66.2%
*-commutative66.2%
*-commutative66.2%
*-commutative66.2%
+-commutative66.2%
+-commutative66.2%
associate-+l+66.2%
*-commutative66.2%
*-commutative66.2%
+-commutative66.2%
+-commutative66.2%
*-commutative66.2%
associate-+l+66.2%
+-commutative66.2%
distribute-rgt-in66.2%
Simplified66.2%
Taylor expanded in z around 0 22.1%
*-commutative22.1%
Simplified22.1%
if -1.999999999999994e-310 < y Initial program 59.6%
associate-+l+59.6%
*-commutative59.6%
*-commutative59.6%
*-commutative59.6%
+-commutative59.6%
+-commutative59.6%
associate-+l+59.6%
*-commutative59.6%
*-commutative59.6%
+-commutative59.6%
+-commutative59.6%
*-commutative59.6%
associate-+l+59.6%
+-commutative59.6%
distribute-rgt-in59.6%
Simplified59.6%
Taylor expanded in x around 0 19.1%
Final simplification20.8%
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 63.3%
associate-+l+63.3%
*-commutative63.3%
*-commutative63.3%
*-commutative63.3%
+-commutative63.3%
+-commutative63.3%
associate-+l+63.3%
*-commutative63.3%
*-commutative63.3%
+-commutative63.3%
+-commutative63.3%
*-commutative63.3%
associate-+l+63.3%
+-commutative63.3%
distribute-rgt-in63.3%
Simplified63.3%
Taylor expanded in z around 0 23.3%
*-commutative23.3%
Simplified23.3%
Final simplification23.3%
(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 2024059
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:descartes from diagrams-contrib-1.3.0.5"
:precision binary64
:alt
(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)))))