
(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 17 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 (+ 1.0 t)) (sqrt t)))
(t_2 (+ (sqrt (+ 1.0 y)) (sqrt y)))
(t_3 (sqrt (+ x 1.0)))
(t_4 (sqrt (+ 1.0 z))))
(if (<= (- t_3 (sqrt x)) 0.02)
(+
(/ (+ 1.0 (/ -1.0 (pow t_2 2.0))) (+ (+ t_3 (sqrt x)) (/ -1.0 t_2)))
(+ (- t_4 (sqrt z)) t_1))
(+
(+ t_3 (- (log (exp (/ 1.0 t_2))) (sqrt x)))
(+ t_1 (/ 1.0 (+ t_4 (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + y)) + sqrt(y);
double t_3 = sqrt((x + 1.0));
double t_4 = sqrt((1.0 + z));
double tmp;
if ((t_3 - sqrt(x)) <= 0.02) {
tmp = ((1.0 + (-1.0 / pow(t_2, 2.0))) / ((t_3 + sqrt(x)) + (-1.0 / t_2))) + ((t_4 - sqrt(z)) + t_1);
} else {
tmp = (t_3 + (log(exp((1.0 / t_2))) - sqrt(x))) + (t_1 + (1.0 / (t_4 + sqrt(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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + y)) + sqrt(y)
t_3 = sqrt((x + 1.0d0))
t_4 = sqrt((1.0d0 + z))
if ((t_3 - sqrt(x)) <= 0.02d0) then
tmp = ((1.0d0 + ((-1.0d0) / (t_2 ** 2.0d0))) / ((t_3 + sqrt(x)) + ((-1.0d0) / t_2))) + ((t_4 - sqrt(z)) + t_1)
else
tmp = (t_3 + (log(exp((1.0d0 / t_2))) - sqrt(x))) + (t_1 + (1.0d0 / (t_4 + sqrt(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 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + y)) + Math.sqrt(y);
double t_3 = Math.sqrt((x + 1.0));
double t_4 = Math.sqrt((1.0 + z));
double tmp;
if ((t_3 - Math.sqrt(x)) <= 0.02) {
tmp = ((1.0 + (-1.0 / Math.pow(t_2, 2.0))) / ((t_3 + Math.sqrt(x)) + (-1.0 / t_2))) + ((t_4 - Math.sqrt(z)) + t_1);
} else {
tmp = (t_3 + (Math.log(Math.exp((1.0 / t_2))) - Math.sqrt(x))) + (t_1 + (1.0 / (t_4 + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + y)) + math.sqrt(y) t_3 = math.sqrt((x + 1.0)) t_4 = math.sqrt((1.0 + z)) tmp = 0 if (t_3 - math.sqrt(x)) <= 0.02: tmp = ((1.0 + (-1.0 / math.pow(t_2, 2.0))) / ((t_3 + math.sqrt(x)) + (-1.0 / t_2))) + ((t_4 - math.sqrt(z)) + t_1) else: tmp = (t_3 + (math.log(math.exp((1.0 / t_2))) - math.sqrt(x))) + (t_1 + (1.0 / (t_4 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = Float64(sqrt(Float64(1.0 + y)) + sqrt(y)) t_3 = sqrt(Float64(x + 1.0)) t_4 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(t_3 - sqrt(x)) <= 0.02) tmp = Float64(Float64(Float64(1.0 + Float64(-1.0 / (t_2 ^ 2.0))) / Float64(Float64(t_3 + sqrt(x)) + Float64(-1.0 / t_2))) + Float64(Float64(t_4 - sqrt(z)) + t_1)); else tmp = Float64(Float64(t_3 + Float64(log(exp(Float64(1.0 / t_2))) - sqrt(x))) + Float64(t_1 + Float64(1.0 / Float64(t_4 + sqrt(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 + t)) - sqrt(t);
t_2 = sqrt((1.0 + y)) + sqrt(y);
t_3 = sqrt((x + 1.0));
t_4 = sqrt((1.0 + z));
tmp = 0.0;
if ((t_3 - sqrt(x)) <= 0.02)
tmp = ((1.0 + (-1.0 / (t_2 ^ 2.0))) / ((t_3 + sqrt(x)) + (-1.0 / t_2))) + ((t_4 - sqrt(z)) + t_1);
else
tmp = (t_3 + (log(exp((1.0 / t_2))) - sqrt(x))) + (t_1 + (1.0 / (t_4 + sqrt(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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.02], N[(N[(N[(1.0 + N[(-1.0 / N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$3 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$3 + N[(N[Log[N[Exp[N[(1.0 / t$95$2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y} + \sqrt{y}\\
t_3 := \sqrt{x + 1}\\
t_4 := \sqrt{1 + z}\\
\mathbf{if}\;t_3 - \sqrt{x} \leq 0.02:\\
\;\;\;\;\frac{1 + \frac{-1}{{t_2}^{2}}}{\left(t_3 + \sqrt{x}\right) + \frac{-1}{t_2}} + \left(\left(t_4 - \sqrt{z}\right) + t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_3 + \left(\log \left(e^{\frac{1}{t_2}}\right) - \sqrt{x}\right)\right) + \left(t_1 + \frac{1}{t_4 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.0200000000000000004Initial program 91.8%
associate-+l+91.8%
associate-+l-50.1%
+-commutative50.1%
sub-neg50.1%
sub-neg50.1%
+-commutative50.1%
+-commutative50.1%
Simplified50.1%
flip--50.1%
add-sqr-sqrt40.8%
add-sqr-sqrt50.1%
Applied egg-rr50.1%
associate--l+50.1%
+-inverses50.1%
metadata-eval50.1%
Simplified50.1%
flip--47.8%
add-sqr-sqrt25.5%
Applied egg-rr25.5%
Simplified10.5%
Taylor expanded in x around 0 47.5%
pow-base-147.5%
*-lft-identity47.5%
Simplified47.5%
if 0.0200000000000000004 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.4%
associate-+l+96.4%
associate-+l-96.4%
+-commutative96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
flip--96.4%
add-sqr-sqrt72.4%
add-sqr-sqrt97.0%
Applied egg-rr97.0%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified97.7%
flip--97.7%
add-sqr-sqrt75.7%
+-commutative75.7%
add-sqr-sqrt97.7%
+-commutative97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 98.5%
add-log-exp98.5%
Applied egg-rr98.5%
Final simplification73.6%
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 t)) (sqrt t)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(exp
(log
(-
(- (sqrt (+ x 1.0)) (sqrt x))
(/ -1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + exp(log(((sqrt((x + 1.0)) - sqrt(x)) - (-1.0 / (sqrt((1.0 + 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 = ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + exp(log(((sqrt((x + 1.0d0)) - sqrt(x)) - ((-1.0d0) / (sqrt((1.0d0 + 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 ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + Math.exp(Math.log(((Math.sqrt((x + 1.0)) - Math.sqrt(x)) - (-1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + math.exp(math.log(((math.sqrt((x + 1.0)) - math.sqrt(x)) - (-1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + exp(log(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) - Float64(-1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + exp(log(((sqrt((x + 1.0)) - sqrt(x)) - (-1.0 / (sqrt((1.0 + 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[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Exp[N[Log[N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(-1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + e^{\log \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \frac{-1}{\sqrt{1 + y} + \sqrt{y}}\right)}
\end{array}
Initial program 94.1%
associate-+l+94.1%
associate-+l-73.8%
+-commutative73.8%
sub-neg73.8%
sub-neg73.8%
+-commutative73.8%
+-commutative73.8%
Simplified73.8%
flip--73.8%
add-sqr-sqrt57.0%
add-sqr-sqrt74.1%
Applied egg-rr74.1%
associate--l+74.5%
+-inverses74.5%
metadata-eval74.5%
Simplified74.5%
flip--74.4%
add-sqr-sqrt60.6%
+-commutative60.6%
add-sqr-sqrt74.5%
+-commutative74.5%
Applied egg-rr74.5%
Taylor expanded in z around 0 75.5%
add-exp-log75.5%
associate--r-96.1%
Applied egg-rr96.1%
Final simplification96.1%
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 t)) (sqrt t)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))) (- (sqrt (+ x 1.0)) (+ (sqrt x) (/ -1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + (sqrt((x + 1.0)) - (sqrt(x) + (-1.0 / (sqrt((1.0 + 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 = ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + (sqrt((x + 1.0d0)) - (sqrt(x) + ((-1.0d0) / (sqrt((1.0d0 + 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 ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + (Math.sqrt((x + 1.0)) - (Math.sqrt(x) + (-1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + (math.sqrt((x + 1.0)) - (math.sqrt(x) + (-1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + Float64(sqrt(Float64(x + 1.0)) - Float64(sqrt(x) + Float64(-1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + (sqrt((x + 1.0)) - (sqrt(x) + (-1.0 / (sqrt((1.0 + 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[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(-1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(\sqrt{x + 1} - \left(\sqrt{x} + \frac{-1}{\sqrt{1 + y} + \sqrt{y}}\right)\right)
\end{array}
Initial program 94.1%
associate-+l+94.1%
associate-+l-73.8%
+-commutative73.8%
sub-neg73.8%
sub-neg73.8%
+-commutative73.8%
+-commutative73.8%
Simplified73.8%
flip--73.8%
add-sqr-sqrt57.0%
add-sqr-sqrt74.1%
Applied egg-rr74.1%
associate--l+74.5%
+-inverses74.5%
metadata-eval74.5%
Simplified74.5%
flip--74.4%
add-sqr-sqrt60.6%
+-commutative60.6%
add-sqr-sqrt74.5%
+-commutative74.5%
Applied egg-rr74.5%
Taylor expanded in z around 0 75.5%
Final simplification75.5%
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 t)) (sqrt t)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))) (+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + (1.0 + (1.0 / (sqrt((1.0 + 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 = ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + (1.0d0 + (1.0d0 / (sqrt((1.0d0 + 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 ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + (1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + (1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + (1.0 + (1.0 / (sqrt((1.0 + 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[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)
\end{array}
Initial program 94.1%
associate-+l+94.1%
associate-+l-73.8%
+-commutative73.8%
sub-neg73.8%
sub-neg73.8%
+-commutative73.8%
+-commutative73.8%
Simplified73.8%
flip--73.8%
add-sqr-sqrt57.0%
add-sqr-sqrt74.1%
Applied egg-rr74.1%
associate--l+74.5%
+-inverses74.5%
metadata-eval74.5%
Simplified74.5%
flip--74.4%
add-sqr-sqrt60.6%
+-commutative60.6%
add-sqr-sqrt74.5%
+-commutative74.5%
Applied egg-rr74.5%
Taylor expanded in z around 0 75.5%
Taylor expanded in x around 0 58.2%
Final simplification58.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 5.5e+16)
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(- (+ 1.0 (sqrt (+ 1.0 y))) (sqrt y)))
(/ (+ x (- 1.0 x)) (+ (sqrt (+ x 1.0)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.5e+16) {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + sqrt((1.0 + y))) - sqrt(y));
} else {
tmp = (x + (1.0 - x)) / (sqrt((x + 1.0)) + 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) :: tmp
if (y <= 5.5d+16) then
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((1.0d0 + sqrt((1.0d0 + y))) - sqrt(y))
else
tmp = (x + (1.0d0 - x)) / (sqrt((x + 1.0d0)) + 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 tmp;
if (y <= 5.5e+16) {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((1.0 + Math.sqrt((1.0 + y))) - Math.sqrt(y));
} else {
tmp = (x + (1.0 - x)) / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5.5e+16: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((1.0 + math.sqrt((1.0 + y))) - math.sqrt(y)) else: tmp = (x + (1.0 - x)) / (math.sqrt((x + 1.0)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5.5e+16) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - sqrt(y))); else tmp = Float64(Float64(x + Float64(1.0 - x)) / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))); 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 <= 5.5e+16)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + sqrt((1.0 + y))) - sqrt(y));
else
tmp = (x + (1.0 - x)) / (sqrt((x + 1.0)) + 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_] := If[LessEqual[y, 5.5e+16], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{+16}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 - x\right)}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5.5e16Initial program 96.6%
associate-+l+96.6%
associate-+l-58.5%
+-commutative58.5%
sub-neg58.5%
sub-neg58.5%
+-commutative58.5%
+-commutative58.5%
Simplified58.5%
Taylor expanded in x around 0 55.2%
if 5.5e16 < y Initial program 91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+r-91.4%
associate-+l-57.7%
+-commutative57.7%
associate--l+57.7%
+-commutative57.7%
Simplified40.1%
Taylor expanded in t around inf 4.2%
associate--l+5.6%
+-commutative5.6%
+-commutative5.6%
Simplified5.6%
Taylor expanded in z around inf 5.3%
+-commutative5.3%
Simplified5.3%
Taylor expanded in y around inf 19.8%
flip--19.8%
add-sqr-sqrt20.2%
+-commutative20.2%
add-sqr-sqrt19.8%
+-commutative19.8%
Applied egg-rr19.8%
associate--l+19.8%
+-commutative19.8%
+-commutative19.8%
Simplified19.8%
Final simplification38.7%
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 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))) (+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (1.0 / (sqrt((1.0 + 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 = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (1.0d0 + (1.0d0 / (sqrt((1.0d0 + 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 ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (1.0 / (sqrt((1.0 + 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[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)
\end{array}
Initial program 94.1%
associate-+l+94.1%
associate-+l-73.8%
+-commutative73.8%
sub-neg73.8%
sub-neg73.8%
+-commutative73.8%
+-commutative73.8%
Simplified73.8%
flip--73.8%
add-sqr-sqrt57.0%
add-sqr-sqrt74.1%
Applied egg-rr74.1%
associate--l+74.5%
+-inverses74.5%
metadata-eval74.5%
Simplified74.5%
Taylor expanded in x around 0 57.8%
Final simplification57.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 (+ 1.0 z))))
(if (<= t 1.35e+18)
(- (+ 2.0 (+ t_1 (sqrt (+ 1.0 t)))) (+ (sqrt z) (sqrt t)))
(+
(sqrt (+ x 1.0))
(+ (- t_1 (sqrt z)) (- (- (sqrt (+ 1.0 y)) (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 + z));
double tmp;
if (t <= 1.35e+18) {
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(z) + sqrt(t));
} else {
tmp = sqrt((x + 1.0)) + ((t_1 - sqrt(z)) + ((sqrt((1.0 + y)) - 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) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 1.35d+18) then
tmp = (2.0d0 + (t_1 + sqrt((1.0d0 + t)))) - (sqrt(z) + sqrt(t))
else
tmp = sqrt((x + 1.0d0)) + ((t_1 - sqrt(z)) + ((sqrt((1.0d0 + y)) - 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 + z));
double tmp;
if (t <= 1.35e+18) {
tmp = (2.0 + (t_1 + Math.sqrt((1.0 + t)))) - (Math.sqrt(z) + Math.sqrt(t));
} else {
tmp = Math.sqrt((x + 1.0)) + ((t_1 - Math.sqrt(z)) + ((Math.sqrt((1.0 + y)) - 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 + z)) tmp = 0 if t <= 1.35e+18: tmp = (2.0 + (t_1 + math.sqrt((1.0 + t)))) - (math.sqrt(z) + math.sqrt(t)) else: tmp = math.sqrt((x + 1.0)) + ((t_1 - math.sqrt(z)) + ((math.sqrt((1.0 + y)) - 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 + z)) tmp = 0.0 if (t <= 1.35e+18) tmp = Float64(Float64(2.0 + Float64(t_1 + sqrt(Float64(1.0 + t)))) - Float64(sqrt(z) + sqrt(t))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(sqrt(Float64(1.0 + y)) - 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 + z));
tmp = 0.0;
if (t <= 1.35e+18)
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(z) + sqrt(t));
else
tmp = sqrt((x + 1.0)) + ((t_1 - sqrt(z)) + ((sqrt((1.0 + y)) - 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 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.35e+18], N[(N[(2.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $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 + z}\\
\mathbf{if}\;t \leq 1.35 \cdot 10^{+18}:\\
\;\;\;\;\left(2 + \left(t_1 + \sqrt{1 + t}\right)\right) - \left(\sqrt{z} + \sqrt{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(t_1 - \sqrt{z}\right) + \left(\left(\sqrt{1 + y} - \sqrt{x}\right) - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 1.35e18Initial program 96.3%
associate-+l+96.3%
sub-neg96.3%
associate-+l+77.1%
associate-+l+53.7%
+-commutative53.7%
neg-sub053.7%
associate-+l-53.7%
neg-sub053.7%
Simplified32.2%
Taylor expanded in y around 0 33.5%
Taylor expanded in x around 0 22.3%
if 1.35e18 < t Initial program 91.4%
associate-+l+91.4%
sub-neg91.4%
associate-+l+69.5%
associate-+l+56.0%
+-commutative56.0%
neg-sub056.0%
associate-+l-56.0%
neg-sub056.0%
Simplified19.8%
Taylor expanded in t around inf 55.5%
+-commutative55.5%
Simplified55.5%
Final simplification36.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 (+ 1.0 z))))
(if (<= t 1.9e+15)
(- (+ 2.0 (+ t_1 (sqrt (+ 1.0 t)))) (+ (sqrt z) (sqrt t)))
(+ (sqrt (+ x 1.0)) (+ (- t_1 (sqrt z)) (- (sqrt (+ 1.0 y)) (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 + z));
double tmp;
if (t <= 1.9e+15) {
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(z) + sqrt(t));
} else {
tmp = sqrt((x + 1.0)) + ((t_1 - sqrt(z)) + (sqrt((1.0 + y)) - 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) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 1.9d+15) then
tmp = (2.0d0 + (t_1 + sqrt((1.0d0 + t)))) - (sqrt(z) + sqrt(t))
else
tmp = sqrt((x + 1.0d0)) + ((t_1 - sqrt(z)) + (sqrt((1.0d0 + y)) - 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 + z));
double tmp;
if (t <= 1.9e+15) {
tmp = (2.0 + (t_1 + Math.sqrt((1.0 + t)))) - (Math.sqrt(z) + Math.sqrt(t));
} else {
tmp = Math.sqrt((x + 1.0)) + ((t_1 - Math.sqrt(z)) + (Math.sqrt((1.0 + y)) - 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 + z)) tmp = 0 if t <= 1.9e+15: tmp = (2.0 + (t_1 + math.sqrt((1.0 + t)))) - (math.sqrt(z) + math.sqrt(t)) else: tmp = math.sqrt((x + 1.0)) + ((t_1 - math.sqrt(z)) + (math.sqrt((1.0 + y)) - 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 + z)) tmp = 0.0 if (t <= 1.9e+15) tmp = Float64(Float64(2.0 + Float64(t_1 + sqrt(Float64(1.0 + t)))) - Float64(sqrt(z) + sqrt(t))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(t_1 - sqrt(z)) + Float64(sqrt(Float64(1.0 + y)) - 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 + z));
tmp = 0.0;
if (t <= 1.9e+15)
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(z) + sqrt(t));
else
tmp = sqrt((x + 1.0)) + ((t_1 - sqrt(z)) + (sqrt((1.0 + y)) - 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 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.9e+15], N[(N[(2.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $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 + z}\\
\mathbf{if}\;t \leq 1.9 \cdot 10^{+15}:\\
\;\;\;\;\left(2 + \left(t_1 + \sqrt{1 + t}\right)\right) - \left(\sqrt{z} + \sqrt{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(t_1 - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 1.9e15Initial program 97.0%
associate-+l+97.0%
sub-neg97.0%
associate-+l+77.4%
associate-+l+53.5%
+-commutative53.5%
neg-sub053.5%
associate-+l-53.5%
neg-sub053.5%
Simplified31.5%
Taylor expanded in y around 0 33.1%
Taylor expanded in x around 0 22.6%
if 1.9e15 < t Initial program 90.7%
associate-+l+90.7%
sub-neg90.7%
associate-+l+69.4%
associate-+l+56.2%
+-commutative56.2%
neg-sub056.2%
associate-+l-56.2%
neg-sub056.2%
Simplified21.0%
Taylor expanded in t around inf 55.7%
+-commutative55.7%
Simplified55.7%
Taylor expanded in x around 0 52.8%
Final simplification36.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))))
(if (<= z 4.8e+18)
(+ (+ t_1 (hypot 1.0 (sqrt z))) (- 1.0 (+ (sqrt y) (sqrt z))))
(+ (hypot 1.0 (sqrt x)) (- 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 tmp;
if (z <= 4.8e+18) {
tmp = (t_1 + hypot(1.0, sqrt(z))) + (1.0 - (sqrt(y) + sqrt(z)));
} else {
tmp = hypot(1.0, sqrt(x)) + (t_1 - (sqrt(x) + sqrt(y)));
}
return tmp;
}
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 tmp;
if (z <= 4.8e+18) {
tmp = (t_1 + Math.hypot(1.0, Math.sqrt(z))) + (1.0 - (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = Math.hypot(1.0, Math.sqrt(x)) + (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)) tmp = 0 if z <= 4.8e+18: tmp = (t_1 + math.hypot(1.0, math.sqrt(z))) + (1.0 - (math.sqrt(y) + math.sqrt(z))) else: tmp = math.hypot(1.0, math.sqrt(x)) + (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)) tmp = 0.0 if (z <= 4.8e+18) tmp = Float64(Float64(t_1 + hypot(1.0, sqrt(z))) + Float64(1.0 - Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(hypot(1.0, sqrt(x)) + 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));
tmp = 0.0;
if (z <= 4.8e+18)
tmp = (t_1 + hypot(1.0, sqrt(z))) + (1.0 - (sqrt(y) + sqrt(z)));
else
tmp = hypot(1.0, sqrt(x)) + (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]}, If[LessEqual[z, 4.8e+18], N[(N[(t$95$1 + N[Sqrt[1.0 ^ 2 + N[Sqrt[z], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[x], $MachinePrecision] ^ 2], $MachinePrecision] + 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}\\
\mathbf{if}\;z \leq 4.8 \cdot 10^{+18}:\\
\;\;\;\;\left(t_1 + \mathsf{hypot}\left(1, \sqrt{z}\right)\right) + \left(1 - \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(1, \sqrt{x}\right) + \left(t_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 4.8e18Initial program 96.2%
associate-+l+96.2%
sub-neg96.2%
associate-+l+75.9%
associate-+l+50.8%
+-commutative50.8%
neg-sub050.8%
associate-+l-50.8%
neg-sub050.8%
Simplified31.8%
Taylor expanded in t around inf 30.3%
+-commutative30.3%
Simplified30.3%
Taylor expanded in x around 0 33.5%
+-commutative33.5%
+-commutative33.5%
associate--l+33.4%
+-commutative33.4%
rem-square-sqrt33.4%
hypot-1-def33.4%
+-commutative33.4%
Simplified33.4%
if 4.8e18 < z Initial program 91.4%
associate-+l+91.4%
sub-neg91.4%
associate-+l+70.9%
associate-+l+60.0%
+-commutative60.0%
neg-sub060.0%
associate-+l-60.0%
neg-sub060.0%
Simplified19.9%
Taylor expanded in t around inf 34.4%
+-commutative34.4%
Simplified34.4%
Taylor expanded in z around inf 22.6%
+-commutative22.6%
+-commutative22.6%
associate--l+34.4%
rem-square-sqrt34.4%
hypot-1-def34.4%
+-commutative34.4%
Simplified34.4%
Final simplification33.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 (+ 1.0 y))))
(if (<= z 1.15e+16)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (sqrt z)))))
(+ (hypot 1.0 (sqrt x)) (- 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 tmp;
if (z <= 1.15e+16) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z))));
} else {
tmp = hypot(1.0, sqrt(x)) + (t_1 - (sqrt(x) + sqrt(y)));
}
return tmp;
}
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 tmp;
if (z <= 1.15e+16) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = Math.hypot(1.0, Math.sqrt(x)) + (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)) tmp = 0 if z <= 1.15e+16: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + math.sqrt(z)))) else: tmp = math.hypot(1.0, math.sqrt(x)) + (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)) tmp = 0.0 if (z <= 1.15e+16) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(hypot(1.0, sqrt(x)) + 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));
tmp = 0.0;
if (z <= 1.15e+16)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z))));
else
tmp = hypot(1.0, sqrt(x)) + (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]}, If[LessEqual[z, 1.15e+16], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[x], $MachinePrecision] ^ 2], $MachinePrecision] + 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}\\
\mathbf{if}\;z \leq 1.15 \cdot 10^{+16}:\\
\;\;\;\;1 + \left(t_1 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(1, \sqrt{x}\right) + \left(t_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1.15e16Initial program 96.8%
associate-+l+96.8%
+-commutative96.8%
associate-+r-76.1%
associate-+l-50.5%
+-commutative50.5%
associate--l+50.5%
+-commutative50.5%
Simplified49.5%
Taylor expanded in t around inf 17.2%
associate--l+21.6%
+-commutative21.6%
+-commutative21.6%
Simplified21.6%
Taylor expanded in x around 0 34.0%
associate--l+48.2%
associate--l+48.2%
+-commutative48.2%
Simplified48.2%
if 1.15e16 < z Initial program 90.7%
associate-+l+90.7%
sub-neg90.7%
associate-+l+70.8%
associate-+l+60.2%
+-commutative60.2%
neg-sub060.2%
associate-+l-60.2%
neg-sub060.2%
Simplified20.6%
Taylor expanded in t around inf 34.4%
+-commutative34.4%
Simplified34.4%
Taylor expanded in z around inf 22.2%
+-commutative22.2%
+-commutative22.2%
associate--l+34.4%
rem-square-sqrt34.4%
hypot-1-def34.4%
+-commutative34.4%
Simplified34.4%
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
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 5e+15)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (sqrt z)))))
(+ (sqrt (+ x 1.0)) (- 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 tmp;
if (z <= 5e+15) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z))));
} else {
tmp = sqrt((x + 1.0)) + (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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 5d+15) then
tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (sqrt(y) + sqrt(z))))
else
tmp = sqrt((x + 1.0d0)) + (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 tmp;
if (z <= 5e+15) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = Math.sqrt((x + 1.0)) + (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)) tmp = 0 if z <= 5e+15: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + math.sqrt(z)))) else: tmp = math.sqrt((x + 1.0)) + (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)) tmp = 0.0 if (z <= 5e+15) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(sqrt(Float64(x + 1.0)) + 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));
tmp = 0.0;
if (z <= 5e+15)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z))));
else
tmp = sqrt((x + 1.0)) + (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]}, If[LessEqual[z, 5e+15], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + 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}\\
\mathbf{if}\;z \leq 5 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(t_1 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(t_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 5e15Initial program 96.8%
associate-+l+96.8%
+-commutative96.8%
associate-+r-76.1%
associate-+l-50.5%
+-commutative50.5%
associate--l+50.5%
+-commutative50.5%
Simplified49.5%
Taylor expanded in t around inf 17.2%
associate--l+21.6%
+-commutative21.6%
+-commutative21.6%
Simplified21.6%
Taylor expanded in x around 0 34.0%
associate--l+48.2%
associate--l+48.2%
+-commutative48.2%
Simplified48.2%
if 5e15 < z Initial program 90.7%
associate-+l+90.7%
sub-neg90.7%
associate-+l+70.8%
associate-+l+60.2%
+-commutative60.2%
neg-sub060.2%
associate-+l-60.2%
neg-sub060.2%
Simplified20.6%
Taylor expanded in t around inf 34.4%
+-commutative34.4%
Simplified34.4%
Taylor expanded in z around inf 34.4%
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 (<= z 760000000000.0) (+ 2.0 (- (sqrt (+ 1.0 z)) (sqrt z))) (+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 760000000000.0) {
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
} else {
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (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) :: tmp
if (z <= 760000000000.0d0) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - sqrt(z))
else
tmp = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - (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 tmp;
if (z <= 760000000000.0) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
} else {
tmp = Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 760000000000.0: tmp = 2.0 + (math.sqrt((1.0 + z)) - math.sqrt(z)) else: tmp = math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 760000000000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - 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)
tmp = 0.0;
if (z <= 760000000000.0)
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
else
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (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_] := If[LessEqual[z, 760000000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - 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}
\mathbf{if}\;z \leq 760000000000:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 7.6e11Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
associate-+l+76.1%
associate-+l+50.5%
+-commutative50.5%
neg-sub050.5%
associate-+l-50.5%
neg-sub050.5%
Simplified31.5%
Taylor expanded in t around inf 30.2%
+-commutative30.2%
Simplified30.2%
Taylor expanded in y around 0 29.1%
associate-+r+29.1%
+-commutative29.1%
Simplified29.1%
Taylor expanded in x around 0 46.4%
associate--l+46.4%
Simplified46.4%
if 7.6e11 < z Initial program 90.7%
associate-+l+90.7%
sub-neg90.7%
associate-+l+70.8%
associate-+l+60.2%
+-commutative60.2%
neg-sub060.2%
associate-+l-60.2%
neg-sub060.2%
Simplified20.6%
Taylor expanded in t around inf 34.4%
+-commutative34.4%
Simplified34.4%
Taylor expanded in z around inf 34.4%
Final simplification41.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 (+ x 1.0)) (sqrt x)))) (if (<= y 1.2) (+ 1.0 t_1) t_1)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (y <= 1.2) {
tmp = 1.0 + t_1;
} else {
tmp = 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) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (y <= 1.2d0) then
tmp = 1.0d0 + t_1
else
tmp = 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 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (y <= 1.2) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if y <= 1.2: tmp = 1.0 + t_1 else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (y <= 1.2) tmp = Float64(1.0 + t_1); else tmp = 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 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (y <= 1.2)
tmp = 1.0 + t_1;
else
tmp = 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[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.2], N[(1.0 + t$95$1), $MachinePrecision], t$95$1]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;y \leq 1.2:\\
\;\;\;\;1 + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < 1.19999999999999996Initial program 97.3%
associate-+l+97.3%
+-commutative97.3%
associate-+r-58.3%
associate-+l-52.4%
+-commutative52.4%
associate--l+52.4%
+-commutative52.4%
Simplified35.6%
Taylor expanded in t around inf 18.0%
associate--l+39.0%
+-commutative39.0%
+-commutative39.0%
Simplified39.0%
Taylor expanded in z around inf 37.2%
+-commutative37.2%
Simplified37.2%
Taylor expanded in y around 0 21.6%
associate--l+36.6%
Simplified36.6%
if 1.19999999999999996 < y Initial program 90.9%
associate-+l+90.9%
+-commutative90.9%
associate-+r-89.7%
associate-+l-57.1%
+-commutative57.1%
associate--l+57.1%
+-commutative57.1%
Simplified38.9%
Taylor expanded in t around inf 4.8%
associate--l+6.5%
+-commutative6.5%
+-commutative6.5%
Simplified6.5%
Taylor expanded in z around inf 6.3%
+-commutative6.3%
Simplified6.3%
Taylor expanded in y around inf 19.7%
Final simplification28.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 (<= z 350000000000.0) (+ 2.0 (- (sqrt (+ 1.0 z)) (sqrt z))) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 350000000000.0) {
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - 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) :: tmp
if (z <= 350000000000.0d0) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - sqrt(z))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - 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 tmp;
if (z <= 350000000000.0) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 350000000000.0: tmp = 2.0 + (math.sqrt((1.0 + z)) - math.sqrt(z)) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 350000000000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); 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 (z <= 350000000000.0)
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
else
tmp = 1.0 + (sqrt((1.0 + y)) - 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_] := If[LessEqual[z, 350000000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 350000000000:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 3.5e11Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
associate-+l+76.1%
associate-+l+50.5%
+-commutative50.5%
neg-sub050.5%
associate-+l-50.5%
neg-sub050.5%
Simplified31.5%
Taylor expanded in t around inf 30.2%
+-commutative30.2%
Simplified30.2%
Taylor expanded in y around 0 29.1%
associate-+r+29.1%
+-commutative29.1%
Simplified29.1%
Taylor expanded in x around 0 46.4%
associate--l+46.4%
Simplified46.4%
if 3.5e11 < z Initial program 90.7%
associate-+l+90.7%
+-commutative90.7%
associate-+r-70.8%
associate-+l-60.2%
+-commutative60.2%
associate--l+60.2%
+-commutative60.2%
Simplified21.3%
Taylor expanded in t around inf 4.1%
associate--l+24.8%
+-commutative24.8%
+-commutative24.8%
Simplified24.8%
Taylor expanded in z around inf 35.1%
+-commutative35.1%
Simplified35.1%
Taylor expanded in x around 0 31.6%
associate--l+52.1%
Simplified52.1%
Final simplification48.9%
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 (+ 1.0 y)) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (sqrt((1.0 + 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 = 1.0d0 + (sqrt((1.0d0 + 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 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (sqrt((1.0 + 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[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \sqrt{y}\right)
\end{array}
Initial program 94.1%
associate-+l+94.1%
+-commutative94.1%
associate-+r-73.8%
associate-+l-54.7%
+-commutative54.7%
associate--l+54.7%
+-commutative54.7%
Simplified37.2%
Taylor expanded in t around inf 11.5%
associate--l+23.0%
+-commutative23.0%
+-commutative23.0%
Simplified23.0%
Taylor expanded in z around inf 22.0%
+-commutative22.0%
Simplified22.0%
Taylor expanded in x around 0 24.9%
associate--l+41.8%
Simplified41.8%
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 (- (sqrt (+ x 1.0)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) - 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((x + 1.0d0)) - 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((x + 1.0)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) - 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[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Initial program 94.1%
associate-+l+94.1%
+-commutative94.1%
associate-+r-73.8%
associate-+l-54.7%
+-commutative54.7%
associate--l+54.7%
+-commutative54.7%
Simplified37.2%
Taylor expanded in t around inf 11.5%
associate--l+23.0%
+-commutative23.0%
+-commutative23.0%
Simplified23.0%
Taylor expanded in z around inf 22.0%
+-commutative22.0%
Simplified22.0%
Taylor expanded in y around inf 14.9%
Final simplification14.9%
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 (* x 0.5)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 + (x * 0.5)) - 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 = (1.0d0 + (x * 0.5d0)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (1.0 + (x * 0.5)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 + (x * 0.5)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 + Float64(x * 0.5)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 + (x * 0.5)) - 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[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(1 + x \cdot 0.5\right) - \sqrt{x}
\end{array}
Initial program 94.1%
associate-+l+94.1%
+-commutative94.1%
associate-+r-73.8%
associate-+l-54.7%
+-commutative54.7%
associate--l+54.7%
+-commutative54.7%
Simplified37.2%
Taylor expanded in t around inf 11.5%
associate--l+23.0%
+-commutative23.0%
+-commutative23.0%
Simplified23.0%
Taylor expanded in z around inf 22.0%
+-commutative22.0%
Simplified22.0%
Taylor expanded in y around inf 14.9%
Taylor expanded in x around 0 15.8%
Final simplification15.8%
(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 2023200
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:herbie-target
(+ (+ (+ (/ 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)))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))