
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ z 1.0)) (sqrt z)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (* (+ (sqrt y) t_2) (+ (sqrt x) t_3))))
(if (<= t_1 0.0001)
(+
(fma 0.5 (sqrt (/ 1.0 z)) (/ (sqrt x) t_4))
(* (/ 1.0 t_4) (+ (sqrt y) (+ t_2 t_3))))
(+
(- (+ 1.0 t_2) (+ (sqrt x) (sqrt y)))
(+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0)) - sqrt(z);
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((1.0 + x));
double t_4 = (sqrt(y) + t_2) * (sqrt(x) + t_3);
double tmp;
if (t_1 <= 0.0001) {
tmp = fma(0.5, sqrt((1.0 / z)), (sqrt(x) / t_4)) + ((1.0 / t_4) * (sqrt(y) + (t_2 + t_3)));
} else {
tmp = ((1.0 + t_2) - (sqrt(x) + sqrt(y))) + (t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(Float64(sqrt(y) + t_2) * Float64(sqrt(x) + t_3)) tmp = 0.0 if (t_1 <= 0.0001) tmp = Float64(fma(0.5, sqrt(Float64(1.0 / z)), Float64(sqrt(x) / t_4)) + Float64(Float64(1.0 / t_4) * Float64(sqrt(y) + Float64(t_2 + t_3)))); else tmp = Float64(Float64(Float64(1.0 + t_2) - Float64(sqrt(x) + sqrt(y))) + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision] * N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0001], N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / t$95$4), $MachinePrecision] * N[(N[Sqrt[y], $MachinePrecision] + N[(t$95$2 + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$2), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1} - \sqrt{z}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + x}\\
t_4 := \left(\sqrt{y} + t\_2\right) \cdot \left(\sqrt{x} + t\_3\right)\\
\mathbf{if}\;t\_1 \leq 0.0001:\\
\;\;\;\;\mathsf{fma}\left(0.5, \sqrt{\frac{1}{z}}, \frac{\sqrt{x}}{t\_4}\right) + \frac{1}{t\_4} \cdot \left(\sqrt{y} + \left(t\_2 + t\_3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t\_2\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) + \left(t\_1 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) < 1.00000000000000005e-4Initial program 79.3%
associate-+l+79.3%
associate-+l-60.2%
associate-+l-79.3%
+-commutative79.3%
+-commutative79.3%
+-commutative79.3%
Simplified79.3%
flip--79.4%
flip--80.5%
frac-add80.5%
Applied egg-rr81.0%
fma-define81.0%
associate--l+81.0%
+-commutative81.0%
+-commutative81.0%
associate--l+85.1%
+-commutative85.1%
+-commutative85.1%
Simplified85.1%
add-cube-cbrt84.1%
pow384.0%
+-inverses84.0%
metadata-eval84.0%
*-commutative84.0%
*-un-lft-identity84.0%
+-commutative84.0%
Applied egg-rr84.0%
Taylor expanded in t around inf 45.3%
Taylor expanded in z around inf 54.7%
associate-+r+54.7%
Simplified54.7%
if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) Initial program 96.8%
associate-+l+96.8%
associate-+l-79.4%
associate-+l-96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in x around 0 45.4%
flip--45.5%
add-sqr-sqrt37.3%
add-sqr-sqrt45.5%
Applied egg-rr45.5%
associate--l+45.7%
+-inverses45.7%
metadata-eval45.7%
Simplified45.7%
Final simplification49.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z 1.0))) (t_2 (sqrt (+ 1.0 y))) (t_3 (sqrt (+ 1.0 x))))
(if (<= (+ (- t_2 (sqrt y)) (- t_3 (sqrt x))) 1.0001)
(+
(- t_1 (sqrt z))
(+
(* -0.125 (sqrt (/ 1.0 (pow y 3.0))))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_3)))))
(+
(- (+ 1.0 t_2) (+ (sqrt x) (sqrt y)))
(+ (/ 1.0 (+ (sqrt z) t_1)) (- (sqrt (+ 1.0 t)) (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((1.0 + x));
double tmp;
if (((t_2 - sqrt(y)) + (t_3 - sqrt(x))) <= 1.0001) {
tmp = (t_1 - sqrt(z)) + ((-0.125 * sqrt((1.0 / pow(y, 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3))));
} else {
tmp = ((1.0 + t_2) - (sqrt(x) + sqrt(y))) + ((1.0 / (sqrt(z) + t_1)) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = sqrt((1.0d0 + y))
t_3 = sqrt((1.0d0 + x))
if (((t_2 - sqrt(y)) + (t_3 - sqrt(x))) <= 1.0001d0) then
tmp = (t_1 - sqrt(z)) + (((-0.125d0) * sqrt((1.0d0 / (y ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_3))))
else
tmp = ((1.0d0 + t_2) - (sqrt(x) + sqrt(y))) + ((1.0d0 / (sqrt(z) + t_1)) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + 1.0));
double t_2 = Math.sqrt((1.0 + y));
double t_3 = Math.sqrt((1.0 + x));
double tmp;
if (((t_2 - Math.sqrt(y)) + (t_3 - Math.sqrt(x))) <= 1.0001) {
tmp = (t_1 - Math.sqrt(z)) + ((-0.125 * Math.sqrt((1.0 / Math.pow(y, 3.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_3))));
} else {
tmp = ((1.0 + t_2) - (Math.sqrt(x) + Math.sqrt(y))) + ((1.0 / (Math.sqrt(z) + t_1)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) t_2 = math.sqrt((1.0 + y)) t_3 = math.sqrt((1.0 + x)) tmp = 0 if ((t_2 - math.sqrt(y)) + (t_3 - math.sqrt(x))) <= 1.0001: tmp = (t_1 - math.sqrt(z)) + ((-0.125 * math.sqrt((1.0 / math.pow(y, 3.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_3)))) else: tmp = ((1.0 + t_2) - (math.sqrt(x) + math.sqrt(y))) + ((1.0 / (math.sqrt(z) + t_1)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) t_2 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(Float64(t_2 - sqrt(y)) + Float64(t_3 - sqrt(x))) <= 1.0001) tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(-0.125 * sqrt(Float64(1.0 / (y ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_3))))); else tmp = Float64(Float64(Float64(1.0 + t_2) - Float64(sqrt(x) + sqrt(y))) + Float64(Float64(1.0 / Float64(sqrt(z) + t_1)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((z + 1.0));
t_2 = sqrt((1.0 + y));
t_3 = sqrt((1.0 + x));
tmp = 0.0;
if (((t_2 - sqrt(y)) + (t_3 - sqrt(x))) <= 1.0001)
tmp = (t_1 - sqrt(z)) + ((-0.125 * sqrt((1.0 / (y ^ 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3))));
else
tmp = ((1.0 + t_2) - (sqrt(x) + sqrt(y))) + ((1.0 / (sqrt(z) + t_1)) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0001], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$2), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + x}\\
\mathbf{if}\;\left(t\_2 - \sqrt{y}\right) + \left(t\_3 - \sqrt{x}\right) \leq 1.0001:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(-0.125 \cdot \sqrt{\frac{1}{{y}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t\_2\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) + \left(\frac{1}{\sqrt{z} + t\_1} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 1.00009999999999999Initial program 85.0%
associate-+l+85.0%
associate-+l-59.7%
associate-+l-85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
flip--85.0%
flip--85.8%
frac-add85.8%
Applied egg-rr86.3%
fma-define86.3%
associate--l+86.3%
+-commutative86.3%
+-commutative86.3%
associate--l+89.5%
+-commutative89.5%
+-commutative89.5%
Simplified89.5%
add-cube-cbrt88.9%
pow388.8%
+-inverses88.8%
metadata-eval88.8%
*-commutative88.8%
*-un-lft-identity88.8%
+-commutative88.8%
Applied egg-rr88.8%
Taylor expanded in t around inf 49.9%
Taylor expanded in y around inf 35.6%
if 1.00009999999999999 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) Initial program 97.9%
associate-+l+97.9%
associate-+l-97.9%
associate-+l-97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 96.4%
flip--97.8%
add-sqr-sqrt81.8%
add-sqr-sqrt97.9%
Applied egg-rr96.5%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified96.9%
Final simplification52.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (- (sqrt (+ 1.0 y)) (sqrt y)))
(t_3 (sqrt (+ z 1.0))))
(if (<= t_2 2e-5)
(+
(- t_3 (sqrt z))
(+
(* -0.125 (sqrt (/ 1.0 (pow y 3.0))))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_1)))))
(+
(+ t_2 (- t_1 (sqrt x)))
(+ (/ 1.0 (+ (sqrt z) t_3)) (- (sqrt (+ 1.0 t)) (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y)) - sqrt(y);
double t_3 = sqrt((z + 1.0));
double tmp;
if (t_2 <= 2e-5) {
tmp = (t_3 - sqrt(z)) + ((-0.125 * sqrt((1.0 / pow(y, 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_1))));
} else {
tmp = (t_2 + (t_1 - sqrt(x))) + ((1.0 / (sqrt(z) + t_3)) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y)) - sqrt(y)
t_3 = sqrt((z + 1.0d0))
if (t_2 <= 2d-5) then
tmp = (t_3 - sqrt(z)) + (((-0.125d0) * sqrt((1.0d0 / (y ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_1))))
else
tmp = (t_2 + (t_1 - sqrt(x))) + ((1.0d0 / (sqrt(z) + t_3)) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double t_3 = Math.sqrt((z + 1.0));
double tmp;
if (t_2 <= 2e-5) {
tmp = (t_3 - Math.sqrt(z)) + ((-0.125 * Math.sqrt((1.0 / Math.pow(y, 3.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_1))));
} else {
tmp = (t_2 + (t_1 - Math.sqrt(x))) + ((1.0 / (Math.sqrt(z) + t_3)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) - math.sqrt(y) t_3 = math.sqrt((z + 1.0)) tmp = 0 if t_2 <= 2e-5: tmp = (t_3 - math.sqrt(z)) + ((-0.125 * math.sqrt((1.0 / math.pow(y, 3.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_1)))) else: tmp = (t_2 + (t_1 - math.sqrt(x))) + ((1.0 / (math.sqrt(z) + t_3)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) t_3 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (t_2 <= 2e-5) tmp = Float64(Float64(t_3 - sqrt(z)) + Float64(Float64(-0.125 * sqrt(Float64(1.0 / (y ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_1))))); else tmp = Float64(Float64(t_2 + Float64(t_1 - sqrt(x))) + Float64(Float64(1.0 / Float64(sqrt(z) + t_3)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + y)) - sqrt(y);
t_3 = sqrt((z + 1.0));
tmp = 0.0;
if (t_2 <= 2e-5)
tmp = (t_3 - sqrt(z)) + ((-0.125 * sqrt((1.0 / (y ^ 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_1))));
else
tmp = (t_2 + (t_1 - sqrt(x))) + ((1.0 / (sqrt(z) + t_3)) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 2e-5], N[(N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y} - \sqrt{y}\\
t_3 := \sqrt{z + 1}\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\left(t\_3 - \sqrt{z}\right) + \left(-0.125 \cdot \sqrt{\frac{1}{{y}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 + \left(t\_1 - \sqrt{x}\right)\right) + \left(\frac{1}{\sqrt{z} + t\_3} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 2.00000000000000016e-5Initial program 79.7%
associate-+l+79.7%
associate-+l-79.1%
associate-+l-79.7%
+-commutative79.7%
+-commutative79.7%
+-commutative79.7%
Simplified79.7%
flip--79.7%
flip--80.8%
frac-add80.7%
Applied egg-rr81.2%
fma-define81.2%
associate--l+81.2%
+-commutative81.2%
+-commutative81.2%
associate--l+86.1%
+-commutative86.1%
+-commutative86.1%
Simplified86.1%
add-cube-cbrt85.6%
pow385.6%
+-inverses85.6%
metadata-eval85.6%
*-commutative85.6%
*-un-lft-identity85.6%
+-commutative85.6%
Applied egg-rr85.6%
Taylor expanded in t around inf 50.0%
Taylor expanded in y around inf 53.9%
if 2.00000000000000016e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.2%
associate-+l+96.2%
associate-+l-63.1%
associate-+l-96.2%
+-commutative96.2%
+-commutative96.2%
+-commutative96.2%
Simplified96.2%
flip--96.2%
add-sqr-sqrt77.5%
add-sqr-sqrt96.7%
Applied egg-rr96.7%
associate--l+97.3%
+-inverses97.3%
metadata-eval97.3%
Simplified97.3%
Final simplification77.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1600000.0)
(+
(- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y)))
(+ (/ 1.0 (+ (sqrt z) (sqrt (+ z 1.0)))) (- (sqrt (+ 1.0 t)) (sqrt t))))
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))
(* 0.5 (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1600000.0) {
tmp = ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y))) + ((1.0 / (sqrt(z) + sqrt((z + 1.0)))) + (sqrt((1.0 + t)) - sqrt(t)));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))) + (0.5 * sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1600000.0d0) then
tmp = ((1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))) + ((1.0d0 / (sqrt(z) + sqrt((z + 1.0d0)))) + (sqrt((1.0d0 + t)) - sqrt(t)))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x))))) + (0.5d0 * sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1600000.0) {
tmp = ((1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y))) + ((1.0 / (Math.sqrt(z) + Math.sqrt((z + 1.0)))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x))))) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1600000.0: tmp = ((1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y))) + ((1.0 / (math.sqrt(z) + math.sqrt((z + 1.0)))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))))) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1600000.0) tmp = Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))) + Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(z + 1.0)))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x))))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1600000.0)
tmp = ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y))) + ((1.0 / (sqrt(z) + sqrt((z + 1.0)))) + (sqrt((1.0 + t)) - sqrt(t)));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))) + (0.5 * sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1600000.0], N[(N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1600000:\\
\;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) + \left(\frac{1}{\sqrt{z} + \sqrt{z + 1}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if y < 1.6e6Initial program 96.3%
associate-+l+96.3%
associate-+l-62.7%
associate-+l-96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 51.0%
flip--96.3%
add-sqr-sqrt77.4%
add-sqr-sqrt96.8%
Applied egg-rr51.1%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
Simplified51.3%
if 1.6e6 < y Initial program 79.8%
associate-+l+79.8%
associate-+l-79.2%
associate-+l-79.8%
+-commutative79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
flip--79.8%
flip--80.9%
frac-add80.9%
Applied egg-rr81.5%
fma-define81.5%
associate--l+81.5%
+-commutative81.5%
+-commutative81.5%
associate--l+86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in y around inf 90.0%
Taylor expanded in z around inf 50.3%
Taylor expanded in z around 0 32.0%
Final simplification42.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1600000.0)
(+
(- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y)))
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))
(* 0.5 (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1600000.0) {
tmp = ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y))) + ((sqrt((z + 1.0)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))) + (0.5 * sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1600000.0d0) then
tmp = ((1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))) + ((sqrt((z + 1.0d0)) - sqrt(z)) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x))))) + (0.5d0 * sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1600000.0) {
tmp = ((1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y))) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x))))) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1600000.0: tmp = ((1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y))) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))))) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1600000.0) tmp = Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x))))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1600000.0)
tmp = ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y))) + ((sqrt((z + 1.0)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))) + (0.5 * sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1600000.0], N[(N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1600000:\\
\;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if y < 1.6e6Initial program 96.3%
associate-+l+96.3%
associate-+l-62.7%
associate-+l-96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 51.0%
flip--51.1%
add-sqr-sqrt40.4%
add-sqr-sqrt51.2%
Applied egg-rr51.2%
associate--l+51.5%
+-inverses51.5%
metadata-eval51.5%
Simplified51.5%
if 1.6e6 < y Initial program 79.8%
associate-+l+79.8%
associate-+l-79.2%
associate-+l-79.8%
+-commutative79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
flip--79.8%
flip--80.9%
frac-add80.9%
Applied egg-rr81.5%
fma-define81.5%
associate--l+81.5%
+-commutative81.5%
+-commutative81.5%
associate--l+86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in y around inf 90.0%
Taylor expanded in z around inf 50.3%
Taylor expanded in z around 0 32.0%
Final simplification42.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1600000.0)
(+
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))))
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))
(* 0.5 (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1600000.0) {
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))) + (0.5 * sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1600000.0d0) then
tmp = (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))) + ((sqrt((z + 1.0d0)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t)))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x))))) + (0.5d0 * sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1600000.0) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)))) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x))))) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1600000.0: tmp = (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))))) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1600000.0) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x))))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1600000.0)
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))) + (0.5 * sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1600000.0], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1600000:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if y < 1.6e6Initial program 96.3%
associate-+l+96.3%
associate-+l-62.7%
associate-+l-96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 51.0%
associate--l+51.0%
Simplified51.0%
if 1.6e6 < y Initial program 79.8%
associate-+l+79.8%
associate-+l-79.2%
associate-+l-79.8%
+-commutative79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
flip--79.8%
flip--80.9%
frac-add80.9%
Applied egg-rr81.5%
fma-define81.5%
associate--l+81.5%
+-commutative81.5%
+-commutative81.5%
associate--l+86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in y around inf 90.0%
Taylor expanded in z around inf 50.3%
Taylor expanded in z around 0 32.0%
Final simplification42.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 2.5)
(+
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(-
(+ 2.0 (* y (+ 0.5 (* y (- (* y 0.0625) 0.125)))))
(+ (sqrt x) (sqrt y))))
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))
(* 0.5 (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.5) {
tmp = ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((2.0 + (y * (0.5 + (y * ((y * 0.0625) - 0.125))))) - (sqrt(x) + sqrt(y)));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))) + (0.5 * sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.5d0) then
tmp = ((sqrt((z + 1.0d0)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((2.0d0 + (y * (0.5d0 + (y * ((y * 0.0625d0) - 0.125d0))))) - (sqrt(x) + sqrt(y)))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x))))) + (0.5d0 * sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.5) {
tmp = ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((2.0 + (y * (0.5 + (y * ((y * 0.0625) - 0.125))))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x))))) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.5: tmp = ((math.sqrt((z + 1.0)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((2.0 + (y * (0.5 + (y * ((y * 0.0625) - 0.125))))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))))) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.5) tmp = Float64(Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(2.0 + Float64(y * Float64(0.5 + Float64(y * Float64(Float64(y * 0.0625) - 0.125))))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x))))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.5)
tmp = ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((2.0 + (y * (0.5 + (y * ((y * 0.0625) - 0.125))))) - (sqrt(x) + sqrt(y)));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))) + (0.5 * sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.5], N[(N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 + N[(y * N[(0.5 + N[(y * N[(N[(y * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(2 + y \cdot \left(0.5 + y \cdot \left(y \cdot 0.0625 - 0.125\right)\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if y < 2.5Initial program 96.6%
associate-+l+96.6%
associate-+l-62.6%
associate-+l-96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 51.2%
Taylor expanded in y around 0 50.5%
if 2.5 < y Initial program 80.4%
associate-+l+80.4%
associate-+l-78.5%
associate-+l-80.4%
+-commutative80.4%
+-commutative80.4%
+-commutative80.4%
Simplified80.4%
flip--80.3%
flip--81.6%
frac-add81.6%
Applied egg-rr82.3%
fma-define82.3%
associate--l+82.3%
+-commutative82.3%
+-commutative82.3%
associate--l+86.8%
+-commutative86.8%
+-commutative86.8%
Simplified86.8%
Taylor expanded in y around inf 88.2%
Taylor expanded in z around inf 50.0%
Taylor expanded in z around 0 31.8%
Final simplification41.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (* 0.5 (sqrt (/ 1.0 z))))
(t_3 (+ (sqrt x) (sqrt y))))
(if (<= y 6.1e-21)
(+
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(- 2.0 t_3))
(if (<= y 50000000.0)
(- (+ t_1 (+ (sqrt (+ 1.0 y)) t_2)) t_3)
(+ (+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_1))) t_2)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = 0.5 * sqrt((1.0 / z));
double t_3 = sqrt(x) + sqrt(y);
double tmp;
if (y <= 6.1e-21) {
tmp = ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - t_3);
} else if (y <= 50000000.0) {
tmp = (t_1 + (sqrt((1.0 + y)) + t_2)) - t_3;
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_1))) + t_2;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = 0.5d0 * sqrt((1.0d0 / z))
t_3 = sqrt(x) + sqrt(y)
if (y <= 6.1d-21) then
tmp = ((sqrt((z + 1.0d0)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (2.0d0 - t_3)
else if (y <= 50000000.0d0) then
tmp = (t_1 + (sqrt((1.0d0 + y)) + t_2)) - t_3
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_1))) + t_2
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = 0.5 * Math.sqrt((1.0 / z));
double t_3 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (y <= 6.1e-21) {
tmp = ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (2.0 - t_3);
} else if (y <= 50000000.0) {
tmp = (t_1 + (Math.sqrt((1.0 + y)) + t_2)) - t_3;
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_1))) + t_2;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = 0.5 * math.sqrt((1.0 / z)) t_3 = math.sqrt(x) + math.sqrt(y) tmp = 0 if y <= 6.1e-21: tmp = ((math.sqrt((z + 1.0)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (2.0 - t_3) elif y <= 50000000.0: tmp = (t_1 + (math.sqrt((1.0 + y)) + t_2)) - t_3 else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_1))) + t_2 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(0.5 * sqrt(Float64(1.0 / z))) t_3 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (y <= 6.1e-21) tmp = Float64(Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(2.0 - t_3)); elseif (y <= 50000000.0) tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) + t_2)) - t_3); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_1))) + t_2); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = 0.5 * sqrt((1.0 / z));
t_3 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (y <= 6.1e-21)
tmp = ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - t_3);
elseif (y <= 50000000.0)
tmp = (t_1 + (sqrt((1.0 + y)) + t_2)) - t_3;
else
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_1))) + t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.1e-21], N[(N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 - t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 50000000.0], N[(N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := 0.5 \cdot \sqrt{\frac{1}{z}}\\
t_3 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;y \leq 6.1 \cdot 10^{-21}:\\
\;\;\;\;\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(2 - t\_3\right)\\
\mathbf{elif}\;y \leq 50000000:\\
\;\;\;\;\left(t\_1 + \left(\sqrt{1 + y} + t\_2\right)\right) - t\_3\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_1}\right) + t\_2\\
\end{array}
\end{array}
if y < 6.10000000000000013e-21Initial program 96.4%
associate-+l+96.4%
associate-+l-62.8%
associate-+l-96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in x around 0 51.3%
Taylor expanded in y around 0 51.3%
if 6.10000000000000013e-21 < y < 5e7Initial program 95.6%
associate-+l+95.6%
associate-+l-63.3%
associate-+l-95.6%
+-commutative95.6%
+-commutative95.6%
+-commutative95.6%
Simplified95.6%
Taylor expanded in t around inf 21.2%
associate--l+26.7%
Simplified26.7%
Taylor expanded in z around inf 22.1%
if 5e7 < y Initial program 79.8%
associate-+l+79.8%
associate-+l-79.1%
associate-+l-79.8%
+-commutative79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
flip--79.8%
flip--80.9%
frac-add80.9%
Applied egg-rr81.4%
fma-define81.4%
associate--l+81.4%
+-commutative81.4%
+-commutative81.4%
associate--l+86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in y around inf 90.0%
Taylor expanded in z around inf 50.6%
Taylor expanded in z around 0 32.1%
Final simplification40.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (sqrt (/ 1.0 z)))) (t_2 (sqrt (+ 1.0 x))))
(if (<= y 1.05e-6)
(+
(- t_2 (sqrt x))
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (+ 1.0 (- (* 0.5 y) (sqrt y)))))
(if (<= y 53000000.0)
(- (+ t_2 (+ (sqrt (+ 1.0 y)) t_1)) (+ (sqrt x) (sqrt y)))
(+ (+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_2))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * sqrt((1.0 / z));
double t_2 = sqrt((1.0 + x));
double tmp;
if (y <= 1.05e-6) {
tmp = (t_2 - sqrt(x)) + ((sqrt((z + 1.0)) - sqrt(z)) + (1.0 + ((0.5 * y) - sqrt(y))));
} else if (y <= 53000000.0) {
tmp = (t_2 + (sqrt((1.0 + y)) + t_1)) - (sqrt(x) + sqrt(y));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))) + t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 0.5d0 * sqrt((1.0d0 / z))
t_2 = sqrt((1.0d0 + x))
if (y <= 1.05d-6) then
tmp = (t_2 - sqrt(x)) + ((sqrt((z + 1.0d0)) - sqrt(z)) + (1.0d0 + ((0.5d0 * y) - sqrt(y))))
else if (y <= 53000000.0d0) then
tmp = (t_2 + (sqrt((1.0d0 + y)) + t_1)) - (sqrt(x) + sqrt(y))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_2))) + t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 0.5 * Math.sqrt((1.0 / z));
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.05e-6) {
tmp = (t_2 - Math.sqrt(x)) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (1.0 + ((0.5 * y) - Math.sqrt(y))));
} else if (y <= 53000000.0) {
tmp = (t_2 + (Math.sqrt((1.0 + y)) + t_1)) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_2))) + t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 0.5 * math.sqrt((1.0 / z)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.05e-6: tmp = (t_2 - math.sqrt(x)) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) + (1.0 + ((0.5 * y) - math.sqrt(y)))) elif y <= 53000000.0: tmp = (t_2 + (math.sqrt((1.0 + y)) + t_1)) - (math.sqrt(x) + math.sqrt(y)) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_2))) + t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(0.5 * sqrt(Float64(1.0 / z))) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.05e-6) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(1.0 + Float64(Float64(0.5 * y) - sqrt(y))))); elseif (y <= 53000000.0) tmp = Float64(Float64(t_2 + Float64(sqrt(Float64(1.0 + y)) + t_1)) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_2))) + t_1); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 0.5 * sqrt((1.0 / z));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.05e-6)
tmp = (t_2 - sqrt(x)) + ((sqrt((z + 1.0)) - sqrt(z)) + (1.0 + ((0.5 * y) - sqrt(y))));
elseif (y <= 53000000.0)
tmp = (t_2 + (sqrt((1.0 + y)) + t_1)) - (sqrt(x) + sqrt(y));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))) + t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.05e-6], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(0.5 * y), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 53000000.0], N[(N[(t$95$2 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 0.5 \cdot \sqrt{\frac{1}{z}}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.05 \cdot 10^{-6}:\\
\;\;\;\;\left(t\_2 - \sqrt{x}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(1 + \left(0.5 \cdot y - \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;y \leq 53000000:\\
\;\;\;\;\left(t\_2 + \left(\sqrt{1 + y} + t\_1\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_2}\right) + t\_1\\
\end{array}
\end{array}
if y < 1.0499999999999999e-6Initial program 96.4%
associate-+l+96.4%
associate-+l+96.4%
+-commutative96.4%
+-commutative96.4%
associate-+l-78.2%
+-commutative78.2%
+-commutative78.2%
Simplified78.2%
Taylor expanded in y around 0 78.2%
associate--l+78.2%
*-commutative78.2%
Simplified78.2%
Taylor expanded in t around inf 53.4%
if 1.0499999999999999e-6 < y < 5.3e7Initial program 94.5%
associate-+l+94.5%
associate-+l-64.4%
associate-+l-94.5%
+-commutative94.5%
+-commutative94.5%
+-commutative94.5%
Simplified94.5%
Taylor expanded in t around inf 25.5%
associate--l+31.4%
Simplified31.4%
Taylor expanded in z around inf 20.0%
if 5.3e7 < y Initial program 79.8%
associate-+l+79.8%
associate-+l-79.1%
associate-+l-79.8%
+-commutative79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
flip--79.8%
flip--80.9%
frac-add80.9%
Applied egg-rr81.4%
fma-define81.4%
associate--l+81.4%
+-commutative81.4%
+-commutative81.4%
associate--l+86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in y around inf 90.0%
Taylor expanded in z around inf 50.6%
Taylor expanded in z around 0 32.1%
Final simplification41.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt x) (sqrt y)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (* 0.5 (sqrt (/ 1.0 z)))))
(if (<= y 2.65e-36)
(+ 1.0 (+ t_2 (- (sqrt (+ z 1.0)) (+ (sqrt z) t_1))))
(if (<= y 26500000.0)
(- (+ t_3 (+ t_2 t_4)) t_1)
(+ (+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_3))) t_4)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((1.0 + x));
double t_4 = 0.5 * sqrt((1.0 / z));
double tmp;
if (y <= 2.65e-36) {
tmp = 1.0 + (t_2 + (sqrt((z + 1.0)) - (sqrt(z) + t_1)));
} else if (y <= 26500000.0) {
tmp = (t_3 + (t_2 + t_4)) - t_1;
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3))) + t_4;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
t_2 = sqrt((1.0d0 + y))
t_3 = sqrt((1.0d0 + x))
t_4 = 0.5d0 * sqrt((1.0d0 / z))
if (y <= 2.65d-36) then
tmp = 1.0d0 + (t_2 + (sqrt((z + 1.0d0)) - (sqrt(z) + t_1)))
else if (y <= 26500000.0d0) then
tmp = (t_3 + (t_2 + t_4)) - t_1
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_3))) + t_4
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + y));
double t_3 = Math.sqrt((1.0 + x));
double t_4 = 0.5 * Math.sqrt((1.0 / z));
double tmp;
if (y <= 2.65e-36) {
tmp = 1.0 + (t_2 + (Math.sqrt((z + 1.0)) - (Math.sqrt(z) + t_1)));
} else if (y <= 26500000.0) {
tmp = (t_3 + (t_2 + t_4)) - t_1;
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_3))) + t_4;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) t_2 = math.sqrt((1.0 + y)) t_3 = math.sqrt((1.0 + x)) t_4 = 0.5 * math.sqrt((1.0 / z)) tmp = 0 if y <= 2.65e-36: tmp = 1.0 + (t_2 + (math.sqrt((z + 1.0)) - (math.sqrt(z) + t_1))) elif y <= 26500000.0: tmp = (t_3 + (t_2 + t_4)) - t_1 else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_3))) + t_4 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) t_2 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(0.5 * sqrt(Float64(1.0 / z))) tmp = 0.0 if (y <= 2.65e-36) tmp = Float64(1.0 + Float64(t_2 + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(z) + t_1)))); elseif (y <= 26500000.0) tmp = Float64(Float64(t_3 + Float64(t_2 + t_4)) - t_1); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_3))) + t_4); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
t_2 = sqrt((1.0 + y));
t_3 = sqrt((1.0 + x));
t_4 = 0.5 * sqrt((1.0 / z));
tmp = 0.0;
if (y <= 2.65e-36)
tmp = 1.0 + (t_2 + (sqrt((z + 1.0)) - (sqrt(z) + t_1)));
elseif (y <= 26500000.0)
tmp = (t_3 + (t_2 + t_4)) - t_1;
else
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3))) + t_4;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.65e-36], N[(1.0 + N[(t$95$2 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 26500000.0], N[(N[(t$95$3 + N[(t$95$2 + t$95$4), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + x}\\
t_4 := 0.5 \cdot \sqrt{\frac{1}{z}}\\
\mathbf{if}\;y \leq 2.65 \cdot 10^{-36}:\\
\;\;\;\;1 + \left(t\_2 + \left(\sqrt{z + 1} - \left(\sqrt{z} + t\_1\right)\right)\right)\\
\mathbf{elif}\;y \leq 26500000:\\
\;\;\;\;\left(t\_3 + \left(t\_2 + t\_4\right)\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_3}\right) + t\_4\\
\end{array}
\end{array}
if y < 2.6499999999999999e-36Initial program 96.3%
associate-+l+96.3%
associate-+l-62.7%
associate-+l-96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in t around inf 21.6%
associate--l+24.8%
Simplified24.8%
Taylor expanded in x around 0 18.7%
associate--l+23.9%
associate-+r-31.4%
associate-+r+31.4%
Simplified31.4%
if 2.6499999999999999e-36 < y < 2.65e7Initial program 96.2%
associate-+l+96.2%
associate-+l-64.0%
associate-+l-96.2%
+-commutative96.2%
+-commutative96.2%
+-commutative96.2%
Simplified96.2%
Taylor expanded in t around inf 18.5%
associate--l+24.8%
Simplified24.8%
Taylor expanded in z around inf 25.0%
if 2.65e7 < y Initial program 79.8%
associate-+l+79.8%
associate-+l-79.1%
associate-+l-79.8%
+-commutative79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
flip--79.8%
flip--80.9%
frac-add80.9%
Applied egg-rr81.4%
fma-define81.4%
associate--l+81.4%
+-commutative81.4%
+-commutative81.4%
associate--l+86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in y around inf 90.0%
Taylor expanded in z around inf 50.6%
Taylor expanded in z around 0 32.1%
Final simplification31.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (sqrt (+ 1.0 x))))
(if (<= y 3.4e-22)
(+ 1.0 (+ t_1 (- (sqrt (+ z 1.0)) (+ (sqrt z) (+ (sqrt x) (sqrt y))))))
(if (<= y 9000000.0)
(+
t_2
(*
x
(+ (* t_1 (/ 1.0 x)) (- (* (sqrt y) (/ -1.0 x)) (sqrt (/ 1.0 x))))))
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_2)))
(* 0.5 (sqrt (/ 1.0 z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + x));
double tmp;
if (y <= 3.4e-22) {
tmp = 1.0 + (t_1 + (sqrt((z + 1.0)) - (sqrt(z) + (sqrt(x) + sqrt(y)))));
} else if (y <= 9000000.0) {
tmp = t_2 + (x * ((t_1 * (1.0 / x)) + ((sqrt(y) * (-1.0 / x)) - sqrt((1.0 / x)))));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))) + (0.5 * sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + x))
if (y <= 3.4d-22) then
tmp = 1.0d0 + (t_1 + (sqrt((z + 1.0d0)) - (sqrt(z) + (sqrt(x) + sqrt(y)))))
else if (y <= 9000000.0d0) then
tmp = t_2 + (x * ((t_1 * (1.0d0 / x)) + ((sqrt(y) * ((-1.0d0) / x)) - sqrt((1.0d0 / x)))))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_2))) + (0.5d0 * sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 3.4e-22) {
tmp = 1.0 + (t_1 + (Math.sqrt((z + 1.0)) - (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y)))));
} else if (y <= 9000000.0) {
tmp = t_2 + (x * ((t_1 * (1.0 / x)) + ((Math.sqrt(y) * (-1.0 / x)) - Math.sqrt((1.0 / x)))));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_2))) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if y <= 3.4e-22: tmp = 1.0 + (t_1 + (math.sqrt((z + 1.0)) - (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y))))) elif y <= 9000000.0: tmp = t_2 + (x * ((t_1 * (1.0 / x)) + ((math.sqrt(y) * (-1.0 / x)) - math.sqrt((1.0 / x))))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_2))) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 3.4e-22) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y)))))); elseif (y <= 9000000.0) tmp = Float64(t_2 + Float64(x * Float64(Float64(t_1 * Float64(1.0 / x)) + Float64(Float64(sqrt(y) * Float64(-1.0 / x)) - sqrt(Float64(1.0 / x)))))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_2))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 3.4e-22)
tmp = 1.0 + (t_1 + (sqrt((z + 1.0)) - (sqrt(z) + (sqrt(x) + sqrt(y)))));
elseif (y <= 9000000.0)
tmp = t_2 + (x * ((t_1 * (1.0 / x)) + ((sqrt(y) * (-1.0 / x)) - sqrt((1.0 / x)))));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))) + (0.5 * sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3.4e-22], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9000000.0], N[(t$95$2 + N[(x * N[(N[(t$95$1 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[y], $MachinePrecision] * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 3.4 \cdot 10^{-22}:\\
\;\;\;\;1 + \left(t\_1 + \left(\sqrt{z + 1} - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\
\mathbf{elif}\;y \leq 9000000:\\
\;\;\;\;t\_2 + x \cdot \left(t\_1 \cdot \frac{1}{x} + \left(\sqrt{y} \cdot \frac{-1}{x} - \sqrt{\frac{1}{x}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_2}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if y < 3.3999999999999998e-22Initial program 96.4%
associate-+l+96.4%
associate-+l-62.8%
associate-+l-96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in t around inf 21.2%
associate--l+24.5%
Simplified24.5%
Taylor expanded in x around 0 18.3%
associate--l+24.4%
associate-+r-31.7%
associate-+r+31.7%
Simplified31.7%
if 3.3999999999999998e-22 < y < 9e6Initial program 96.3%
associate-+l+96.3%
associate-+l-62.0%
associate-+l-96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in t around inf 17.2%
associate--l+23.0%
Simplified23.0%
Taylor expanded in x around inf 19.3%
distribute-lft-out19.2%
+-commutative19.2%
distribute-lft-out19.2%
Simplified19.2%
Taylor expanded in z around inf 25.0%
if 9e6 < y Initial program 79.8%
associate-+l+79.8%
associate-+l-79.2%
associate-+l-79.8%
+-commutative79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
flip--79.8%
flip--80.9%
frac-add80.9%
Applied egg-rr81.5%
fma-define81.5%
associate--l+81.5%
+-commutative81.5%
+-commutative81.5%
associate--l+86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in y around inf 90.0%
Taylor expanded in z around inf 50.3%
Taylor expanded in z around 0 32.0%
Final simplification31.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (sqrt (+ 1.0 x))))
(if (<= z 1.82)
(+ t_2 (- (+ (+ 1.0 t_1) (* z (+ 0.5 (* z -0.125)))) (sqrt z)))
(+ t_2 (- t_1 (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + x));
double tmp;
if (z <= 1.82) {
tmp = t_2 + (((1.0 + t_1) + (z * (0.5 + (z * -0.125)))) - sqrt(z));
} else {
tmp = t_2 + (t_1 - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + x))
if (z <= 1.82d0) then
tmp = t_2 + (((1.0d0 + t_1) + (z * (0.5d0 + (z * (-0.125d0))))) - sqrt(z))
else
tmp = t_2 + (t_1 - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (z <= 1.82) {
tmp = t_2 + (((1.0 + t_1) + (z * (0.5 + (z * -0.125)))) - Math.sqrt(z));
} else {
tmp = t_2 + (t_1 - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if z <= 1.82: tmp = t_2 + (((1.0 + t_1) + (z * (0.5 + (z * -0.125)))) - math.sqrt(z)) else: tmp = t_2 + (t_1 - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (z <= 1.82) tmp = Float64(t_2 + Float64(Float64(Float64(1.0 + t_1) + Float64(z * Float64(0.5 + Float64(z * -0.125)))) - sqrt(z))); else tmp = Float64(t_2 + Float64(t_1 - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (z <= 1.82)
tmp = t_2 + (((1.0 + t_1) + (z * (0.5 + (z * -0.125)))) - sqrt(z));
else
tmp = t_2 + (t_1 - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.82], N[(t$95$2 + N[(N[(N[(1.0 + t$95$1), $MachinePrecision] + N[(z * N[(0.5 + N[(z * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;z \leq 1.82:\\
\;\;\;\;t\_2 + \left(\left(\left(1 + t\_1\right) + z \cdot \left(0.5 + z \cdot -0.125\right)\right) - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1.82000000000000006Initial program 97.2%
associate-+l+97.2%
associate-+l-79.4%
associate-+l-97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
Taylor expanded in t around inf 20.7%
associate--l+24.1%
Simplified24.1%
Taylor expanded in z around 0 24.1%
associate-+r+24.1%
associate-+r+24.1%
Simplified24.1%
Taylor expanded in z around inf 18.7%
if 1.82000000000000006 < z Initial program 79.9%
associate-+l+79.9%
associate-+l-61.3%
associate-+l-79.9%
+-commutative79.9%
+-commutative79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in t around inf 5.3%
associate--l+21.8%
Simplified21.8%
Taylor expanded in z around inf 19.3%
associate--l+30.5%
Simplified30.5%
Final simplification24.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= z 2.1)
(+
t_1
(- (+ (+ 1.0 (sqrt (+ 1.0 y))) (* z (+ 0.5 (* z -0.125)))) (sqrt z)))
(- t_1 (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (z <= 2.1) {
tmp = t_1 + (((1.0 + sqrt((1.0 + y))) + (z * (0.5 + (z * -0.125)))) - sqrt(z));
} else {
tmp = t_1 - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (z <= 2.1d0) then
tmp = t_1 + (((1.0d0 + sqrt((1.0d0 + y))) + (z * (0.5d0 + (z * (-0.125d0))))) - sqrt(z))
else
tmp = t_1 - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (z <= 2.1) {
tmp = t_1 + (((1.0 + Math.sqrt((1.0 + y))) + (z * (0.5 + (z * -0.125)))) - Math.sqrt(z));
} else {
tmp = t_1 - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if z <= 2.1: tmp = t_1 + (((1.0 + math.sqrt((1.0 + y))) + (z * (0.5 + (z * -0.125)))) - math.sqrt(z)) else: tmp = t_1 - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (z <= 2.1) tmp = Float64(t_1 + Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) + Float64(z * Float64(0.5 + Float64(z * -0.125)))) - sqrt(z))); else tmp = Float64(t_1 - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (z <= 2.1)
tmp = t_1 + (((1.0 + sqrt((1.0 + y))) + (z * (0.5 + (z * -0.125)))) - sqrt(z));
else
tmp = t_1 - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.1], N[(t$95$1 + N[(N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(z * N[(0.5 + N[(z * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;z \leq 2.1:\\
\;\;\;\;t\_1 + \left(\left(\left(1 + \sqrt{1 + y}\right) + z \cdot \left(0.5 + z \cdot -0.125\right)\right) - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 - \sqrt{x}\\
\end{array}
\end{array}
if z < 2.10000000000000009Initial program 97.2%
associate-+l+97.2%
associate-+l-79.4%
associate-+l-97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
Taylor expanded in t around inf 20.7%
associate--l+24.1%
Simplified24.1%
Taylor expanded in z around 0 24.1%
associate-+r+24.1%
associate-+r+24.1%
Simplified24.1%
Taylor expanded in z around inf 18.7%
if 2.10000000000000009 < z Initial program 79.9%
associate-+l+79.9%
associate-+l-61.3%
associate-+l-79.9%
+-commutative79.9%
+-commutative79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in t around inf 5.3%
associate--l+21.8%
Simplified21.8%
Taylor expanded in x around inf 19.6%
neg-mul-119.6%
Simplified19.6%
Final simplification19.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= z 6.2)
(+
t_1
(- (+ (+ 1.0 (sqrt (+ 1.0 y))) (* z (+ 0.5 (* z -0.125)))) (sqrt y)))
(- t_1 (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (z <= 6.2) {
tmp = t_1 + (((1.0 + sqrt((1.0 + y))) + (z * (0.5 + (z * -0.125)))) - sqrt(y));
} else {
tmp = t_1 - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (z <= 6.2d0) then
tmp = t_1 + (((1.0d0 + sqrt((1.0d0 + y))) + (z * (0.5d0 + (z * (-0.125d0))))) - sqrt(y))
else
tmp = t_1 - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (z <= 6.2) {
tmp = t_1 + (((1.0 + Math.sqrt((1.0 + y))) + (z * (0.5 + (z * -0.125)))) - Math.sqrt(y));
} else {
tmp = t_1 - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if z <= 6.2: tmp = t_1 + (((1.0 + math.sqrt((1.0 + y))) + (z * (0.5 + (z * -0.125)))) - math.sqrt(y)) else: tmp = t_1 - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (z <= 6.2) tmp = Float64(t_1 + Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) + Float64(z * Float64(0.5 + Float64(z * -0.125)))) - sqrt(y))); else tmp = Float64(t_1 - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (z <= 6.2)
tmp = t_1 + (((1.0 + sqrt((1.0 + y))) + (z * (0.5 + (z * -0.125)))) - sqrt(y));
else
tmp = t_1 - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 6.2], N[(t$95$1 + N[(N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(z * N[(0.5 + N[(z * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;z \leq 6.2:\\
\;\;\;\;t\_1 + \left(\left(\left(1 + \sqrt{1 + y}\right) + z \cdot \left(0.5 + z \cdot -0.125\right)\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 - \sqrt{x}\\
\end{array}
\end{array}
if z < 6.20000000000000018Initial program 97.2%
associate-+l+97.2%
associate-+l-79.4%
associate-+l-97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
Taylor expanded in t around inf 20.7%
associate--l+24.1%
Simplified24.1%
Taylor expanded in z around 0 24.1%
associate-+r+24.1%
associate-+r+24.1%
Simplified24.1%
Taylor expanded in y around inf 23.0%
if 6.20000000000000018 < z Initial program 79.9%
associate-+l+79.9%
associate-+l-61.3%
associate-+l-79.9%
+-commutative79.9%
+-commutative79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in t around inf 5.3%
associate--l+21.8%
Simplified21.8%
Taylor expanded in x around inf 19.6%
neg-mul-119.6%
Simplified19.6%
Final simplification21.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ 1.0 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + x)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((1.0d0 + x)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + x)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + x} - \sqrt{x}
\end{array}
Initial program 88.6%
associate-+l+88.6%
associate-+l-70.4%
associate-+l-88.6%
+-commutative88.6%
+-commutative88.6%
+-commutative88.6%
Simplified88.6%
Taylor expanded in t around inf 13.1%
associate--l+23.0%
Simplified23.0%
Taylor expanded in x around inf 15.3%
neg-mul-115.3%
Simplified15.3%
Final simplification15.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (* 0.5 y) (sqrt y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (0.5 * y) - sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (0.5d0 * y) - sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (0.5 * y) - Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (0.5 * y) - math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(0.5 * y) - sqrt(y)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (0.5 * y) - sqrt(y);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(0.5 * y), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot y - \sqrt{y}
\end{array}
Initial program 88.6%
associate-+l+88.6%
associate-+l+88.6%
+-commutative88.6%
+-commutative88.6%
associate-+l-69.2%
+-commutative69.2%
+-commutative69.2%
Simplified69.2%
Taylor expanded in y around 0 41.7%
associate--l+41.7%
*-commutative41.7%
Simplified41.7%
Taylor expanded in y around inf 3.7%
Taylor expanded in y around 0 3.7%
mul-1-neg3.7%
+-commutative3.7%
sub-neg3.7%
*-commutative3.7%
Simplified3.7%
Final simplification3.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (- 1.0 (sqrt y)) -1.0))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 - sqrt(y)) + -1.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (1.0d0 - sqrt(y)) + (-1.0d0)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (1.0 - Math.sqrt(y)) + -1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 - math.sqrt(y)) + -1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 - sqrt(y)) + -1.0) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 - sqrt(y)) + -1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(1 - \sqrt{y}\right) + -1
\end{array}
Initial program 88.6%
associate-+l+88.6%
associate-+l+88.6%
+-commutative88.6%
+-commutative88.6%
associate-+l-69.2%
+-commutative69.2%
+-commutative69.2%
Simplified69.2%
Taylor expanded in y around 0 41.7%
associate--l+41.7%
*-commutative41.7%
Simplified41.7%
Taylor expanded in y around inf 3.7%
Taylor expanded in y around 0 1.6%
mul-1-neg1.6%
Simplified1.6%
expm1-log1p-u0.9%
expm1-undefine1.5%
Applied egg-rr1.5%
sub-neg1.5%
log1p-undefine1.5%
rem-exp-log2.2%
unsub-neg2.2%
metadata-eval2.2%
Simplified2.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(y)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(y);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[y], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{y}
\end{array}
Initial program 88.6%
associate-+l+88.6%
associate-+l+88.6%
+-commutative88.6%
+-commutative88.6%
associate-+l-69.2%
+-commutative69.2%
+-commutative69.2%
Simplified69.2%
Taylor expanded in y around 0 41.7%
associate--l+41.7%
*-commutative41.7%
Simplified41.7%
Taylor expanded in y around inf 3.7%
Taylor expanded in y around 0 1.6%
mul-1-neg1.6%
Simplified1.6%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024185
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (sqrt t))))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))