
(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 15 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 x))) (t_2 (sqrt (+ 1.0 y))) (t_3 (sqrt (+ 1.0 z))))
(if (<= (- t_2 (sqrt y)) 0.9999999999999994)
(+ (/ 1.0 (+ (sqrt x) t_1)) (+ (/ 1.0 (+ t_2 (sqrt y))) (- t_3 (sqrt z))))
(+
(+
1.0
(+
(/ (- (+ 1.0 z) z) (+ t_3 (sqrt z)))
(/ (+ 1.0 (- t t)) (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(- t_1 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((1.0 + z));
double tmp;
if ((t_2 - sqrt(y)) <= 0.9999999999999994) {
tmp = (1.0 / (sqrt(x) + t_1)) + ((1.0 / (t_2 + sqrt(y))) + (t_3 - sqrt(z)));
} else {
tmp = (1.0 + ((((1.0 + z) - z) / (t_3 + sqrt(z))) + ((1.0 + (t - t)) / (sqrt((1.0 + t)) + sqrt(t))))) + (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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
t_3 = sqrt((1.0d0 + z))
if ((t_2 - sqrt(y)) <= 0.9999999999999994d0) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + ((1.0d0 / (t_2 + sqrt(y))) + (t_3 - sqrt(z)))
else
tmp = (1.0d0 + ((((1.0d0 + z) - z) / (t_3 + sqrt(z))) + ((1.0d0 + (t - t)) / (sqrt((1.0d0 + t)) + sqrt(t))))) + (t_1 - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + y));
double t_3 = Math.sqrt((1.0 + z));
double tmp;
if ((t_2 - Math.sqrt(y)) <= 0.9999999999999994) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + ((1.0 / (t_2 + Math.sqrt(y))) + (t_3 - Math.sqrt(z)));
} else {
tmp = (1.0 + ((((1.0 + z) - z) / (t_3 + Math.sqrt(z))) + ((1.0 + (t - t)) / (Math.sqrt((1.0 + t)) + Math.sqrt(t))))) + (t_1 - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) t_3 = math.sqrt((1.0 + z)) tmp = 0 if (t_2 - math.sqrt(y)) <= 0.9999999999999994: tmp = (1.0 / (math.sqrt(x) + t_1)) + ((1.0 / (t_2 + math.sqrt(y))) + (t_3 - math.sqrt(z))) else: tmp = (1.0 + ((((1.0 + z) - z) / (t_3 + math.sqrt(z))) + ((1.0 + (t - t)) / (math.sqrt((1.0 + t)) + math.sqrt(t))))) + (t_1 - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(t_2 - sqrt(y)) <= 0.9999999999999994) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(t_3 - sqrt(z)))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(Float64(1.0 + z) - z) / Float64(t_3 + sqrt(z))) + Float64(Float64(1.0 + Float64(t - t)) / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))) + Float64(t_1 - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + y));
t_3 = sqrt((1.0 + z));
tmp = 0.0;
if ((t_2 - sqrt(y)) <= 0.9999999999999994)
tmp = (1.0 / (sqrt(x) + t_1)) + ((1.0 / (t_2 + sqrt(y))) + (t_3 - sqrt(z)));
else
tmp = (1.0 + ((((1.0 + z) - z) / (t_3 + sqrt(z))) + ((1.0 + (t - t)) / (sqrt((1.0 + t)) + sqrt(t))))) + (t_1 - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 0.9999999999999994], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(N[(1.0 + z), $MachinePrecision] - z), $MachinePrecision] / N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(t - t), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + z}\\
\mathbf{if}\;t_2 - \sqrt{y} \leq 0.9999999999999994:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1} + \left(\frac{1}{t_2 + \sqrt{y}} + \left(t_3 - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{\left(1 + z\right) - z}{t_3 + \sqrt{z}} + \frac{1 + \left(t - t\right)}{\sqrt{1 + t} + \sqrt{t}}\right)\right) + \left(t_1 - \sqrt{x}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 0.999999999999999445Initial program 84.4%
associate-+l+84.4%
associate-+l+84.4%
associate-+r+84.4%
+-commutative84.4%
sub-neg84.4%
+-commutative84.4%
sub-neg84.4%
+-commutative84.4%
Simplified84.4%
flip--84.4%
add-sqr-sqrt70.7%
+-commutative70.7%
add-sqr-sqrt85.2%
+-commutative85.2%
Applied egg-rr85.2%
associate--l+87.3%
+-inverses87.3%
metadata-eval87.3%
+-commutative87.3%
Simplified87.3%
flip--87.5%
add-sqr-sqrt60.5%
add-sqr-sqrt88.9%
Applied egg-rr88.9%
associate--l+91.5%
+-inverses91.5%
metadata-eval91.5%
Simplified91.5%
Taylor expanded in t around inf 41.8%
associate--l+51.0%
Simplified51.0%
if 0.999999999999999445 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) Initial program 98.2%
associate-+l+98.2%
associate-+l+98.2%
associate-+r+98.2%
+-commutative98.2%
sub-neg98.2%
+-commutative98.2%
sub-neg98.2%
+-commutative98.2%
Simplified98.2%
flip--98.4%
add-sqr-sqrt70.0%
+-commutative70.0%
add-sqr-sqrt98.4%
+-commutative98.4%
Applied egg-rr98.4%
+-commutative98.4%
associate--l+98.4%
+-commutative98.4%
+-commutative98.4%
Simplified98.4%
Taylor expanded in y around 0 98.4%
flip--98.6%
add-sqr-sqrt75.9%
+-commutative75.9%
add-sqr-sqrt98.9%
+-commutative98.9%
Applied egg-rr98.9%
Final simplification71.4%
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 x) (sqrt (+ 1.0 x)))) (+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))));
}
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(x) + sqrt((1.0d0 + x)))) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))))
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(x) + Math.sqrt((1.0 + x)))) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))));
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[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\right)
\end{array}
Initial program 90.3%
associate-+l+90.3%
associate-+l+90.3%
associate-+r+90.3%
+-commutative90.3%
sub-neg90.3%
+-commutative90.3%
sub-neg90.3%
+-commutative90.3%
Simplified90.3%
flip--90.3%
add-sqr-sqrt74.1%
+-commutative74.1%
add-sqr-sqrt90.8%
+-commutative90.8%
Applied egg-rr90.8%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
+-commutative92.4%
Simplified92.4%
flip--92.5%
add-sqr-sqrt77.0%
add-sqr-sqrt93.3%
Applied egg-rr93.3%
associate--l+94.8%
+-inverses94.8%
metadata-eval94.8%
Simplified94.8%
Final simplification94.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)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- t_2 (sqrt z)))
(t_4 (sqrt (+ 1.0 x))))
(if (<= y 8e-38)
(+ 2.0 (+ t_3 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(if (<= y 2.35e+17)
(+ t_4 (+ t_3 (- (- t_1 (sqrt x)) (sqrt y))))
(+ (/ 1.0 (+ (sqrt x) t_4)) (- (+ t_1 t_2) (+ (sqrt z) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z));
double t_3 = t_2 - sqrt(z);
double t_4 = sqrt((1.0 + x));
double tmp;
if (y <= 8e-38) {
tmp = 2.0 + (t_3 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
} else if (y <= 2.35e+17) {
tmp = t_4 + (t_3 + ((t_1 - sqrt(x)) - sqrt(y)));
} else {
tmp = (1.0 / (sqrt(x) + t_4)) + ((t_1 + t_2) - (sqrt(z) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
t_4 = sqrt((1.0d0 + x))
if (y <= 8d-38) then
tmp = 2.0d0 + (t_3 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
else if (y <= 2.35d+17) then
tmp = t_4 + (t_3 + ((t_1 - sqrt(x)) - sqrt(y)))
else
tmp = (1.0d0 / (sqrt(x) + t_4)) + ((t_1 + t_2) - (sqrt(z) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = t_2 - Math.sqrt(z);
double t_4 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 8e-38) {
tmp = 2.0 + (t_3 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
} else if (y <= 2.35e+17) {
tmp = t_4 + (t_3 + ((t_1 - Math.sqrt(x)) - Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_4)) + ((t_1 + t_2) - (Math.sqrt(z) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + z)) t_3 = t_2 - math.sqrt(z) t_4 = math.sqrt((1.0 + x)) tmp = 0 if y <= 8e-38: tmp = 2.0 + (t_3 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) elif y <= 2.35e+17: tmp = t_4 + (t_3 + ((t_1 - math.sqrt(x)) - math.sqrt(y))) else: tmp = (1.0 / (math.sqrt(x) + t_4)) + ((t_1 + t_2) - (math.sqrt(z) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(t_2 - sqrt(z)) t_4 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 8e-38) tmp = Float64(2.0 + Float64(t_3 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); elseif (y <= 2.35e+17) tmp = Float64(t_4 + Float64(t_3 + Float64(Float64(t_1 - sqrt(x)) - sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_4)) + Float64(Float64(t_1 + t_2) - Float64(sqrt(z) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + z));
t_3 = t_2 - sqrt(z);
t_4 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 8e-38)
tmp = 2.0 + (t_3 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
elseif (y <= 2.35e+17)
tmp = t_4 + (t_3 + ((t_1 - sqrt(x)) - sqrt(y)));
else
tmp = (1.0 / (sqrt(x) + t_4)) + ((t_1 + t_2) - (sqrt(z) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 8e-38], N[(2.0 + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.35e+17], N[(t$95$4 + N[(t$95$3 + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 + t$95$2), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
t_3 := t_2 - \sqrt{z}\\
t_4 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 8 \cdot 10^{-38}:\\
\;\;\;\;2 + \left(t_3 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{+17}:\\
\;\;\;\;t_4 + \left(t_3 + \left(\left(t_1 - \sqrt{x}\right) - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_4} + \left(\left(t_1 + t_2\right) - \left(\sqrt{z} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if y < 7.9999999999999997e-38Initial program 98.1%
associate-+l+98.1%
associate-+l+98.1%
associate-+r+98.1%
+-commutative98.1%
sub-neg98.1%
+-commutative98.1%
sub-neg98.1%
+-commutative98.1%
Simplified98.1%
flip--98.3%
add-sqr-sqrt70.1%
+-commutative70.1%
add-sqr-sqrt98.3%
+-commutative98.3%
Applied egg-rr98.3%
+-commutative98.3%
associate--l+98.3%
+-commutative98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in y around 0 98.3%
Taylor expanded in x around 0 28.1%
associate--l+54.1%
+-commutative54.1%
associate--l+57.1%
Simplified57.1%
if 7.9999999999999997e-38 < y < 2.35e17Initial program 90.9%
associate-+l+90.9%
sub-neg90.9%
associate-+l+52.1%
associate-+l+44.5%
+-commutative44.5%
neg-sub044.5%
associate-+l-44.5%
neg-sub044.5%
Simplified21.1%
Taylor expanded in t around inf 30.0%
+-commutative30.0%
Simplified30.0%
if 2.35e17 < y Initial program 82.6%
associate-+l+82.6%
associate-+l+82.6%
associate-+r+82.6%
+-commutative82.6%
sub-neg82.6%
+-commutative82.6%
sub-neg82.6%
+-commutative82.6%
Simplified82.6%
flip--82.6%
add-sqr-sqrt68.3%
+-commutative68.3%
add-sqr-sqrt83.1%
+-commutative83.1%
Applied egg-rr83.1%
associate--l+85.5%
+-inverses85.5%
metadata-eval85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 19.4%
Final simplification36.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 5.4e-32)
(+ 2.0 (+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(+
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))
(+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (y <= 5.4e-32) {
tmp = 2.0 + (t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + 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((1.0d0 + z)) - sqrt(z)
if (y <= 5.4d-32) then
tmp = 2.0d0 + (t_1 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + 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((1.0 + z)) - Math.sqrt(z);
double tmp;
if (y <= 5.4e-32) {
tmp = 2.0 + (t_1 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if y <= 5.4e-32: tmp = 2.0 + (t_1 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (y <= 5.4e-32) tmp = Float64(2.0 + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + 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((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (y <= 5.4e-32)
tmp = 2.0 + (t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + 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[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.4e-32], N[(2.0 + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;y \leq 5.4 \cdot 10^{-32}:\\
\;\;\;\;2 + \left(t_1 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + t_1\right)\\
\end{array}
\end{array}
if y < 5.39999999999999962e-32Initial program 98.2%
associate-+l+98.2%
associate-+l+98.2%
associate-+r+98.2%
+-commutative98.2%
sub-neg98.2%
+-commutative98.2%
sub-neg98.2%
+-commutative98.2%
Simplified98.2%
flip--98.4%
add-sqr-sqrt70.6%
+-commutative70.6%
add-sqr-sqrt98.4%
+-commutative98.4%
Applied egg-rr98.4%
+-commutative98.4%
associate--l+98.4%
+-commutative98.4%
+-commutative98.4%
Simplified98.4%
Taylor expanded in y around 0 98.4%
Taylor expanded in x around 0 29.1%
associate--l+54.0%
+-commutative54.0%
associate--l+56.8%
Simplified56.8%
if 5.39999999999999962e-32 < y Initial program 84.5%
associate-+l+84.5%
associate-+l+84.5%
associate-+r+84.5%
+-commutative84.5%
sub-neg84.5%
+-commutative84.5%
sub-neg84.5%
+-commutative84.5%
Simplified84.5%
flip--84.5%
add-sqr-sqrt70.9%
+-commutative70.9%
add-sqr-sqrt85.3%
+-commutative85.3%
Applied egg-rr85.3%
associate--l+87.3%
+-inverses87.3%
metadata-eval87.3%
+-commutative87.3%
Simplified87.3%
flip--87.6%
add-sqr-sqrt60.8%
add-sqr-sqrt89.0%
Applied egg-rr89.0%
associate--l+91.6%
+-inverses91.6%
metadata-eval91.6%
Simplified91.6%
Taylor expanded in t around inf 41.6%
associate--l+51.3%
Simplified51.3%
Final simplification53.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 z)) (sqrt z))))
(if (<= y 2.1e-38)
(+ 2.0 (+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(+ (sqrt (+ 1.0 x)) (+ (- (sqrt (+ 1.0 y)) (sqrt y)) (- t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (y <= 2.1e-38) {
tmp = 2.0 + (t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
} else {
tmp = sqrt((1.0 + x)) + ((sqrt((1.0 + y)) - sqrt(y)) + (t_1 - sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
if (y <= 2.1d-38) then
tmp = 2.0d0 + (t_1 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
else
tmp = sqrt((1.0d0 + x)) + ((sqrt((1.0d0 + y)) - sqrt(y)) + (t_1 - sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (y <= 2.1e-38) {
tmp = 2.0 + (t_1 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
} else {
tmp = Math.sqrt((1.0 + x)) + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + (t_1 - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if y <= 2.1e-38: tmp = 2.0 + (t_1 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) else: tmp = math.sqrt((1.0 + x)) + ((math.sqrt((1.0 + y)) - math.sqrt(y)) + (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(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (y <= 2.1e-38) tmp = Float64(2.0 + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + Float64(t_1 - sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (y <= 2.1e-38)
tmp = 2.0 + (t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
else
tmp = sqrt((1.0 + x)) + ((sqrt((1.0 + y)) - sqrt(y)) + (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[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.1e-38], N[(2.0 + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(t$95$1 - 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} - \sqrt{z}\\
\mathbf{if}\;y \leq 2.1 \cdot 10^{-38}:\\
\;\;\;\;2 + \left(t_1 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(t_1 - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if y < 2.10000000000000013e-38Initial program 98.1%
associate-+l+98.1%
associate-+l+98.1%
associate-+r+98.1%
+-commutative98.1%
sub-neg98.1%
+-commutative98.1%
sub-neg98.1%
+-commutative98.1%
Simplified98.1%
flip--98.3%
add-sqr-sqrt70.1%
+-commutative70.1%
add-sqr-sqrt98.3%
+-commutative98.3%
Applied egg-rr98.3%
+-commutative98.3%
associate--l+98.3%
+-commutative98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in y around 0 98.3%
Taylor expanded in x around 0 28.1%
associate--l+54.1%
+-commutative54.1%
associate--l+57.1%
Simplified57.1%
if 2.10000000000000013e-38 < y Initial program 85.0%
associate-+l+85.0%
+-commutative85.0%
associate-+r-73.6%
associate-+l-49.0%
+-commutative49.0%
associate--l+49.0%
+-commutative49.0%
Simplified36.7%
Taylor expanded in t around inf 27.2%
+-commutative27.2%
+-commutative27.2%
associate--l+27.2%
Simplified27.2%
Final simplification39.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 3.6e-24)
(+
2.0
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(if (<= y 5e+20)
(+ (sqrt (+ 1.0 y)) (- (+ 1.0 (* x 0.5)) (+ (sqrt x) (sqrt y))))
(- (sqrt (+ 1.0 x)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.6e-24) {
tmp = 2.0 + ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
} else if (y <= 5e+20) {
tmp = sqrt((1.0 + y)) + ((1.0 + (x * 0.5)) - (sqrt(x) + sqrt(y)));
} else {
tmp = sqrt((1.0 + x)) - 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 <= 3.6d-24) then
tmp = 2.0d0 + ((sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
else if (y <= 5d+20) then
tmp = sqrt((1.0d0 + y)) + ((1.0d0 + (x * 0.5d0)) - (sqrt(x) + sqrt(y)))
else
tmp = sqrt((1.0d0 + x)) - 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 <= 3.6e-24) {
tmp = 2.0 + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
} else if (y <= 5e+20) {
tmp = Math.sqrt((1.0 + y)) + ((1.0 + (x * 0.5)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3.6e-24: tmp = 2.0 + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) elif y <= 5e+20: tmp = math.sqrt((1.0 + y)) + ((1.0 + (x * 0.5)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = math.sqrt((1.0 + x)) - 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 <= 3.6e-24) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); elseif (y <= 5e+20) tmp = Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(1.0 + Float64(x * 0.5)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(sqrt(Float64(1.0 + x)) - 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 <= 3.6e-24)
tmp = 2.0 + ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
elseif (y <= 5e+20)
tmp = sqrt((1.0 + y)) + ((1.0 + (x * 0.5)) - (sqrt(x) + sqrt(y)));
else
tmp = sqrt((1.0 + x)) - 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, 3.6e-24], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+20], N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.6 \cdot 10^{-24}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+20}:\\
\;\;\;\;\sqrt{1 + y} + \left(\left(1 + x \cdot 0.5\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 3.6000000000000001e-24Initial program 98.0%
associate-+l+98.0%
associate-+l+98.0%
associate-+r+98.0%
+-commutative98.0%
sub-neg98.0%
+-commutative98.0%
sub-neg98.0%
+-commutative98.0%
Simplified98.0%
flip--98.2%
add-sqr-sqrt71.2%
+-commutative71.2%
add-sqr-sqrt98.2%
+-commutative98.2%
Applied egg-rr98.2%
+-commutative98.2%
associate--l+98.2%
+-commutative98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in y around 0 97.3%
Taylor expanded in x around 0 29.1%
associate--l+54.3%
+-commutative54.3%
associate--l+56.8%
Simplified56.8%
if 3.6000000000000001e-24 < y < 5e20Initial program 85.2%
associate-+l+85.2%
+-commutative85.2%
associate-+r-45.6%
associate-+l-34.4%
+-commutative34.4%
associate--l+34.4%
+-commutative34.4%
Simplified22.0%
Taylor expanded in t around inf 10.5%
associate--l+24.3%
+-commutative24.3%
+-commutative24.3%
Simplified24.3%
Taylor expanded in z around inf 27.9%
+-commutative27.9%
Simplified27.9%
Taylor expanded in x around 0 18.4%
if 5e20 < y Initial program 83.0%
associate-+l+83.0%
+-commutative83.0%
associate-+r-83.0%
associate-+l-51.0%
+-commutative51.0%
associate--l+51.0%
+-commutative51.0%
Simplified39.5%
Taylor expanded in t around inf 4.2%
associate--l+5.7%
+-commutative5.7%
+-commutative5.7%
Simplified5.7%
Taylor expanded in z around inf 5.5%
+-commutative5.5%
Simplified5.5%
Taylor expanded in y around inf 13.7%
Final simplification34.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 y))))
(if (<= z 7.2e+21)
(+ t_1 (+ 1.0 (- (- (sqrt (+ 1.0 z)) (sqrt y)) (sqrt z))))
(- 1.0 (- (sqrt y) t_1)))))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 <= 7.2e+21) {
tmp = t_1 + (1.0 + ((sqrt((1.0 + z)) - sqrt(y)) - sqrt(z)));
} else {
tmp = 1.0 - (sqrt(y) - 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((1.0d0 + y))
if (z <= 7.2d+21) then
tmp = t_1 + (1.0d0 + ((sqrt((1.0d0 + z)) - sqrt(y)) - sqrt(z)))
else
tmp = 1.0d0 - (sqrt(y) - 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((1.0 + y));
double tmp;
if (z <= 7.2e+21) {
tmp = t_1 + (1.0 + ((Math.sqrt((1.0 + z)) - Math.sqrt(y)) - Math.sqrt(z)));
} else {
tmp = 1.0 - (Math.sqrt(y) - t_1);
}
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 <= 7.2e+21: tmp = t_1 + (1.0 + ((math.sqrt((1.0 + z)) - math.sqrt(y)) - math.sqrt(z))) else: tmp = 1.0 - (math.sqrt(y) - t_1) 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 <= 7.2e+21) tmp = Float64(t_1 + Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(y)) - sqrt(z)))); else tmp = Float64(1.0 - Float64(sqrt(y) - 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((1.0 + y));
tmp = 0.0;
if (z <= 7.2e+21)
tmp = t_1 + (1.0 + ((sqrt((1.0 + z)) - sqrt(y)) - sqrt(z)));
else
tmp = 1.0 - (sqrt(y) - 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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 7.2e+21], N[(t$95$1 + N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[Sqrt[y], $MachinePrecision] - t$95$1), $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 7.2 \cdot 10^{+21}:\\
\;\;\;\;t_1 + \left(1 + \left(\left(\sqrt{1 + z} - \sqrt{y}\right) - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(\sqrt{y} - t_1\right)\\
\end{array}
\end{array}
if z < 7.2e21Initial program 96.4%
associate-+l+96.4%
+-commutative96.4%
associate-+r-75.1%
associate-+l-52.0%
+-commutative52.0%
associate--l+52.0%
+-commutative52.0%
Simplified50.9%
Taylor expanded in t around inf 20.8%
associate--l+25.4%
+-commutative25.4%
+-commutative25.4%
Simplified25.4%
Taylor expanded in x around 0 35.4%
associate--l+35.4%
+-commutative35.4%
associate--r+35.4%
Simplified35.4%
if 7.2e21 < z Initial program 83.1%
associate-+l+83.1%
+-commutative83.1%
associate-+r-61.2%
associate-+l-50.9%
+-commutative50.9%
associate--l+50.9%
+-commutative50.9%
Simplified22.2%
Taylor expanded in t around inf 3.2%
associate--l+21.3%
+-commutative21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in z around inf 38.1%
+-commutative38.1%
Simplified38.1%
Taylor expanded in x around 0 38.3%
associate--l+49.5%
Simplified49.5%
Final simplification41.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 7.2e+21) (+ (sqrt (+ 1.0 z)) (- 2.0 (+ (sqrt y) (sqrt z)))) (- 1.0 (- (sqrt y) (sqrt (+ 1.0 y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.2e+21) {
tmp = sqrt((1.0 + z)) + (2.0 - (sqrt(y) + sqrt(z)));
} else {
tmp = 1.0 - (sqrt(y) - sqrt((1.0 + 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 <= 7.2d+21) then
tmp = sqrt((1.0d0 + z)) + (2.0d0 - (sqrt(y) + sqrt(z)))
else
tmp = 1.0d0 - (sqrt(y) - sqrt((1.0d0 + 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 <= 7.2e+21) {
tmp = Math.sqrt((1.0 + z)) + (2.0 - (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 1.0 - (Math.sqrt(y) - Math.sqrt((1.0 + y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 7.2e+21: tmp = math.sqrt((1.0 + z)) + (2.0 - (math.sqrt(y) + math.sqrt(z))) else: tmp = 1.0 - (math.sqrt(y) - math.sqrt((1.0 + y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 7.2e+21) tmp = Float64(sqrt(Float64(1.0 + z)) + Float64(2.0 - Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(1.0 - Float64(sqrt(y) - sqrt(Float64(1.0 + 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 <= 7.2e+21)
tmp = sqrt((1.0 + z)) + (2.0 - (sqrt(y) + sqrt(z)));
else
tmp = 1.0 - (sqrt(y) - sqrt((1.0 + 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, 7.2e+21], N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(2.0 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[N[(1.0 + 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 7.2 \cdot 10^{+21}:\\
\;\;\;\;\sqrt{1 + z} + \left(2 - \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(\sqrt{y} - \sqrt{1 + y}\right)\\
\end{array}
\end{array}
if z < 7.2e21Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
associate-+l+75.1%
associate-+l+52.0%
+-commutative52.0%
neg-sub052.0%
associate-+l-52.0%
neg-sub052.0%
Simplified31.5%
Taylor expanded in t around inf 20.8%
Taylor expanded in y around 0 18.2%
associate-+r+18.2%
Simplified18.2%
Taylor expanded in x around 0 31.4%
+-commutative31.4%
associate--l+31.4%
Simplified31.4%
if 7.2e21 < z Initial program 83.1%
associate-+l+83.1%
+-commutative83.1%
associate-+r-61.2%
associate-+l-50.9%
+-commutative50.9%
associate--l+50.9%
+-commutative50.9%
Simplified22.2%
Taylor expanded in t around inf 3.2%
associate--l+21.3%
+-commutative21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in z around inf 38.1%
+-commutative38.1%
Simplified38.1%
Taylor expanded in x around 0 38.3%
associate--l+49.5%
Simplified49.5%
Final simplification39.7%
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 7.2e+21) (- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt y) (sqrt z))) (- 1.0 (- (sqrt y) (sqrt (+ 1.0 y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.2e+21) {
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(y) + sqrt(z));
} else {
tmp = 1.0 - (sqrt(y) - sqrt((1.0 + 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 <= 7.2d+21) then
tmp = (sqrt((1.0d0 + z)) + 2.0d0) - (sqrt(y) + sqrt(z))
else
tmp = 1.0d0 - (sqrt(y) - sqrt((1.0d0 + 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 <= 7.2e+21) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = 1.0 - (Math.sqrt(y) - Math.sqrt((1.0 + y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 7.2e+21: tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(y) + math.sqrt(z)) else: tmp = 1.0 - (math.sqrt(y) - math.sqrt((1.0 + y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 7.2e+21) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(1.0 - Float64(sqrt(y) - sqrt(Float64(1.0 + 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 <= 7.2e+21)
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(y) + sqrt(z));
else
tmp = 1.0 - (sqrt(y) - sqrt((1.0 + 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, 7.2e+21], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[N[(1.0 + 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 7.2 \cdot 10^{+21}:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(\sqrt{y} - \sqrt{1 + y}\right)\\
\end{array}
\end{array}
if z < 7.2e21Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
associate-+l+75.1%
associate-+l+52.0%
+-commutative52.0%
neg-sub052.0%
associate-+l-52.0%
neg-sub052.0%
Simplified31.5%
Taylor expanded in t around inf 20.8%
Taylor expanded in y around 0 18.2%
associate-+r+18.2%
Simplified18.2%
Taylor expanded in x around 0 31.4%
+-commutative31.4%
Simplified31.4%
if 7.2e21 < z Initial program 83.1%
associate-+l+83.1%
+-commutative83.1%
associate-+r-61.2%
associate-+l-50.9%
+-commutative50.9%
associate--l+50.9%
+-commutative50.9%
Simplified22.2%
Taylor expanded in t around inf 3.2%
associate--l+21.3%
+-commutative21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in z around inf 38.1%
+-commutative38.1%
Simplified38.1%
Taylor expanded in x around 0 38.3%
associate--l+49.5%
Simplified49.5%
Final simplification39.7%
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 3.1e+21) (- 1.0 (- (sqrt y) (sqrt (+ 1.0 y)))) (- (sqrt (+ 1.0 x)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.1e+21) {
tmp = 1.0 - (sqrt(y) - sqrt((1.0 + y)));
} else {
tmp = sqrt((1.0 + x)) - 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 <= 3.1d+21) then
tmp = 1.0d0 - (sqrt(y) - sqrt((1.0d0 + y)))
else
tmp = sqrt((1.0d0 + x)) - 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 <= 3.1e+21) {
tmp = 1.0 - (Math.sqrt(y) - Math.sqrt((1.0 + y)));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3.1e+21: tmp = 1.0 - (math.sqrt(y) - math.sqrt((1.0 + y))) else: tmp = math.sqrt((1.0 + x)) - 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 <= 3.1e+21) tmp = Float64(1.0 - Float64(sqrt(y) - sqrt(Float64(1.0 + y)))); else tmp = Float64(sqrt(Float64(1.0 + x)) - 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 <= 3.1e+21)
tmp = 1.0 - (sqrt(y) - sqrt((1.0 + y)));
else
tmp = sqrt((1.0 + x)) - 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, 3.1e+21], N[(1.0 - N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{+21}:\\
\;\;\;\;1 - \left(\sqrt{y} - \sqrt{1 + y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 3.1e21Initial program 95.3%
associate-+l+95.3%
+-commutative95.3%
associate-+r-58.9%
associate-+l-52.0%
+-commutative52.0%
associate--l+52.0%
+-commutative52.0%
Simplified36.3%
Taylor expanded in t around inf 18.4%
associate--l+35.7%
+-commutative35.7%
+-commutative35.7%
Simplified35.7%
Taylor expanded in z around inf 37.4%
+-commutative37.4%
Simplified37.4%
Taylor expanded in x around 0 48.6%
associate--l+48.6%
Simplified48.6%
if 3.1e21 < y Initial program 83.1%
associate-+l+83.1%
+-commutative83.1%
associate-+r-83.1%
associate-+l-50.7%
+-commutative50.7%
associate--l+50.7%
+-commutative50.7%
Simplified39.7%
Taylor expanded in t around inf 4.3%
associate--l+5.7%
+-commutative5.7%
+-commutative5.7%
Simplified5.7%
Taylor expanded in z around inf 5.4%
+-commutative5.4%
Simplified5.4%
Taylor expanded in y around inf 13.7%
Final simplification34.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 1e+23) (- (+ 1.0 (sqrt (+ 1.0 y))) (sqrt y)) (- (sqrt (+ 1.0 x)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1e+23) {
tmp = (1.0 + sqrt((1.0 + y))) - sqrt(y);
} else {
tmp = sqrt((1.0 + x)) - 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 <= 1d+23) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - sqrt(y)
else
tmp = sqrt((1.0d0 + x)) - 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 <= 1e+23) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - Math.sqrt(y);
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1e+23: tmp = (1.0 + math.sqrt((1.0 + y))) - math.sqrt(y) else: tmp = math.sqrt((1.0 + x)) - 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 <= 1e+23) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - sqrt(y)); else tmp = Float64(sqrt(Float64(1.0 + x)) - 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 <= 1e+23)
tmp = (1.0 + sqrt((1.0 + y))) - sqrt(y);
else
tmp = sqrt((1.0 + x)) - 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, 1e+23], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+23}:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 9.9999999999999992e22Initial program 95.2%
associate-+l+95.2%
+-commutative95.2%
associate-+r-59.0%
associate-+l-52.2%
+-commutative52.2%
associate--l+52.2%
+-commutative52.2%
Simplified36.6%
Taylor expanded in t around inf 18.4%
associate--l+35.6%
+-commutative35.6%
+-commutative35.6%
Simplified35.6%
Taylor expanded in z around inf 37.3%
+-commutative37.3%
Simplified37.3%
Taylor expanded in x around 0 48.4%
if 9.9999999999999992e22 < y Initial program 83.1%
associate-+l+83.1%
+-commutative83.1%
associate-+r-83.1%
associate-+l-50.4%
+-commutative50.4%
associate--l+50.4%
+-commutative50.4%
Simplified39.3%
Taylor expanded in t around inf 4.1%
associate--l+5.5%
+-commutative5.5%
+-commutative5.5%
Simplified5.5%
Taylor expanded in z around inf 5.2%
+-commutative5.2%
Simplified5.2%
Taylor expanded in y around inf 13.6%
Final simplification34.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 3.9) (- (+ 2.0 (* x 0.5)) (sqrt x)) (- (sqrt (+ 1.0 x)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.9) {
tmp = (2.0 + (x * 0.5)) - sqrt(x);
} else {
tmp = sqrt((1.0 + x)) - 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 <= 3.9d0) then
tmp = (2.0d0 + (x * 0.5d0)) - sqrt(x)
else
tmp = sqrt((1.0d0 + x)) - 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 <= 3.9) {
tmp = (2.0 + (x * 0.5)) - Math.sqrt(x);
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3.9: tmp = (2.0 + (x * 0.5)) - math.sqrt(x) else: tmp = math.sqrt((1.0 + x)) - 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 <= 3.9) tmp = Float64(Float64(2.0 + Float64(x * 0.5)) - sqrt(x)); else tmp = Float64(sqrt(Float64(1.0 + x)) - 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 <= 3.9)
tmp = (2.0 + (x * 0.5)) - sqrt(x);
else
tmp = sqrt((1.0 + x)) - 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, 3.9], N[(N[(2.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.9:\\
\;\;\;\;\left(2 + x \cdot 0.5\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 3.89999999999999991Initial program 97.6%
associate-+l+97.6%
+-commutative97.6%
associate-+r-59.5%
associate-+l-53.5%
+-commutative53.5%
associate--l+53.5%
+-commutative53.5%
Simplified37.9%
Taylor expanded in t around inf 19.0%
associate--l+37.2%
+-commutative37.2%
+-commutative37.2%
Simplified37.2%
Taylor expanded in z around inf 39.1%
+-commutative39.1%
Simplified39.1%
Taylor expanded in x around 0 24.8%
Taylor expanded in y around 0 24.1%
if 3.89999999999999991 < y Initial program 81.9%
associate-+l+81.9%
+-commutative81.9%
associate-+r-79.2%
associate-+l-49.1%
+-commutative49.1%
associate--l+49.1%
+-commutative49.1%
Simplified37.5%
Taylor expanded in t around inf 5.4%
associate--l+7.7%
+-commutative7.7%
+-commutative7.7%
Simplified7.7%
Taylor expanded in z around inf 7.5%
+-commutative7.5%
Simplified7.5%
Taylor expanded in y around inf 14.1%
Final simplification19.5%
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.6) (- (+ 2.0 (* x 0.5)) (sqrt x)) (- (+ 1.0 (* x 0.5)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.6) {
tmp = (2.0 + (x * 0.5)) - sqrt(x);
} else {
tmp = (1.0 + (x * 0.5)) - 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.6d0) then
tmp = (2.0d0 + (x * 0.5d0)) - sqrt(x)
else
tmp = (1.0d0 + (x * 0.5d0)) - 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.6) {
tmp = (2.0 + (x * 0.5)) - Math.sqrt(x);
} else {
tmp = (1.0 + (x * 0.5)) - 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.6: tmp = (2.0 + (x * 0.5)) - math.sqrt(x) else: tmp = (1.0 + (x * 0.5)) - 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.6) tmp = Float64(Float64(2.0 + Float64(x * 0.5)) - sqrt(x)); else tmp = Float64(Float64(1.0 + Float64(x * 0.5)) - 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.6)
tmp = (2.0 + (x * 0.5)) - sqrt(x);
else
tmp = (1.0 + (x * 0.5)) - 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.6], N[(N[(2.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.6:\\
\;\;\;\;\left(2 + x \cdot 0.5\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 5.5999999999999996Initial program 97.6%
associate-+l+97.6%
+-commutative97.6%
associate-+r-59.5%
associate-+l-53.5%
+-commutative53.5%
associate--l+53.5%
+-commutative53.5%
Simplified37.9%
Taylor expanded in t around inf 19.0%
associate--l+37.2%
+-commutative37.2%
+-commutative37.2%
Simplified37.2%
Taylor expanded in z around inf 39.1%
+-commutative39.1%
Simplified39.1%
Taylor expanded in x around 0 24.8%
Taylor expanded in y around 0 24.1%
if 5.5999999999999996 < y Initial program 81.9%
associate-+l+81.9%
+-commutative81.9%
associate-+r-79.2%
associate-+l-49.1%
+-commutative49.1%
associate--l+49.1%
+-commutative49.1%
Simplified37.5%
Taylor expanded in t around inf 5.4%
associate--l+7.7%
+-commutative7.7%
+-commutative7.7%
Simplified7.7%
Taylor expanded in z around inf 7.5%
+-commutative7.5%
Simplified7.5%
Taylor expanded in x around 0 6.4%
Taylor expanded in y around inf 14.8%
Final simplification19.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 (* 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 90.3%
associate-+l+90.3%
+-commutative90.3%
associate-+r-68.7%
associate-+l-51.5%
+-commutative51.5%
associate--l+51.5%
+-commutative51.5%
Simplified37.7%
Taylor expanded in t around inf 12.7%
associate--l+23.5%
+-commutative23.5%
+-commutative23.5%
Simplified23.5%
Taylor expanded in z around inf 24.4%
+-commutative24.4%
Simplified24.4%
Taylor expanded in x around 0 16.3%
Taylor expanded in y around inf 13.0%
Final simplification13.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* x 0.5))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return x * 0.5;
}
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 = x * 0.5d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return x * 0.5;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return x * 0.5
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(x * 0.5) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = x * 0.5;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x * 0.5), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
x \cdot 0.5
\end{array}
Initial program 90.3%
associate-+l+90.3%
+-commutative90.3%
associate-+r-68.7%
associate-+l-51.5%
+-commutative51.5%
associate--l+51.5%
+-commutative51.5%
Simplified37.7%
Taylor expanded in t around inf 12.7%
associate--l+23.5%
+-commutative23.5%
+-commutative23.5%
Simplified23.5%
Taylor expanded in z around inf 24.4%
+-commutative24.4%
Simplified24.4%
Taylor expanded in x around 0 16.3%
Taylor expanded in x around inf 5.3%
*-commutative5.3%
Simplified5.3%
Final simplification5.3%
(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 2023252
(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))))