
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y)))
(t_2 (- t_1 (sqrt y)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (sqrt (+ 1.0 t))))
(if (<= t_2 0.15)
(+ (- t_4 (sqrt t)) (+ (/ 1.0 (+ (sqrt x) t_3)) (/ 1.0 (+ (sqrt y) t_1))))
(+
(+ (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) t_2) (- t_3 (sqrt x)))
(/ 1.0 (+ t_4 (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = t_1 - sqrt(y);
double t_3 = sqrt((1.0 + x));
double t_4 = sqrt((1.0 + t));
double tmp;
if (t_2 <= 0.15) {
tmp = (t_4 - sqrt(t)) + ((1.0 / (sqrt(x) + t_3)) + (1.0 / (sqrt(y) + t_1)));
} else {
tmp = (((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + t_2) + (t_3 - sqrt(x))) + (1.0 / (t_4 + sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = t_1 - sqrt(y)
t_3 = sqrt((1.0d0 + x))
t_4 = sqrt((1.0d0 + t))
if (t_2 <= 0.15d0) then
tmp = (t_4 - sqrt(t)) + ((1.0d0 / (sqrt(x) + t_3)) + (1.0d0 / (sqrt(y) + t_1)))
else
tmp = (((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + t_2) + (t_3 - sqrt(x))) + (1.0d0 / (t_4 + sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = t_1 - Math.sqrt(y);
double t_3 = Math.sqrt((1.0 + x));
double t_4 = Math.sqrt((1.0 + t));
double tmp;
if (t_2 <= 0.15) {
tmp = (t_4 - Math.sqrt(t)) + ((1.0 / (Math.sqrt(x) + t_3)) + (1.0 / (Math.sqrt(y) + t_1)));
} else {
tmp = (((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + t_2) + (t_3 - Math.sqrt(x))) + (1.0 / (t_4 + Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = t_1 - math.sqrt(y) t_3 = math.sqrt((1.0 + x)) t_4 = math.sqrt((1.0 + t)) tmp = 0 if t_2 <= 0.15: tmp = (t_4 - math.sqrt(t)) + ((1.0 / (math.sqrt(x) + t_3)) + (1.0 / (math.sqrt(y) + t_1))) else: tmp = (((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + t_2) + (t_3 - math.sqrt(x))) + (1.0 / (t_4 + math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = Float64(t_1 - sqrt(y)) t_3 = sqrt(Float64(1.0 + x)) t_4 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_2 <= 0.15) tmp = Float64(Float64(t_4 - sqrt(t)) + Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(1.0 / Float64(sqrt(y) + t_1)))); else tmp = Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + t_2) + Float64(t_3 - sqrt(x))) + Float64(1.0 / Float64(t_4 + sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = t_1 - sqrt(y);
t_3 = sqrt((1.0 + x));
t_4 = sqrt((1.0 + t));
tmp = 0.0;
if (t_2 <= 0.15)
tmp = (t_4 - sqrt(t)) + ((1.0 / (sqrt(x) + t_3)) + (1.0 / (sqrt(y) + t_1)));
else
tmp = (((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + t_2) + (t_3 - sqrt(x))) + (1.0 / (t_4 + sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 0.15], N[(N[(t$95$4 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$4 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := t_1 - \sqrt{y}\\
t_3 := \sqrt{1 + x}\\
t_4 := \sqrt{1 + t}\\
\mathbf{if}\;t_2 \leq 0.15:\\
\;\;\;\;\left(t_4 - \sqrt{t}\right) + \left(\frac{1}{\sqrt{x} + t_3} + \frac{1}{\sqrt{y} + t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + t_2\right) + \left(t_3 - \sqrt{x}\right)\right) + \frac{1}{t_4 + \sqrt{t}}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 0.149999999999999994Initial program 86.3%
associate-+l+86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
flip--86.3%
add-sqr-sqrt68.4%
+-commutative68.4%
add-sqr-sqrt86.5%
+-commutative86.5%
Applied egg-rr86.5%
associate--l+89.9%
+-inverses89.9%
metadata-eval89.9%
Simplified89.9%
flip--89.9%
add-sqr-sqrt47.3%
add-sqr-sqrt90.3%
Applied egg-rr90.3%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
Simplified92.4%
Taylor expanded in z around inf 50.6%
+-commutative50.6%
Simplified50.6%
if 0.149999999999999994 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) Initial program 97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
flip--97.0%
add-sqr-sqrt69.6%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified97.7%
flip--97.8%
add-sqr-sqrt76.3%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification76.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)))
(t_2 (- t_1 (sqrt y)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_2 0.15)
(+ t_4 (+ (/ 1.0 (+ (sqrt x) t_3)) (/ 1.0 (+ (sqrt y) t_1))))
(+
t_4
(+ (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) t_2) (- t_3 (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 t_2 = t_1 - sqrt(y);
double t_3 = sqrt((1.0 + x));
double t_4 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_2 <= 0.15) {
tmp = t_4 + ((1.0 / (sqrt(x) + t_3)) + (1.0 / (sqrt(y) + t_1)));
} else {
tmp = t_4 + (((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + t_2) + (t_3 - 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) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = t_1 - sqrt(y)
t_3 = sqrt((1.0d0 + x))
t_4 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_2 <= 0.15d0) then
tmp = t_4 + ((1.0d0 / (sqrt(x) + t_3)) + (1.0d0 / (sqrt(y) + t_1)))
else
tmp = t_4 + (((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + t_2) + (t_3 - 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 t_2 = t_1 - Math.sqrt(y);
double t_3 = Math.sqrt((1.0 + x));
double t_4 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_2 <= 0.15) {
tmp = t_4 + ((1.0 / (Math.sqrt(x) + t_3)) + (1.0 / (Math.sqrt(y) + t_1)));
} else {
tmp = t_4 + (((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + t_2) + (t_3 - 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)) t_2 = t_1 - math.sqrt(y) t_3 = math.sqrt((1.0 + x)) t_4 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_2 <= 0.15: tmp = t_4 + ((1.0 / (math.sqrt(x) + t_3)) + (1.0 / (math.sqrt(y) + t_1))) else: tmp = t_4 + (((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + t_2) + (t_3 - 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)) t_2 = Float64(t_1 - sqrt(y)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_2 <= 0.15) tmp = Float64(t_4 + Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(1.0 / Float64(sqrt(y) + t_1)))); else tmp = Float64(t_4 + Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + t_2) + Float64(t_3 - 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));
t_2 = t_1 - sqrt(y);
t_3 = sqrt((1.0 + x));
t_4 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_2 <= 0.15)
tmp = t_4 + ((1.0 / (sqrt(x) + t_3)) + (1.0 / (sqrt(y) + t_1)));
else
tmp = t_4 + (((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + t_2) + (t_3 - 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]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.15], N[(t$95$4 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 + N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(t$95$3 - 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 + y}\\
t_2 := t_1 - \sqrt{y}\\
t_3 := \sqrt{1 + x}\\
t_4 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t_2 \leq 0.15:\\
\;\;\;\;t_4 + \left(\frac{1}{\sqrt{x} + t_3} + \frac{1}{\sqrt{y} + t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t_4 + \left(\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + t_2\right) + \left(t_3 - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 0.149999999999999994Initial program 86.3%
associate-+l+86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
flip--86.3%
add-sqr-sqrt68.4%
+-commutative68.4%
add-sqr-sqrt86.5%
+-commutative86.5%
Applied egg-rr86.5%
associate--l+89.9%
+-inverses89.9%
metadata-eval89.9%
Simplified89.9%
flip--89.9%
add-sqr-sqrt47.3%
add-sqr-sqrt90.3%
Applied egg-rr90.3%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
Simplified92.4%
Taylor expanded in z around inf 50.6%
+-commutative50.6%
Simplified50.6%
if 0.149999999999999994 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) Initial program 97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
flip--97.0%
add-sqr-sqrt69.6%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified97.7%
Final simplification75.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 (/ 1.0 (+ (sqrt y) t_1)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= (- t_1 (sqrt y)) 0.0005)
(+ t_3 (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) t_2))
(+ t_3 (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) (+ 1.0 t_2))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = 1.0 / (sqrt(y) + t_1);
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if ((t_1 - sqrt(y)) <= 0.0005) {
tmp = t_3 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + t_2);
} else {
tmp = t_3 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 + t_2));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = 1.0d0 / (sqrt(y) + t_1)
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if ((t_1 - sqrt(y)) <= 0.0005d0) then
tmp = t_3 + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + t_2)
else
tmp = t_3 + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (1.0d0 + t_2))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = 1.0 / (Math.sqrt(y) + t_1);
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if ((t_1 - Math.sqrt(y)) <= 0.0005) {
tmp = t_3 + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + t_2);
} else {
tmp = t_3 + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (1.0 + t_2));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = 1.0 / (math.sqrt(y) + t_1) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if (t_1 - math.sqrt(y)) <= 0.0005: tmp = t_3 + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + t_2) else: tmp = t_3 + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (1.0 + t_2)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = Float64(1.0 / Float64(sqrt(y) + t_1)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (Float64(t_1 - sqrt(y)) <= 0.0005) tmp = Float64(t_3 + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + t_2)); else tmp = Float64(t_3 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(1.0 + t_2))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = 1.0 / (sqrt(y) + t_1);
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if ((t_1 - sqrt(y)) <= 0.0005)
tmp = t_3 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + t_2);
else
tmp = t_3 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 + t_2));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 0.0005], N[(t$95$3 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + t$95$2), $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 := \frac{1}{\sqrt{y} + t_1}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t_1 - \sqrt{y} \leq 0.0005:\\
\;\;\;\;t_3 + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + t_2\right)\\
\mathbf{else}:\\
\;\;\;\;t_3 + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(1 + t_2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 5.0000000000000001e-4Initial program 86.2%
associate-+l+86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
flip--86.3%
add-sqr-sqrt68.1%
+-commutative68.1%
add-sqr-sqrt86.4%
+-commutative86.4%
Applied egg-rr86.4%
associate--l+89.8%
+-inverses89.8%
metadata-eval89.8%
Simplified89.8%
flip--89.8%
add-sqr-sqrt46.9%
add-sqr-sqrt90.2%
Applied egg-rr90.2%
associate--l+92.3%
+-inverses92.3%
metadata-eval92.3%
Simplified92.3%
Taylor expanded in z around inf 50.2%
+-commutative50.2%
Simplified50.2%
if 5.0000000000000001e-4 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) Initial program 97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
flip--97.0%
add-sqr-sqrt73.2%
+-commutative73.2%
add-sqr-sqrt97.2%
+-commutative97.2%
Applied egg-rr97.2%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified97.7%
flip--97.7%
add-sqr-sqrt97.7%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified97.7%
flip--97.0%
add-sqr-sqrt69.2%
add-sqr-sqrt97.3%
Applied egg-rr98.0%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified98.4%
Taylor expanded in x around 0 52.9%
associate-+r+52.9%
+-commutative52.9%
+-commutative52.9%
+-commutative52.9%
Simplified52.9%
Final simplification51.6%
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 z)) (sqrt z)))
(+
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))
(/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y))))))
(- (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((1.0 + z)) + sqrt(z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))))) + (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((1.0d0 + z)) + sqrt(z))) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))))) + (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((1.0 + z)) + Math.sqrt(z))) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)))))) + (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((1.0 + z)) + math.sqrt(z))) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (math.sqrt(y) + math.sqrt((1.0 + y)))))) + (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(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))))) + 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((1.0 + z)) + sqrt(z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))))) + (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[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right)\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)
\end{array}
Initial program 92.1%
associate-+l+92.1%
+-commutative92.1%
+-commutative92.1%
+-commutative92.1%
+-commutative92.1%
+-commutative92.1%
Simplified92.1%
flip--92.1%
add-sqr-sqrt70.9%
+-commutative70.9%
add-sqr-sqrt92.2%
+-commutative92.2%
Applied egg-rr92.2%
associate--l+94.1%
+-inverses94.1%
metadata-eval94.1%
Simplified94.1%
flip--94.1%
add-sqr-sqrt74.3%
add-sqr-sqrt94.3%
Applied egg-rr94.3%
associate--l+95.2%
+-inverses95.2%
metadata-eval95.2%
Simplified95.2%
flip--92.2%
add-sqr-sqrt68.0%
add-sqr-sqrt92.6%
Applied egg-rr95.7%
associate--l+93.9%
+-inverses93.9%
metadata-eval93.9%
Simplified96.9%
expm1-log1p-u96.4%
expm1-udef93.3%
Applied egg-rr93.3%
expm1-def96.4%
expm1-log1p96.9%
associate-+r+96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Final simplification96.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= z 9.5e-35)
(+ t_2 3.0)
(if (<= z 5.4e+16)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (+ (sqrt y) (sqrt z)))
(+ t_2 (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (- t_1 (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 + t)) - sqrt(t);
double tmp;
if (z <= 9.5e-35) {
tmp = t_2 + 3.0;
} else if (z <= 5.4e+16) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
} else {
tmp = t_2 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (t_1 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
if (z <= 9.5d-35) then
tmp = t_2 + 3.0d0
else if (z <= 5.4d+16) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - (sqrt(y) + sqrt(z))
else
tmp = t_2 + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (t_1 - 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 + t)) - Math.sqrt(t);
double tmp;
if (z <= 9.5e-35) {
tmp = t_2 + 3.0;
} else if (z <= 5.4e+16) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = t_2 + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (t_1 - 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 + t)) - math.sqrt(t) tmp = 0 if z <= 9.5e-35: tmp = t_2 + 3.0 elif z <= 5.4e+16: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - (math.sqrt(y) + math.sqrt(z)) else: tmp = t_2 + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (t_1 - 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 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (z <= 9.5e-35) tmp = Float64(t_2 + 3.0); elseif (z <= 5.4e+16) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(t_1 - 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 + t)) - sqrt(t);
tmp = 0.0;
if (z <= 9.5e-35)
tmp = t_2 + 3.0;
elseif (z <= 5.4e+16)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
else
tmp = t_2 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (t_1 - 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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 9.5e-35], N[(t$95$2 + 3.0), $MachinePrecision], If[LessEqual[z, 5.4e+16], 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[(t$95$2 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - 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 + t} - \sqrt{t}\\
\mathbf{if}\;z \leq 9.5 \cdot 10^{-35}:\\
\;\;\;\;t_2 + 3\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+16}:\\
\;\;\;\;\left(1 + \left(t_1 + \sqrt{1 + z}\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(t_1 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 9.5000000000000003e-35Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+l-97.9%
Simplified57.2%
Taylor expanded in x around 0 20.3%
associate--l+41.7%
associate-+r+41.7%
+-commutative41.7%
Simplified41.7%
Taylor expanded in z around 0 41.7%
associate-+r+41.7%
+-commutative41.7%
Simplified41.7%
Taylor expanded in y around 0 22.0%
associate--l+37.3%
Simplified37.3%
if 9.5000000000000003e-35 < z < 5.4e16Initial program 91.4%
+-commutative91.4%
associate-+r+91.4%
+-commutative91.4%
associate-+r+91.4%
associate-+r+91.4%
+-commutative91.4%
associate-+l-91.1%
Simplified54.7%
Taylor expanded in t around inf 25.9%
associate--l+31.2%
+-commutative31.2%
+-commutative31.2%
Simplified31.2%
Taylor expanded in x around 0 27.5%
+-commutative27.5%
associate--l+31.1%
Simplified31.1%
Taylor expanded in x around 0 32.4%
if 5.4e16 < z Initial program 87.2%
associate-+l+87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
flip--87.2%
add-sqr-sqrt69.3%
+-commutative69.3%
add-sqr-sqrt87.3%
+-commutative87.3%
Applied egg-rr87.3%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
Taylor expanded in z around inf 66.0%
+-commutative66.0%
+-commutative66.0%
associate-+r-90.9%
+-commutative90.9%
Simplified90.9%
Final simplification63.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 t)) (sqrt t))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 5.4e+16)
(+ (- (+ 1.0 (+ t_2 (sqrt (+ 1.0 z)))) (sqrt z)) (- t_1 (sqrt y)))
(+
t_1
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ (sqrt y) t_2)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 5.4e+16) {
tmp = ((1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z)) + (t_1 - sqrt(y));
} else {
tmp = t_1 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (sqrt(y) + t_2)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + y))
if (z <= 5.4d+16) then
tmp = ((1.0d0 + (t_2 + sqrt((1.0d0 + z)))) - sqrt(z)) + (t_1 - sqrt(y))
else
tmp = t_1 + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (sqrt(y) + t_2)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 5.4e+16) {
tmp = ((1.0 + (t_2 + Math.sqrt((1.0 + z)))) - Math.sqrt(z)) + (t_1 - Math.sqrt(y));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (Math.sqrt(y) + t_2)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 5.4e+16: tmp = ((1.0 + (t_2 + math.sqrt((1.0 + z)))) - math.sqrt(z)) + (t_1 - math.sqrt(y)) else: tmp = t_1 + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (math.sqrt(y) + t_2))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 5.4e+16) tmp = Float64(Float64(Float64(1.0 + Float64(t_2 + sqrt(Float64(1.0 + z)))) - sqrt(z)) + Float64(t_1 - sqrt(y))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(sqrt(y) + t_2)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 5.4e+16)
tmp = ((1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z)) + (t_1 - sqrt(y));
else
tmp = t_1 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (sqrt(y) + t_2)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 5.4e+16], N[(N[(N[(1.0 + N[(t$95$2 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + 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[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 5.4 \cdot 10^{+16}:\\
\;\;\;\;\left(\left(1 + \left(t_2 + \sqrt{1 + z}\right)\right) - \sqrt{z}\right) + \left(t_1 - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{\sqrt{y} + t_2}\right)\\
\end{array}
\end{array}
if z < 5.4e16Initial program 96.7%
+-commutative96.7%
associate-+r+96.7%
associate-+r-80.1%
associate-+l-70.7%
associate-+r-54.3%
Simplified54.2%
Taylor expanded in x around 0 33.1%
if 5.4e16 < z Initial program 87.2%
associate-+l+87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
flip--87.2%
add-sqr-sqrt69.3%
+-commutative69.3%
add-sqr-sqrt87.3%
+-commutative87.3%
Applied egg-rr87.3%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
flip--90.9%
add-sqr-sqrt72.4%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate--l+92.7%
+-inverses92.7%
metadata-eval92.7%
Simplified92.7%
Taylor expanded in z around inf 92.7%
+-commutative92.7%
Simplified92.7%
Final simplification62.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 6e+24)
(+ (+ (+ 1.0 t_2) (- (sqrt (+ 1.0 z)) (sqrt z))) (- t_1 (sqrt y)))
(+ t_1 (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (- t_2 (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 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 6e+24) {
tmp = ((1.0 + t_2) + (sqrt((1.0 + z)) - sqrt(z))) + (t_1 - sqrt(y));
} else {
tmp = t_1 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (t_2 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + y))
if (z <= 6d+24) then
tmp = ((1.0d0 + t_2) + (sqrt((1.0d0 + z)) - sqrt(z))) + (t_1 - sqrt(y))
else
tmp = t_1 + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (t_2 - 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 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 6e+24) {
tmp = ((1.0 + t_2) + (Math.sqrt((1.0 + z)) - Math.sqrt(z))) + (t_1 - Math.sqrt(y));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (t_2 - 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 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 6e+24: tmp = ((1.0 + t_2) + (math.sqrt((1.0 + z)) - math.sqrt(z))) + (t_1 - math.sqrt(y)) else: tmp = t_1 + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (t_2 - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 6e+24) tmp = Float64(Float64(Float64(1.0 + t_2) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) + Float64(t_1 - sqrt(y))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(t_2 - 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 + t)) - sqrt(t);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 6e+24)
tmp = ((1.0 + t_2) + (sqrt((1.0 + z)) - sqrt(z))) + (t_1 - sqrt(y));
else
tmp = t_1 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (t_2 - 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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 6e+24], N[(N[(N[(1.0 + t$95$2), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - 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 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 6 \cdot 10^{+24}:\\
\;\;\;\;\left(\left(1 + t_2\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(t_1 - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(t_2 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 5.9999999999999999e24Initial program 96.3%
+-commutative96.3%
associate-+r+96.3%
associate-+r-79.6%
associate-+l-70.3%
associate-+r-54.2%
Simplified54.2%
Taylor expanded in x around 0 33.1%
associate-+r+33.1%
associate--l+33.1%
Simplified33.1%
if 5.9999999999999999e24 < z Initial program 87.5%
associate-+l+87.5%
+-commutative87.5%
+-commutative87.5%
+-commutative87.5%
+-commutative87.5%
+-commutative87.5%
Simplified87.5%
flip--87.4%
add-sqr-sqrt69.7%
+-commutative69.7%
add-sqr-sqrt87.6%
+-commutative87.6%
Applied egg-rr87.6%
associate--l+91.3%
+-inverses91.3%
metadata-eval91.3%
Simplified91.3%
Taylor expanded in z around inf 66.2%
+-commutative66.2%
+-commutative66.2%
associate-+r-91.3%
+-commutative91.3%
Simplified91.3%
Final simplification60.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 t)) (sqrt t))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 6e+24)
(+ (- (+ 1.0 (+ t_2 (sqrt (+ 1.0 z)))) (sqrt z)) (- t_1 (sqrt y)))
(+ t_1 (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (- t_2 (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 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 6e+24) {
tmp = ((1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z)) + (t_1 - sqrt(y));
} else {
tmp = t_1 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (t_2 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + y))
if (z <= 6d+24) then
tmp = ((1.0d0 + (t_2 + sqrt((1.0d0 + z)))) - sqrt(z)) + (t_1 - sqrt(y))
else
tmp = t_1 + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (t_2 - 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 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 6e+24) {
tmp = ((1.0 + (t_2 + Math.sqrt((1.0 + z)))) - Math.sqrt(z)) + (t_1 - Math.sqrt(y));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (t_2 - 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 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 6e+24: tmp = ((1.0 + (t_2 + math.sqrt((1.0 + z)))) - math.sqrt(z)) + (t_1 - math.sqrt(y)) else: tmp = t_1 + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (t_2 - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 6e+24) tmp = Float64(Float64(Float64(1.0 + Float64(t_2 + sqrt(Float64(1.0 + z)))) - sqrt(z)) + Float64(t_1 - sqrt(y))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(t_2 - 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 + t)) - sqrt(t);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 6e+24)
tmp = ((1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z)) + (t_1 - sqrt(y));
else
tmp = t_1 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (t_2 - 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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 6e+24], N[(N[(N[(1.0 + N[(t$95$2 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - 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 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 6 \cdot 10^{+24}:\\
\;\;\;\;\left(\left(1 + \left(t_2 + \sqrt{1 + z}\right)\right) - \sqrt{z}\right) + \left(t_1 - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(t_2 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 5.9999999999999999e24Initial program 96.3%
+-commutative96.3%
associate-+r+96.3%
associate-+r-79.6%
associate-+l-70.3%
associate-+r-54.2%
Simplified54.2%
Taylor expanded in x around 0 33.1%
if 5.9999999999999999e24 < z Initial program 87.5%
associate-+l+87.5%
+-commutative87.5%
+-commutative87.5%
+-commutative87.5%
+-commutative87.5%
+-commutative87.5%
Simplified87.5%
flip--87.4%
add-sqr-sqrt69.7%
+-commutative69.7%
add-sqr-sqrt87.6%
+-commutative87.6%
Applied egg-rr87.6%
associate--l+91.3%
+-inverses91.3%
metadata-eval91.3%
Simplified91.3%
Taylor expanded in z around inf 66.2%
+-commutative66.2%
+-commutative66.2%
associate-+r-91.3%
+-commutative91.3%
Simplified91.3%
Final simplification60.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 8.5e-35)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 8e+14)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (+ (sqrt y) (sqrt z)))
(+ 1.0 (- t_1 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 8.5e-35) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 8e+14) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
} else {
tmp = 1.0 + (t_1 - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 8.5d-35) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 8d+14) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - (sqrt(y) + sqrt(z))
else
tmp = 1.0d0 + (t_1 - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 8.5e-35) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 8e+14) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = 1.0 + (t_1 - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 8.5e-35: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 8e+14: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - (math.sqrt(y) + math.sqrt(z)) else: tmp = 1.0 + (t_1 - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 8.5e-35) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 8e+14) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(1.0 + Float64(t_1 - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 8.5e-35)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 8e+14)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
else
tmp = 1.0 + (t_1 - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 8.5e-35], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 8e+14], 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[(1.0 + N[(t$95$1 - N[Sqrt[y], $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 8.5 \cdot 10^{-35}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+14}:\\
\;\;\;\;\left(1 + \left(t_1 + \sqrt{1 + z}\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(t_1 - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 8.5000000000000001e-35Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+l-97.9%
Simplified57.2%
Taylor expanded in x around 0 20.3%
associate--l+41.7%
associate-+r+41.7%
+-commutative41.7%
Simplified41.7%
Taylor expanded in z around 0 41.7%
associate-+r+41.7%
+-commutative41.7%
Simplified41.7%
Taylor expanded in y around 0 22.0%
associate--l+37.3%
Simplified37.3%
if 8.5000000000000001e-35 < z < 8e14Initial program 92.8%
+-commutative92.8%
associate-+r+92.8%
+-commutative92.8%
associate-+r+92.8%
associate-+r+92.8%
+-commutative92.8%
associate-+l-92.5%
Simplified57.1%
Taylor expanded in t around inf 27.0%
associate--l+32.3%
+-commutative32.3%
+-commutative32.3%
Simplified32.3%
Taylor expanded in x around 0 28.5%
+-commutative28.5%
associate--l+32.2%
Simplified32.2%
Taylor expanded in x around 0 33.7%
if 8e14 < z Initial program 87.0%
+-commutative87.0%
associate-+r+87.0%
+-commutative87.0%
associate-+r+87.0%
associate-+r+87.0%
+-commutative87.0%
associate-+l-47.6%
Simplified4.0%
Taylor expanded in t around inf 3.3%
associate--l+20.6%
+-commutative20.6%
+-commutative20.6%
Simplified20.6%
Taylor expanded in z around inf 30.7%
+-commutative30.7%
Simplified30.7%
Taylor expanded in x around 0 28.2%
associate--l+48.5%
Simplified48.5%
Final simplification42.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 (<= z 1.2e-34)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 4.4e+14)
(+ (sqrt (+ 1.0 x)) (- (+ 1.0 (sqrt (+ 1.0 z))) (sqrt z)))
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.2e-34) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 4.4e+14) {
tmp = sqrt((1.0 + x)) + ((1.0 + sqrt((1.0 + z))) - sqrt(z));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.2d-34) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 4.4d+14) then
tmp = sqrt((1.0d0 + x)) + ((1.0d0 + sqrt((1.0d0 + z))) - sqrt(z))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.2e-34) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 4.4e+14) {
tmp = Math.sqrt((1.0 + x)) + ((1.0 + Math.sqrt((1.0 + z))) - Math.sqrt(z));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1.2e-34: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 4.4e+14: tmp = math.sqrt((1.0 + x)) + ((1.0 + math.sqrt((1.0 + z))) - math.sqrt(z)) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1.2e-34) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 4.4e+14) tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(1.0 + sqrt(Float64(1.0 + z))) - sqrt(z))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 1.2e-34)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 4.4e+14)
tmp = sqrt((1.0 + x)) + ((1.0 + sqrt((1.0 + z))) - sqrt(z));
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1.2e-34], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 4.4e+14], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.2 \cdot 10^{-34}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+14}:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(1 + \sqrt{1 + z}\right) - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.19999999999999996e-34Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+l-97.9%
Simplified57.2%
Taylor expanded in x around 0 20.3%
associate--l+41.7%
associate-+r+41.7%
+-commutative41.7%
Simplified41.7%
Taylor expanded in z around 0 41.7%
associate-+r+41.7%
+-commutative41.7%
Simplified41.7%
Taylor expanded in y around 0 22.0%
associate--l+37.3%
Simplified37.3%
if 1.19999999999999996e-34 < z < 4.4e14Initial program 92.8%
+-commutative92.8%
associate-+r+92.8%
+-commutative92.8%
associate-+r+92.8%
associate-+r+92.8%
+-commutative92.8%
associate-+l-92.5%
Simplified57.1%
Taylor expanded in t around inf 27.0%
associate--l+32.3%
+-commutative32.3%
+-commutative32.3%
Simplified32.3%
Taylor expanded in x around 0 28.5%
+-commutative28.5%
associate--l+32.2%
Simplified32.2%
Taylor expanded in y around 0 29.6%
if 4.4e14 < z Initial program 87.0%
+-commutative87.0%
associate-+r+87.0%
+-commutative87.0%
associate-+r+87.0%
associate-+r+87.0%
+-commutative87.0%
associate-+l-47.6%
Simplified4.0%
Taylor expanded in t around inf 3.3%
associate--l+20.6%
+-commutative20.6%
+-commutative20.6%
Simplified20.6%
Taylor expanded in z around inf 30.7%
+-commutative30.7%
Simplified30.7%
Taylor expanded in x around 0 28.2%
associate--l+48.5%
Simplified48.5%
Final simplification42.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 1.2e-34)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 4.4e+14)
(- (+ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt (+ 1.0 z)))) (sqrt z))
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.2e-34) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 4.4e+14) {
tmp = (1.0 + (sqrt((1.0 + x)) + sqrt((1.0 + z)))) - sqrt(z);
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.2d-34) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 4.4d+14) then
tmp = (1.0d0 + (sqrt((1.0d0 + x)) + sqrt((1.0d0 + z)))) - sqrt(z)
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.2e-34) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 4.4e+14) {
tmp = (1.0 + (Math.sqrt((1.0 + x)) + Math.sqrt((1.0 + z)))) - Math.sqrt(z);
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1.2e-34: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 4.4e+14: tmp = (1.0 + (math.sqrt((1.0 + x)) + math.sqrt((1.0 + z)))) - math.sqrt(z) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1.2e-34) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 4.4e+14) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + x)) + sqrt(Float64(1.0 + z)))) - sqrt(z)); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 1.2e-34)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 4.4e+14)
tmp = (1.0 + (sqrt((1.0 + x)) + sqrt((1.0 + z)))) - sqrt(z);
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1.2e-34], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 4.4e+14], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.2 \cdot 10^{-34}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+14}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + x} + \sqrt{1 + z}\right)\right) - \sqrt{z}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.19999999999999996e-34Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+l-97.9%
Simplified57.2%
Taylor expanded in x around 0 20.3%
associate--l+41.7%
associate-+r+41.7%
+-commutative41.7%
Simplified41.7%
Taylor expanded in z around 0 41.7%
associate-+r+41.7%
+-commutative41.7%
Simplified41.7%
Taylor expanded in y around 0 22.0%
associate--l+37.3%
Simplified37.3%
if 1.19999999999999996e-34 < z < 4.4e14Initial program 92.8%
+-commutative92.8%
associate-+r+92.8%
+-commutative92.8%
associate-+r+92.8%
associate-+r+92.8%
+-commutative92.8%
associate-+l-92.5%
Simplified57.1%
Taylor expanded in t around inf 27.0%
associate--l+32.3%
+-commutative32.3%
+-commutative32.3%
Simplified32.3%
Taylor expanded in x around 0 28.5%
+-commutative28.5%
associate--l+32.2%
Simplified32.2%
Taylor expanded in y around 0 29.6%
+-commutative29.6%
Simplified29.6%
if 4.4e14 < z Initial program 87.0%
+-commutative87.0%
associate-+r+87.0%
+-commutative87.0%
associate-+r+87.0%
associate-+r+87.0%
+-commutative87.0%
associate-+l-47.6%
Simplified4.0%
Taylor expanded in t around inf 3.3%
associate--l+20.6%
+-commutative20.6%
+-commutative20.6%
Simplified20.6%
Taylor expanded in z around inf 30.7%
+-commutative30.7%
Simplified30.7%
Taylor expanded in x around 0 28.2%
associate--l+48.5%
Simplified48.5%
Final simplification42.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (- (sqrt (+ 1.0 x)) (sqrt x)))) (if (<= y 0.68) (+ 1.0 t_1) t_1)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x)) - sqrt(x);
double tmp;
if (y <= 0.68) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x)) - sqrt(x)
if (y <= 0.68d0) then
tmp = 1.0d0 + t_1
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x)) - Math.sqrt(x);
double tmp;
if (y <= 0.68) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) - math.sqrt(x) tmp = 0 if y <= 0.68: tmp = 1.0 + t_1 else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) tmp = 0.0 if (y <= 0.68) tmp = Float64(1.0 + t_1); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x)) - sqrt(x);
tmp = 0.0;
if (y <= 0.68)
tmp = 1.0 + t_1;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 0.68], N[(1.0 + t$95$1), $MachinePrecision], t$95$1]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x} - \sqrt{x}\\
\mathbf{if}\;y \leq 0.68:\\
\;\;\;\;1 + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < 0.680000000000000049Initial program 97.0%
+-commutative97.0%
associate-+r+97.0%
+-commutative97.0%
associate-+r+97.0%
associate-+r+97.0%
+-commutative97.0%
associate-+l-79.1%
Simplified51.1%
Taylor expanded in t around inf 18.2%
associate--l+22.0%
+-commutative22.0%
+-commutative22.0%
Simplified22.0%
Taylor expanded in z around inf 21.8%
+-commutative21.8%
Simplified21.8%
Taylor expanded in y around 0 21.8%
associate--l+40.8%
Simplified40.8%
if 0.680000000000000049 < y Initial program 86.6%
+-commutative86.6%
associate-+r+86.7%
+-commutative86.7%
associate-+r+86.7%
associate-+r+86.6%
+-commutative86.6%
associate-+l-65.6%
Simplified8.9%
Taylor expanded in t around inf 3.9%
associate--l+21.4%
+-commutative21.4%
+-commutative21.4%
Simplified21.4%
Taylor expanded in z around inf 20.8%
+-commutative20.8%
Simplified20.8%
Taylor expanded in y around inf 20.4%
Final simplification31.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 0.46) (+ (- (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.46) {
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.46d0) 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.46) {
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.46: 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.46) 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.46)
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.46], 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.46:\\
\;\;\;\;\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.46000000000000002Initial program 97.7%
+-commutative97.7%
associate-+r+97.7%
+-commutative97.7%
associate-+r+97.7%
associate-+r+97.7%
+-commutative97.7%
associate-+l-97.7%
Simplified58.0%
Taylor expanded in x around 0 20.1%
associate--l+40.4%
associate-+r+40.4%
+-commutative40.4%
Simplified40.4%
Taylor expanded in z around 0 39.6%
associate-+r+39.6%
+-commutative39.6%
Simplified39.6%
Taylor expanded in y around 0 21.0%
associate--l+36.2%
Simplified36.2%
if 0.46000000000000002 < z Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r+86.8%
+-commutative86.8%
associate-+l-49.1%
Simplified5.6%
Taylor expanded in t around inf 4.3%
associate--l+21.4%
+-commutative21.4%
+-commutative21.4%
Simplified21.4%
Taylor expanded in z around inf 30.8%
+-commutative30.8%
Simplified30.8%
Taylor expanded in x around 0 28.0%
associate--l+47.9%
Simplified47.9%
Final simplification42.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 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 92.1%
+-commutative92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+r+92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+l-72.7%
Simplified31.0%
Taylor expanded in t around inf 11.4%
associate--l+21.7%
+-commutative21.7%
+-commutative21.7%
Simplified21.7%
Taylor expanded in z around inf 21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in x around 0 26.4%
associate--l+44.4%
Simplified44.4%
Final simplification44.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 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 92.1%
+-commutative92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+r+92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+l-72.7%
Simplified31.0%
Taylor expanded in t around inf 11.4%
associate--l+21.7%
+-commutative21.7%
+-commutative21.7%
Simplified21.7%
Taylor expanded in z around inf 21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in y around inf 15.2%
Final simplification15.2%
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 92.1%
+-commutative92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+r+92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+l-72.7%
Simplified31.0%
Taylor expanded in t around inf 11.4%
associate--l+21.7%
+-commutative21.7%
+-commutative21.7%
Simplified21.7%
Taylor expanded in z around inf 21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in y around inf 15.2%
Taylor expanded in x around 0 15.9%
*-commutative15.9%
Simplified15.9%
Final simplification15.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
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 92.1%
+-commutative92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+r+92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+l-72.7%
Simplified31.0%
Taylor expanded in t around inf 11.4%
associate--l+21.7%
+-commutative21.7%
+-commutative21.7%
Simplified21.7%
Taylor expanded in z around inf 21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in y around inf 15.2%
Taylor expanded in x around 0 36.4%
Final simplification36.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 2024011
(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))))