
(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 16 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
(+
(exp
(log
(-
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))
(/ -1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ 1.0 z)) (sqrt z)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return exp(log(((1.0 / (sqrt(x) + sqrt((1.0 + x)))) - (-1.0 / (sqrt((1.0 + y)) + sqrt(y)))))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
}
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 = exp(log(((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) - ((-1.0d0) / (sqrt((1.0d0 + y)) + sqrt(y)))))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - sqrt(z)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.exp(Math.log(((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) - (-1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.exp(math.log(((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) - (-1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(exp(log(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) - Float64(-1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = exp(log(((1.0 / (sqrt(x) + sqrt((1.0 + x)))) - (-1.0 / (sqrt((1.0 + y)) + sqrt(y)))))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Exp[N[Log[N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
e^{\log \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} - \frac{-1}{\sqrt{1 + y} + \sqrt{y}}\right)} + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)
\end{array}
Initial program 93.1%
associate-+l+93.1%
associate-+l-76.5%
+-commutative76.5%
sub-neg76.5%
sub-neg76.5%
+-commutative76.5%
+-commutative76.5%
Simplified76.5%
flip--76.6%
add-sqr-sqrt58.6%
add-sqr-sqrt76.7%
Applied egg-rr76.7%
associate--l+77.0%
+-inverses77.0%
metadata-eval77.0%
Simplified77.0%
add-exp-log77.0%
associate--r-93.9%
Applied egg-rr93.9%
flip--94.0%
add-sqr-sqrt76.5%
+-commutative76.5%
add-sqr-sqrt94.2%
+-commutative94.2%
Applied egg-rr94.2%
associate--l+95.9%
+-inverses95.9%
metadata-eval95.9%
Simplified95.9%
Final simplification95.9%
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)) (- (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (sqrt x))) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
}
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)) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) - sqrt(x))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))
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)) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) - Math.sqrt(x))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (math.sqrt((1.0 + x)) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) - math.sqrt(x))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) - sqrt(x))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
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[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\sqrt{1 + x} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} - \sqrt{x}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)
\end{array}
Initial program 93.1%
associate-+l+93.1%
associate-+l-76.5%
+-commutative76.5%
sub-neg76.5%
sub-neg76.5%
+-commutative76.5%
+-commutative76.5%
Simplified76.5%
flip--76.7%
add-sqr-sqrt61.2%
+-commutative61.2%
add-sqr-sqrt76.7%
+-commutative76.7%
Applied egg-rr76.7%
associate--l+76.7%
Applied egg-rr76.7%
associate-+r-76.7%
+-commutative76.7%
associate--l+77.9%
Simplified77.9%
flip--76.6%
add-sqr-sqrt58.6%
add-sqr-sqrt76.7%
Applied egg-rr78.1%
associate--l+77.0%
+-inverses77.0%
metadata-eval77.0%
Simplified78.4%
div-inv78.4%
+-inverses78.4%
metadata-eval78.4%
+-commutative78.4%
+-commutative78.4%
Applied egg-rr78.4%
*-lft-identity78.4%
+-commutative78.4%
Simplified78.4%
Final simplification78.4%
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)) (- (sqrt (+ 1.0 z)) (sqrt z))) (+ (sqrt (+ 1.0 x)) (- (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z))) + (sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - 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 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - sqrt(z))) + (sqrt((1.0d0 + x)) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) - 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 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z))) + (Math.sqrt((1.0 + x)) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) - Math.sqrt(x)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) + (math.sqrt((1.0 + x)) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) - math.sqrt(x)))
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(sqrt(Float64(1.0 + z)) - sqrt(z))) + Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) - sqrt(x)))) 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)) + (sqrt((1.0 + z)) - sqrt(z))) + (sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - 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[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $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) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(\sqrt{1 + x} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} - \sqrt{x}\right)\right)
\end{array}
Initial program 93.1%
associate-+l+93.1%
associate-+l-76.5%
+-commutative76.5%
sub-neg76.5%
sub-neg76.5%
+-commutative76.5%
+-commutative76.5%
Simplified76.5%
flip--76.6%
add-sqr-sqrt58.6%
add-sqr-sqrt76.7%
Applied egg-rr76.7%
associate--l+77.0%
+-inverses77.0%
metadata-eval77.0%
Simplified77.0%
Final simplification77.0%
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))) (t_2 (sqrt (+ 1.0 y))))
(if (<= y 1.1e-5)
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ (+ 1.0 (- z z)) (+ t_1 (sqrt z))))
(+ 1.0 (- t_2 (sqrt y))))
(+
(sqrt (+ 1.0 x))
(+ (/ 1.0 (+ t_2 (sqrt y))) (- (- t_1 (sqrt z)) (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 + z));
double t_2 = sqrt((1.0 + y));
double tmp;
if (y <= 1.1e-5) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + ((1.0 + (z - z)) / (t_1 + sqrt(z)))) + (1.0 + (t_2 - sqrt(y)));
} else {
tmp = sqrt((1.0 + x)) + ((1.0 / (t_2 + sqrt(y))) + ((t_1 - sqrt(z)) - 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) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + y))
if (y <= 1.1d-5) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + ((1.0d0 + (z - z)) / (t_1 + sqrt(z)))) + (1.0d0 + (t_2 - sqrt(y)))
else
tmp = sqrt((1.0d0 + x)) + ((1.0d0 / (t_2 + sqrt(y))) + ((t_1 - sqrt(z)) - 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 + z));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (y <= 1.1e-5) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((1.0 + (z - z)) / (t_1 + Math.sqrt(z)))) + (1.0 + (t_2 - Math.sqrt(y)));
} else {
tmp = Math.sqrt((1.0 + x)) + ((1.0 / (t_2 + Math.sqrt(y))) + ((t_1 - Math.sqrt(z)) - 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 + z)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if y <= 1.1e-5: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + ((1.0 + (z - z)) / (t_1 + math.sqrt(z)))) + (1.0 + (t_2 - math.sqrt(y))) else: tmp = math.sqrt((1.0 + x)) + ((1.0 / (t_2 + math.sqrt(y))) + ((t_1 - math.sqrt(z)) - 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 + z)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (y <= 1.1e-5) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(1.0 + Float64(z - z)) / Float64(t_1 + sqrt(z)))) + Float64(1.0 + Float64(t_2 - sqrt(y)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(Float64(t_1 - sqrt(z)) - 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 + z));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (y <= 1.1e-5)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + ((1.0 + (z - z)) / (t_1 + sqrt(z)))) + (1.0 + (t_2 - sqrt(y)));
else
tmp = sqrt((1.0 + x)) + ((1.0 / (t_2 + sqrt(y))) + ((t_1 - sqrt(z)) - 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 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.1e-5], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(z - z), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $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}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;y \leq 1.1 \cdot 10^{-5}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1 + \left(z - z\right)}{t_1 + \sqrt{z}}\right) + \left(1 + \left(t_2 - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\frac{1}{t_2 + \sqrt{y}} + \left(\left(t_1 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if y < 1.1e-5Initial program 97.9%
associate-+l+97.9%
associate-+l-65.1%
+-commutative65.1%
sub-neg65.1%
sub-neg65.1%
+-commutative65.1%
+-commutative65.1%
Simplified65.1%
flip--65.4%
add-sqr-sqrt51.1%
+-commutative51.1%
add-sqr-sqrt65.4%
+-commutative65.4%
Applied egg-rr65.4%
associate--l+65.4%
Applied egg-rr65.4%
associate-+r-65.4%
+-commutative65.4%
associate--l+65.7%
Simplified65.7%
Taylor expanded in x around 0 64.2%
associate--l+64.2%
Simplified64.2%
if 1.1e-5 < y Initial program 88.4%
associate-+l+88.4%
+-commutative88.4%
associate-+r-87.9%
associate-+l-55.9%
+-commutative55.9%
associate--l+55.9%
+-commutative55.9%
Simplified37.8%
Taylor expanded in t around inf 33.1%
+-commutative33.1%
+-commutative33.1%
associate--l+34.2%
Simplified34.2%
flip--88.1%
add-sqr-sqrt52.1%
add-sqr-sqrt88.3%
Applied egg-rr34.5%
associate--l+88.9%
+-inverses88.9%
metadata-eval88.9%
Simplified34.8%
Final simplification49.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 z))) (t_2 (sqrt (+ 1.0 y))))
(if (<= y 1.05e-5)
(+
(- (+ 1.0 t_2) (sqrt y))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ (+ 1.0 (- z z)) (+ t_1 (sqrt z)))))
(+
(sqrt (+ 1.0 x))
(+ (/ 1.0 (+ t_2 (sqrt y))) (- (- t_1 (sqrt z)) (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 + z));
double t_2 = sqrt((1.0 + y));
double tmp;
if (y <= 1.05e-5) {
tmp = ((1.0 + t_2) - sqrt(y)) + ((sqrt((1.0 + t)) - sqrt(t)) + ((1.0 + (z - z)) / (t_1 + sqrt(z))));
} else {
tmp = sqrt((1.0 + x)) + ((1.0 / (t_2 + sqrt(y))) + ((t_1 - sqrt(z)) - 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) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + y))
if (y <= 1.05d-5) then
tmp = ((1.0d0 + t_2) - sqrt(y)) + ((sqrt((1.0d0 + t)) - sqrt(t)) + ((1.0d0 + (z - z)) / (t_1 + sqrt(z))))
else
tmp = sqrt((1.0d0 + x)) + ((1.0d0 / (t_2 + sqrt(y))) + ((t_1 - sqrt(z)) - 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 + z));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (y <= 1.05e-5) {
tmp = ((1.0 + t_2) - Math.sqrt(y)) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((1.0 + (z - z)) / (t_1 + Math.sqrt(z))));
} else {
tmp = Math.sqrt((1.0 + x)) + ((1.0 / (t_2 + Math.sqrt(y))) + ((t_1 - Math.sqrt(z)) - 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 + z)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if y <= 1.05e-5: tmp = ((1.0 + t_2) - math.sqrt(y)) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + ((1.0 + (z - z)) / (t_1 + math.sqrt(z)))) else: tmp = math.sqrt((1.0 + x)) + ((1.0 / (t_2 + math.sqrt(y))) + ((t_1 - math.sqrt(z)) - 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 + z)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (y <= 1.05e-5) tmp = Float64(Float64(Float64(1.0 + t_2) - sqrt(y)) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(1.0 + Float64(z - z)) / Float64(t_1 + sqrt(z))))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(Float64(t_1 - sqrt(z)) - 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 + z));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (y <= 1.05e-5)
tmp = ((1.0 + t_2) - sqrt(y)) + ((sqrt((1.0 + t)) - sqrt(t)) + ((1.0 + (z - z)) / (t_1 + sqrt(z))));
else
tmp = sqrt((1.0 + x)) + ((1.0 / (t_2 + sqrt(y))) + ((t_1 - sqrt(z)) - 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 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.05e-5], N[(N[(N[(1.0 + t$95$2), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(z - z), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $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}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;y \leq 1.05 \cdot 10^{-5}:\\
\;\;\;\;\left(\left(1 + t_2\right) - \sqrt{y}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1 + \left(z - z\right)}{t_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\frac{1}{t_2 + \sqrt{y}} + \left(\left(t_1 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if y < 1.04999999999999994e-5Initial program 97.9%
associate-+l+97.9%
associate-+l-65.1%
+-commutative65.1%
sub-neg65.1%
sub-neg65.1%
+-commutative65.1%
+-commutative65.1%
Simplified65.1%
flip--65.4%
add-sqr-sqrt51.1%
+-commutative51.1%
add-sqr-sqrt65.4%
+-commutative65.4%
Applied egg-rr65.4%
associate--l+65.4%
Applied egg-rr65.4%
associate-+r-65.4%
+-commutative65.4%
associate--l+65.7%
Simplified65.7%
Taylor expanded in x around 0 64.2%
if 1.04999999999999994e-5 < y Initial program 88.4%
associate-+l+88.4%
+-commutative88.4%
associate-+r-87.9%
associate-+l-55.9%
+-commutative55.9%
associate--l+55.9%
+-commutative55.9%
Simplified37.8%
Taylor expanded in t around inf 33.1%
+-commutative33.1%
+-commutative33.1%
associate--l+34.2%
Simplified34.2%
flip--88.1%
add-sqr-sqrt52.1%
add-sqr-sqrt88.3%
Applied egg-rr34.5%
associate--l+88.9%
+-inverses88.9%
metadata-eval88.9%
Simplified34.8%
Final simplification49.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 z))))
(if (<= y 1.1e-66)
(+
2.0
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ (- (+ 1.0 z) z) (+ t_1 (sqrt z)))))
(+
(sqrt (+ 1.0 x))
(+
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))
(- (- t_1 (sqrt z)) (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 + z));
double tmp;
if (y <= 1.1e-66) {
tmp = 2.0 + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (t_1 + sqrt(z))));
} else {
tmp = sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + ((t_1 - sqrt(z)) - 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 + z))
if (y <= 1.1d-66) then
tmp = 2.0d0 + ((sqrt((1.0d0 + t)) - sqrt(t)) + (((1.0d0 + z) - z) / (t_1 + sqrt(z))))
else
tmp = sqrt((1.0d0 + x)) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + ((t_1 - sqrt(z)) - 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 + z));
double tmp;
if (y <= 1.1e-66) {
tmp = 2.0 + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + z) - z) / (t_1 + Math.sqrt(z))));
} else {
tmp = Math.sqrt((1.0 + x)) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + ((t_1 - Math.sqrt(z)) - 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 + z)) tmp = 0 if y <= 1.1e-66: tmp = 2.0 + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + z) - z) / (t_1 + math.sqrt(z)))) else: tmp = math.sqrt((1.0 + x)) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + ((t_1 - math.sqrt(z)) - 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 + z)) tmp = 0.0 if (y <= 1.1e-66) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + z) - z) / Float64(t_1 + sqrt(z))))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(Float64(t_1 - sqrt(z)) - 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 + z));
tmp = 0.0;
if (y <= 1.1e-66)
tmp = 2.0 + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (t_1 + sqrt(z))));
else
tmp = sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + ((t_1 - sqrt(z)) - 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 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.1e-66], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + z), $MachinePrecision] - z), $MachinePrecision] / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $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}\;y \leq 1.1 \cdot 10^{-66}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{\left(1 + z\right) - z}{t_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\left(t_1 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if y < 1.1000000000000001e-66Initial program 97.9%
associate-+l+97.9%
associate-+l-63.3%
+-commutative63.3%
sub-neg63.3%
sub-neg63.3%
+-commutative63.3%
+-commutative63.3%
Simplified63.3%
flip--63.6%
add-sqr-sqrt47.8%
+-commutative47.8%
add-sqr-sqrt63.6%
+-commutative63.6%
Applied egg-rr63.6%
Taylor expanded in x around 0 62.2%
Taylor expanded in y around 0 62.2%
if 1.1000000000000001e-66 < y Initial program 90.1%
associate-+l+90.1%
+-commutative90.1%
associate-+r-85.0%
associate-+l-58.0%
+-commutative58.0%
associate--l+58.0%
+-commutative58.0%
Simplified39.9%
Taylor expanded in t around inf 34.2%
+-commutative34.2%
+-commutative34.2%
associate--l+35.5%
Simplified35.5%
flip--85.2%
add-sqr-sqrt55.6%
add-sqr-sqrt85.3%
Applied egg-rr35.7%
associate--l+85.8%
+-inverses85.8%
metadata-eval85.8%
Simplified36.0%
Final simplification46.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 9e+15)
(+
2.0
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(/ (- (+ 1.0 z) z) (+ (sqrt (+ 1.0 z)) (sqrt z)))))
(+ (sqrt (+ 1.0 x)) (- (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 9e+15) {
tmp = 2.0 + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (sqrt((1.0 + z)) + sqrt(z))));
} else {
tmp = sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - 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 (z <= 9d+15) then
tmp = 2.0d0 + ((sqrt((1.0d0 + t)) - sqrt(t)) + (((1.0d0 + z) - z) / (sqrt((1.0d0 + z)) + sqrt(z))))
else
tmp = sqrt((1.0d0 + x)) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) - 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 (z <= 9e+15) {
tmp = 2.0 + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + z) - z) / (Math.sqrt((1.0 + z)) + Math.sqrt(z))));
} else {
tmp = Math.sqrt((1.0 + x)) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 9e+15: tmp = 2.0 + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + z) - z) / (math.sqrt((1.0 + z)) + math.sqrt(z)))) else: tmp = math.sqrt((1.0 + x)) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 9e+15) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + z) - z) / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) - 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 (z <= 9e+15)
tmp = 2.0 + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (sqrt((1.0 + z)) + sqrt(z))));
else
tmp = sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - 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[z, 9e+15], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + z), $MachinePrecision] - z), $MachinePrecision] / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $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}\;z \leq 9 \cdot 10^{+15}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{\left(1 + z\right) - z}{\sqrt{1 + z} + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 9e15Initial program 97.2%
associate-+l+97.2%
associate-+l-77.3%
+-commutative77.3%
sub-neg77.3%
sub-neg77.3%
+-commutative77.3%
+-commutative77.3%
Simplified77.3%
flip--77.7%
add-sqr-sqrt77.5%
+-commutative77.5%
add-sqr-sqrt77.7%
+-commutative77.7%
Applied egg-rr77.7%
Taylor expanded in x around 0 56.9%
Taylor expanded in y around 0 39.9%
if 9e15 < z Initial program 88.4%
associate-+l+88.4%
+-commutative88.4%
associate-+r-75.6%
associate-+l-59.7%
+-commutative59.7%
associate--l+59.7%
+-commutative59.7%
Simplified24.9%
Taylor expanded in t around inf 32.9%
+-commutative32.9%
+-commutative32.9%
associate--l+34.7%
Simplified34.7%
Taylor expanded in z around inf 34.7%
flip--75.6%
add-sqr-sqrt60.3%
add-sqr-sqrt75.8%
Applied egg-rr34.7%
associate--l+76.1%
+-inverses76.1%
metadata-eval76.1%
Simplified34.8%
Final simplification37.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 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(if (<= z 5.8e-26)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 2e+15)
(+ t_1 (- (+ 1.0 (sqrt (+ 1.0 z))) (sqrt z)))
(+ (sqrt (+ 1.0 x)) (- t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
double tmp;
if (z <= 5.8e-26) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 2e+15) {
tmp = t_1 + ((1.0 + sqrt((1.0 + z))) - sqrt(z));
} else {
tmp = sqrt((1.0 + x)) + (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 = 1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))
if (z <= 5.8d-26) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 2d+15) then
tmp = t_1 + ((1.0d0 + sqrt((1.0d0 + z))) - sqrt(z))
else
tmp = sqrt((1.0d0 + x)) + (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 = 1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y));
double tmp;
if (z <= 5.8e-26) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 2e+15) {
tmp = t_1 + ((1.0 + Math.sqrt((1.0 + z))) - Math.sqrt(z));
} else {
tmp = Math.sqrt((1.0 + x)) + (t_1 - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)) tmp = 0 if z <= 5.8e-26: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 2e+15: tmp = t_1 + ((1.0 + math.sqrt((1.0 + z))) - math.sqrt(z)) else: tmp = math.sqrt((1.0 + x)) + (t_1 - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) tmp = 0.0 if (z <= 5.8e-26) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 2e+15) tmp = Float64(t_1 + Float64(Float64(1.0 + sqrt(Float64(1.0 + z))) - sqrt(z))); else tmp = Float64(sqrt(Float64(1.0 + x)) + 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 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
tmp = 0.0;
if (z <= 5.8e-26)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 2e+15)
tmp = t_1 + ((1.0 + sqrt((1.0 + z))) - sqrt(z));
else
tmp = sqrt((1.0 + x)) + (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[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 5.8e-26], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 2e+15], N[(t$95$1 + N[(N[(1.0 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\mathbf{if}\;z \leq 5.8 \cdot 10^{-26}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+15}:\\
\;\;\;\;t_1 + \left(\left(1 + \sqrt{1 + z}\right) - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(t_1 - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 5.7999999999999996e-26Initial program 97.9%
associate-+l+97.9%
+-commutative97.9%
associate-+r-76.4%
associate-+l-55.3%
+-commutative55.3%
associate--l+55.3%
+-commutative55.3%
Simplified55.1%
Taylor expanded in z around 0 18.5%
+-commutative18.5%
associate--l+39.4%
associate-+r+39.4%
Simplified39.4%
Taylor expanded in y around 0 19.6%
+-commutative19.6%
+-commutative19.6%
associate-+r+19.6%
+-commutative19.6%
Simplified19.6%
Taylor expanded in x around 0 22.7%
associate--l+40.5%
Simplified40.5%
if 5.7999999999999996e-26 < z < 2e15Initial program 92.3%
associate-+l+92.3%
associate-+l-83.0%
+-commutative83.0%
sub-neg83.0%
sub-neg83.0%
+-commutative83.0%
+-commutative83.0%
Simplified83.0%
flip--83.6%
add-sqr-sqrt57.3%
add-sqr-sqrt83.6%
Applied egg-rr83.6%
associate--l+84.4%
+-inverses84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in x around inf 47.4%
Taylor expanded in t around 0 56.3%
if 2e15 < z Initial program 88.4%
associate-+l+88.4%
+-commutative88.4%
associate-+r-75.6%
associate-+l-59.7%
+-commutative59.7%
associate--l+59.7%
+-commutative59.7%
Simplified24.9%
Taylor expanded in t around inf 32.9%
+-commutative32.9%
+-commutative32.9%
associate--l+34.7%
Simplified34.7%
Taylor expanded in z around inf 34.7%
flip--75.6%
add-sqr-sqrt60.3%
add-sqr-sqrt75.8%
Applied egg-rr34.7%
associate--l+76.1%
+-inverses76.1%
metadata-eval76.1%
Simplified34.8%
Final simplification39.0%
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 1.75e-25)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 1.65e+15)
(+ 1.0 (+ (sqrt (+ 1.0 z)) (- t_1 (+ (sqrt x) (sqrt z)))))
(+ t_1 (- (- (sqrt (+ 1.0 y)) (sqrt y)) (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 <= 1.75e-25) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 1.65e+15) {
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (sqrt(x) + sqrt(z))));
} else {
tmp = t_1 + ((sqrt((1.0 + y)) - sqrt(y)) - 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 <= 1.75d-25) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 1.65d+15) then
tmp = 1.0d0 + (sqrt((1.0d0 + z)) + (t_1 - (sqrt(x) + sqrt(z))))
else
tmp = t_1 + ((sqrt((1.0d0 + y)) - sqrt(y)) - 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 <= 1.75e-25) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 1.65e+15) {
tmp = 1.0 + (Math.sqrt((1.0 + z)) + (t_1 - (Math.sqrt(x) + Math.sqrt(z))));
} else {
tmp = t_1 + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) - 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 <= 1.75e-25: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 1.65e+15: tmp = 1.0 + (math.sqrt((1.0 + z)) + (t_1 - (math.sqrt(x) + math.sqrt(z)))) else: tmp = t_1 + ((math.sqrt((1.0 + y)) - math.sqrt(y)) - 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 <= 1.75e-25) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 1.65e+15) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) + Float64(t_1 - Float64(sqrt(x) + sqrt(z))))); else tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) - 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 <= 1.75e-25)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 1.65e+15)
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (sqrt(x) + sqrt(z))));
else
tmp = t_1 + ((sqrt((1.0 + y)) - sqrt(y)) - 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, 1.75e-25], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 1.65e+15], N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $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 1.75 \cdot 10^{-25}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(\sqrt{1 + z} + \left(t_1 - \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 1.7500000000000001e-25Initial program 97.9%
associate-+l+97.9%
+-commutative97.9%
associate-+r-76.4%
associate-+l-55.3%
+-commutative55.3%
associate--l+55.3%
+-commutative55.3%
Simplified55.1%
Taylor expanded in z around 0 18.5%
+-commutative18.5%
associate--l+39.4%
associate-+r+39.4%
Simplified39.4%
Taylor expanded in y around 0 19.6%
+-commutative19.6%
+-commutative19.6%
associate-+r+19.6%
+-commutative19.6%
Simplified19.6%
Taylor expanded in x around 0 22.7%
associate--l+40.5%
Simplified40.5%
if 1.7500000000000001e-25 < z < 1.65e15Initial program 92.3%
associate-+l+92.3%
+-commutative92.3%
associate-+r-83.0%
associate-+l-61.2%
+-commutative61.2%
associate--l+61.2%
+-commutative61.2%
Simplified39.5%
Taylor expanded in t around inf 43.6%
+-commutative43.6%
+-commutative43.6%
associate--l+43.6%
Simplified43.6%
Taylor expanded in y around 0 28.6%
associate--l+38.2%
associate--l+36.3%
+-commutative36.3%
Simplified36.3%
if 1.65e15 < z Initial program 88.4%
associate-+l+88.4%
+-commutative88.4%
associate-+r-75.6%
associate-+l-59.7%
+-commutative59.7%
associate--l+59.7%
+-commutative59.7%
Simplified24.9%
Taylor expanded in t around inf 32.9%
+-commutative32.9%
+-commutative32.9%
associate--l+34.7%
Simplified34.7%
Taylor expanded in z around inf 34.7%
Final simplification37.6%
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 8.4e-26)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 1.65e+15)
(+ 1.0 (+ (sqrt (+ 1.0 z)) (- t_1 (+ (sqrt x) (sqrt z)))))
(+ t_1 (- (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (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 <= 8.4e-26) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 1.65e+15) {
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (sqrt(x) + sqrt(z))));
} else {
tmp = t_1 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - 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 <= 8.4d-26) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 1.65d+15) then
tmp = 1.0d0 + (sqrt((1.0d0 + z)) + (t_1 - (sqrt(x) + sqrt(z))))
else
tmp = t_1 + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) - 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 <= 8.4e-26) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 1.65e+15) {
tmp = 1.0 + (Math.sqrt((1.0 + z)) + (t_1 - (Math.sqrt(x) + Math.sqrt(z))));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) - 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 <= 8.4e-26: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 1.65e+15: tmp = 1.0 + (math.sqrt((1.0 + z)) + (t_1 - (math.sqrt(x) + math.sqrt(z)))) else: tmp = t_1 + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) - 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 <= 8.4e-26) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 1.65e+15) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) + Float64(t_1 - Float64(sqrt(x) + sqrt(z))))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) - 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 <= 8.4e-26)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 1.65e+15)
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (sqrt(x) + sqrt(z))));
else
tmp = t_1 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - 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, 8.4e-26], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 1.65e+15], N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $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 8.4 \cdot 10^{-26}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(\sqrt{1 + z} + \left(t_1 - \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 8.40000000000000032e-26Initial program 97.9%
associate-+l+97.9%
+-commutative97.9%
associate-+r-76.4%
associate-+l-55.3%
+-commutative55.3%
associate--l+55.3%
+-commutative55.3%
Simplified55.1%
Taylor expanded in z around 0 18.5%
+-commutative18.5%
associate--l+39.4%
associate-+r+39.4%
Simplified39.4%
Taylor expanded in y around 0 19.6%
+-commutative19.6%
+-commutative19.6%
associate-+r+19.6%
+-commutative19.6%
Simplified19.6%
Taylor expanded in x around 0 22.7%
associate--l+40.5%
Simplified40.5%
if 8.40000000000000032e-26 < z < 1.65e15Initial program 92.3%
associate-+l+92.3%
+-commutative92.3%
associate-+r-83.0%
associate-+l-61.2%
+-commutative61.2%
associate--l+61.2%
+-commutative61.2%
Simplified39.5%
Taylor expanded in t around inf 43.6%
+-commutative43.6%
+-commutative43.6%
associate--l+43.6%
Simplified43.6%
Taylor expanded in y around 0 28.6%
associate--l+38.2%
associate--l+36.3%
+-commutative36.3%
Simplified36.3%
if 1.65e15 < z Initial program 88.4%
associate-+l+88.4%
+-commutative88.4%
associate-+r-75.6%
associate-+l-59.7%
+-commutative59.7%
associate--l+59.7%
+-commutative59.7%
Simplified24.9%
Taylor expanded in t around inf 32.9%
+-commutative32.9%
+-commutative32.9%
associate--l+34.7%
Simplified34.7%
Taylor expanded in z around inf 34.7%
flip--75.6%
add-sqr-sqrt60.3%
add-sqr-sqrt75.8%
Applied egg-rr34.7%
associate--l+76.1%
+-inverses76.1%
metadata-eval76.1%
Simplified34.8%
Final simplification37.6%
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.6e-24)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 1.85e+15)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (+ (sqrt y) (sqrt z)))
(+ (sqrt (+ 1.0 x)) (- (/ 1.0 (+ t_1 (sqrt y))) (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 + y));
double tmp;
if (z <= 1.6e-24) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 1.85e+15) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
} else {
tmp = sqrt((1.0 + x)) + ((1.0 / (t_1 + sqrt(y))) - 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 + y))
if (z <= 1.6d-24) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 1.85d+15) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - (sqrt(y) + sqrt(z))
else
tmp = sqrt((1.0d0 + x)) + ((1.0d0 / (t_1 + sqrt(y))) - 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 + y));
double tmp;
if (z <= 1.6e-24) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 1.85e+15) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = Math.sqrt((1.0 + x)) + ((1.0 / (t_1 + Math.sqrt(y))) - 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 + y)) tmp = 0 if z <= 1.6e-24: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 1.85e+15: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - (math.sqrt(y) + math.sqrt(z)) else: tmp = math.sqrt((1.0 + x)) + ((1.0 / (t_1 + math.sqrt(y))) - 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 + y)) tmp = 0.0 if (z <= 1.6e-24) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 1.85e+15) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) - 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 + y));
tmp = 0.0;
if (z <= 1.6e-24)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 1.85e+15)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
else
tmp = sqrt((1.0 + x)) + ((1.0 / (t_1 + sqrt(y))) - 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 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.6e-24], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 1.85e+15], N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $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.6 \cdot 10^{-24}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(t_1 + \sqrt{1 + z}\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\frac{1}{t_1 + \sqrt{y}} - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 1.60000000000000006e-24Initial program 97.9%
associate-+l+97.9%
+-commutative97.9%
associate-+r-76.4%
associate-+l-55.3%
+-commutative55.3%
associate--l+55.3%
+-commutative55.3%
Simplified55.1%
Taylor expanded in z around 0 18.5%
+-commutative18.5%
associate--l+39.4%
associate-+r+39.4%
Simplified39.4%
Taylor expanded in y around 0 19.6%
+-commutative19.6%
+-commutative19.6%
associate-+r+19.6%
+-commutative19.6%
Simplified19.6%
Taylor expanded in x around 0 22.7%
associate--l+40.5%
Simplified40.5%
if 1.60000000000000006e-24 < z < 1.85e15Initial program 92.3%
associate-+l+92.3%
+-commutative92.3%
associate-+r-83.0%
associate-+l-61.2%
+-commutative61.2%
associate--l+61.2%
+-commutative61.2%
Simplified39.5%
Taylor expanded in t around inf 43.6%
+-commutative43.6%
+-commutative43.6%
associate--l+43.6%
Simplified43.6%
Taylor expanded in x around 0 26.3%
if 1.85e15 < z Initial program 88.4%
associate-+l+88.4%
+-commutative88.4%
associate-+r-75.6%
associate-+l-59.7%
+-commutative59.7%
associate--l+59.7%
+-commutative59.7%
Simplified24.9%
Taylor expanded in t around inf 32.9%
+-commutative32.9%
+-commutative32.9%
associate--l+34.7%
Simplified34.7%
Taylor expanded in z around inf 34.7%
flip--75.6%
add-sqr-sqrt60.3%
add-sqr-sqrt75.8%
Applied egg-rr34.7%
associate--l+76.1%
+-inverses76.1%
metadata-eval76.1%
Simplified34.8%
Final simplification36.9%
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 0.68) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0) (+ (sqrt (+ 1.0 x)) (- (- (sqrt (+ 1.0 y)) (sqrt y)) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.68) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else {
tmp = sqrt((1.0 + x)) + ((sqrt((1.0 + y)) - sqrt(y)) - 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 (z <= 0.68d0) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else
tmp = sqrt((1.0d0 + x)) + ((sqrt((1.0d0 + y)) - sqrt(y)) - 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 (z <= 0.68) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else {
tmp = Math.sqrt((1.0 + x)) + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.68: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 else: tmp = math.sqrt((1.0 + x)) + ((math.sqrt((1.0 + y)) - math.sqrt(y)) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.68) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) - 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 (z <= 0.68)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
else
tmp = sqrt((1.0 + x)) + ((sqrt((1.0 + y)) - sqrt(y)) - 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[z, 0.68], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $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}\;z \leq 0.68:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 0.680000000000000049Initial program 97.6%
associate-+l+97.6%
+-commutative97.6%
associate-+r-77.4%
associate-+l-56.0%
+-commutative56.0%
associate--l+56.0%
+-commutative56.0%
Simplified54.4%
Taylor expanded in z around 0 17.7%
+-commutative17.7%
associate--l+38.3%
associate-+r+38.3%
Simplified38.3%
Taylor expanded in y around 0 18.9%
+-commutative18.9%
+-commutative18.9%
associate-+r+18.9%
+-commutative18.9%
Simplified18.9%
Taylor expanded in x around 0 21.8%
associate--l+39.4%
Simplified39.4%
if 0.680000000000000049 < z Initial program 88.4%
associate-+l+88.4%
+-commutative88.4%
associate-+r-75.5%
associate-+l-59.6%
+-commutative59.6%
associate--l+59.6%
+-commutative59.6%
Simplified25.0%
Taylor expanded in t around inf 33.4%
+-commutative33.4%
+-commutative33.4%
associate--l+35.2%
Simplified35.2%
Taylor expanded in z around inf 34.3%
Final simplification36.9%
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 0.37) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.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) {
double tmp;
if (z <= 0.37) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} 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 <= 0.37d0) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
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 <= 0.37) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} 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 <= 0.37: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 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 <= 0.37) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); 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 <= 0.37)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
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, 0.37], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $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 0.37:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 0.37Initial program 97.9%
associate-+l+97.9%
+-commutative97.9%
associate-+r-77.6%
associate-+l-56.0%
+-commutative56.0%
associate--l+56.0%
+-commutative56.0%
Simplified54.6%
Taylor expanded in z around 0 17.8%
+-commutative17.8%
associate--l+38.5%
associate-+r+38.5%
Simplified38.5%
Taylor expanded in y around 0 19.0%
+-commutative19.0%
+-commutative19.0%
associate-+r+19.0%
+-commutative19.0%
Simplified19.0%
Taylor expanded in x around 0 22.0%
associate--l+39.6%
Simplified39.6%
if 0.37 < z Initial program 88.2%
associate-+l+88.2%
+-commutative88.2%
associate-+r-75.4%
associate-+l-59.6%
+-commutative59.6%
associate--l+59.6%
+-commutative59.6%
Simplified24.9%
Taylor expanded in t around inf 33.6%
+-commutative33.6%
+-commutative33.6%
associate--l+35.4%
Simplified35.4%
Taylor expanded in x around inf 5.4%
associate--l+16.6%
+-commutative16.6%
Simplified16.6%
Taylor expanded in z around 0 31.3%
associate-+r-56.3%
Simplified56.3%
Final simplification47.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 (+ 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 93.1%
associate-+l+93.1%
+-commutative93.1%
associate-+r-76.5%
associate-+l-57.7%
+-commutative57.7%
associate--l+57.7%
+-commutative57.7%
Simplified40.1%
Taylor expanded in t around inf 35.2%
+-commutative35.2%
+-commutative35.2%
associate--l+36.0%
Simplified36.0%
Taylor expanded in x around inf 15.5%
associate--l+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in z around 0 27.9%
associate-+r-47.3%
Simplified47.3%
Final simplification47.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 93.1%
associate-+l+93.1%
+-commutative93.1%
associate-+r-76.5%
associate-+l-57.7%
+-commutative57.7%
associate--l+57.7%
+-commutative57.7%
Simplified40.1%
Taylor expanded in t around inf 35.2%
+-commutative35.2%
+-commutative35.2%
associate--l+36.0%
Simplified36.0%
Taylor expanded in z around inf 22.8%
Taylor expanded in y around inf 15.8%
Final simplification15.8%
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)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 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
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, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 93.1%
associate-+l+93.1%
+-commutative93.1%
associate-+r-76.5%
associate-+l-57.7%
+-commutative57.7%
associate--l+57.7%
+-commutative57.7%
Simplified40.1%
Taylor expanded in t around inf 35.2%
+-commutative35.2%
+-commutative35.2%
associate--l+36.0%
Simplified36.0%
Taylor expanded in x around inf 15.5%
associate--l+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in z around inf 13.0%
Taylor expanded in y around 0 33.4%
Final simplification33.4%
(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 2023240
(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))))