
(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 20 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 (+ y 1.0)) (sqrt y)))
(t_2 (+ (sqrt (+ 1.0 t)) (sqrt t)))
(t_3 (sqrt (+ 1.0 z)))
(t_4 (+ t_3 (sqrt z))))
(if (<= t_1 2e-5)
(+
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))
(- t_3 (sqrt z)))
(+
(+ (- 1.0 (sqrt x)) t_1)
(/ (+ (* (+ t (- 1.0 t)) t_4) (* t_2 (+ 1.0 (- z z)))) (* t_4 t_2))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + t)) + sqrt(t);
double t_3 = sqrt((1.0 + z));
double t_4 = t_3 + sqrt(z);
double tmp;
if (t_1 <= 2e-5) {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + (t_3 - sqrt(z));
} else {
tmp = ((1.0 - sqrt(x)) + t_1) + ((((t + (1.0 - t)) * t_4) + (t_2 * (1.0 + (z - z)))) / (t_4 * 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) :: t_4
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + t)) + sqrt(t)
t_3 = sqrt((1.0d0 + z))
t_4 = t_3 + sqrt(z)
if (t_1 <= 2d-5) then
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))) + (t_3 - sqrt(z))
else
tmp = ((1.0d0 - sqrt(x)) + t_1) + ((((t + (1.0d0 - t)) * t_4) + (t_2 * (1.0d0 + (z - z)))) / (t_4 * 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((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + t)) + Math.sqrt(t);
double t_3 = Math.sqrt((1.0 + z));
double t_4 = t_3 + Math.sqrt(z);
double tmp;
if (t_1 <= 2e-5) {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)))) + (t_3 - Math.sqrt(z));
} else {
tmp = ((1.0 - Math.sqrt(x)) + t_1) + ((((t + (1.0 - t)) * t_4) + (t_2 * (1.0 + (z - z)))) / (t_4 * t_2));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + t)) + math.sqrt(t) t_3 = math.sqrt((1.0 + z)) t_4 = t_3 + math.sqrt(z) tmp = 0 if t_1 <= 2e-5: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y)))) + (t_3 - math.sqrt(z)) else: tmp = ((1.0 - math.sqrt(x)) + t_1) + ((((t + (1.0 - t)) * t_4) + (t_2 * (1.0 + (z - z)))) / (t_4 * t_2)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = Float64(sqrt(Float64(1.0 + t)) + sqrt(t)) t_3 = sqrt(Float64(1.0 + z)) t_4 = Float64(t_3 + sqrt(z)) tmp = 0.0 if (t_1 <= 2e-5) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(t_3 - sqrt(z))); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + t_1) + Float64(Float64(Float64(Float64(t + Float64(1.0 - t)) * t_4) + Float64(t_2 * Float64(1.0 + Float64(z - z)))) / Float64(t_4 * 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((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + t)) + sqrt(t);
t_3 = sqrt((1.0 + z));
t_4 = t_3 + sqrt(z);
tmp = 0.0;
if (t_1 <= 2e-5)
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + (t_3 - sqrt(z));
else
tmp = ((1.0 - sqrt(x)) + t_1) + ((((t + (1.0 - t)) * t_4) + (t_2 * (1.0 + (z - z)))) / (t_4 * 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[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-5], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(N[(N[(N[(t + N[(1.0 - t), $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision] + N[(t$95$2 * N[(1.0 + N[(z - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$4 * 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{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + t} + \sqrt{t}\\
t_3 := \sqrt{1 + z}\\
t_4 := t\_3 + \sqrt{z}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(t\_3 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + t\_1\right) + \frac{\left(t + \left(1 - t\right)\right) \cdot t\_4 + t\_2 \cdot \left(1 + \left(z - z\right)\right)}{t\_4 \cdot t\_2}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 2.00000000000000016e-5Initial program 88.6%
associate-+l+88.6%
sub-neg88.6%
sub-neg88.6%
+-commutative88.6%
+-commutative88.6%
+-commutative88.6%
Simplified88.6%
flip--88.6%
div-inv88.6%
add-sqr-sqrt72.0%
+-commutative72.0%
add-sqr-sqrt88.7%
+-commutative88.7%
Applied egg-rr88.7%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
*-lft-identity90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in y around inf 93.1%
Taylor expanded in t around inf 49.2%
if 2.00000000000000016e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.3%
associate-+l+96.3%
sub-neg96.3%
sub-neg96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 53.1%
+-commutative53.1%
flip--53.2%
+-commutative53.2%
flip--53.3%
frac-add53.2%
Applied egg-rr54.1%
Final simplification51.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 (+ y 1.0)) (sqrt y))) (t_2 (sqrt (+ 1.0 z))))
(if (<= t_1 2e-5)
(+
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))
(- t_2 (sqrt z)))
(+
(+ (- 1.0 (sqrt x)) t_1)
(+ (/ 1.0 (+ t_2 (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) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + z));
double tmp;
if (t_1 <= 2e-5) {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + (t_2 - sqrt(z));
} else {
tmp = ((1.0 - sqrt(x)) + t_1) + ((1.0 / (t_2 + sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + z))
if (t_1 <= 2d-5) then
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))) + (t_2 - sqrt(z))
else
tmp = ((1.0d0 - sqrt(x)) + t_1) + ((1.0d0 / (t_2 + sqrt(z))) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if (t_1 <= 2e-5) {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)))) + (t_2 - Math.sqrt(z));
} else {
tmp = ((1.0 - Math.sqrt(x)) + t_1) + ((1.0 / (t_2 + Math.sqrt(z))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + z)) tmp = 0 if t_1 <= 2e-5: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y)))) + (t_2 - math.sqrt(z)) else: tmp = ((1.0 - math.sqrt(x)) + t_1) + ((1.0 / (t_2 + math.sqrt(z))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t_1 <= 2e-5) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(t_2 - sqrt(z))); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + t_1) + Float64(Float64(1.0 / Float64(t_2 + sqrt(z))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + z));
tmp = 0.0;
if (t_1 <= 2e-5)
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + (t_2 - sqrt(z));
else
tmp = ((1.0 - sqrt(x)) + t_1) + ((1.0 / (t_2 + sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 2e-5], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(t\_2 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + t\_1\right) + \left(\frac{1}{t\_2 + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 2.00000000000000016e-5Initial program 88.6%
associate-+l+88.6%
sub-neg88.6%
sub-neg88.6%
+-commutative88.6%
+-commutative88.6%
+-commutative88.6%
Simplified88.6%
flip--88.6%
div-inv88.6%
add-sqr-sqrt72.0%
+-commutative72.0%
add-sqr-sqrt88.7%
+-commutative88.7%
Applied egg-rr88.7%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
*-lft-identity90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in y around inf 93.1%
Taylor expanded in t around inf 49.2%
if 2.00000000000000016e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.3%
associate-+l+96.3%
sub-neg96.3%
sub-neg96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 53.1%
flip--53.2%
div-inv53.2%
add-sqr-sqrt43.0%
add-sqr-sqrt53.5%
associate--l+53.8%
Applied egg-rr53.8%
+-inverses53.8%
metadata-eval53.8%
*-lft-identity53.8%
+-commutative53.8%
Simplified53.8%
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
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 102000000.0)
(+
(+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y)))
(+ t_1 (- (sqrt (+ 1.0 t)) (sqrt t))))
(+
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 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 <= 102000000.0) {
tmp = ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (t_1 + (sqrt((1.0 + t)) - sqrt(t)));
} else {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / 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 <= 102000000.0d0) then
tmp = ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (t_1 + (sqrt((1.0d0 + t)) - sqrt(t)))
else
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / 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 <= 102000000.0) {
tmp = ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (t_1 + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
} else {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / 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 <= 102000000.0: tmp = ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (t_1 + (math.sqrt((1.0 + t)) - math.sqrt(t))) else: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / 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 <= 102000000.0) tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(t_1 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / 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 <= 102000000.0)
tmp = ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (t_1 + (sqrt((1.0 + t)) - sqrt(t)));
else
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / 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, 102000000.0], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;y \leq 102000000:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(t\_1 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + t\_1\\
\end{array}
\end{array}
if y < 1.02e8Initial program 96.3%
associate-+l+96.3%
sub-neg96.3%
sub-neg96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 53.1%
if 1.02e8 < y Initial program 88.6%
associate-+l+88.6%
sub-neg88.6%
sub-neg88.6%
+-commutative88.6%
+-commutative88.6%
+-commutative88.6%
Simplified88.6%
flip--88.6%
div-inv88.6%
add-sqr-sqrt72.0%
+-commutative72.0%
add-sqr-sqrt88.7%
+-commutative88.7%
Applied egg-rr88.7%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
*-lft-identity90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in y around inf 93.1%
Taylor expanded in t around inf 49.2%
Final simplification51.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (sqrt x))) (t_2 (sqrt (+ 1.0 z))) (t_3 (- t_2 (sqrt z))))
(if (<= y 3.1e-69)
(+
(+ t_3 (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ t_1 (+ 1.0 (- (* y 0.5) (sqrt y)))))
(if (<= y 80000000.0)
(+ (+ t_1 (- (sqrt (+ y 1.0)) (sqrt y))) (/ 1.0 (+ t_2 (sqrt z))))
(+
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))
t_3)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - sqrt(x);
double t_2 = sqrt((1.0 + z));
double t_3 = t_2 - sqrt(z);
double tmp;
if (y <= 3.1e-69) {
tmp = (t_3 + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + (1.0 + ((y * 0.5) - sqrt(y))));
} else if (y <= 80000000.0) {
tmp = (t_1 + (sqrt((y + 1.0)) - sqrt(y))) + (1.0 / (t_2 + sqrt(z)));
} else {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + t_3;
}
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 = 1.0d0 - sqrt(x)
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
if (y <= 3.1d-69) then
tmp = (t_3 + (sqrt((1.0d0 + t)) - sqrt(t))) + (t_1 + (1.0d0 + ((y * 0.5d0) - sqrt(y))))
else if (y <= 80000000.0d0) then
tmp = (t_1 + (sqrt((y + 1.0d0)) - sqrt(y))) + (1.0d0 / (t_2 + sqrt(z)))
else
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))) + t_3
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + z));
double t_3 = t_2 - Math.sqrt(z);
double tmp;
if (y <= 3.1e-69) {
tmp = (t_3 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (t_1 + (1.0 + ((y * 0.5) - Math.sqrt(y))));
} else if (y <= 80000000.0) {
tmp = (t_1 + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (1.0 / (t_2 + Math.sqrt(z)));
} else {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)))) + t_3;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 - math.sqrt(x) t_2 = math.sqrt((1.0 + z)) t_3 = t_2 - math.sqrt(z) tmp = 0 if y <= 3.1e-69: tmp = (t_3 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (t_1 + (1.0 + ((y * 0.5) - math.sqrt(y)))) elif y <= 80000000.0: tmp = (t_1 + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (1.0 / (t_2 + math.sqrt(z))) else: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y)))) + t_3 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - sqrt(x)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(t_2 - sqrt(z)) tmp = 0.0 if (y <= 3.1e-69) tmp = Float64(Float64(t_3 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(t_1 + Float64(1.0 + Float64(Float64(y * 0.5) - sqrt(y))))); elseif (y <= 80000000.0) tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(1.0 / Float64(t_2 + sqrt(z)))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + t_3); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 - sqrt(x);
t_2 = sqrt((1.0 + z));
t_3 = t_2 - sqrt(z);
tmp = 0.0;
if (y <= 3.1e-69)
tmp = (t_3 + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + (1.0 + ((y * 0.5) - sqrt(y))));
elseif (y <= 80000000.0)
tmp = (t_1 + (sqrt((y + 1.0)) - sqrt(y))) + (1.0 / (t_2 + sqrt(z)));
else
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + t_3;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[Sqrt[x], $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]}, If[LessEqual[y, 3.1e-69], N[(N[(t$95$3 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 + N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 80000000.0], N[(N[(t$95$1 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 1 - \sqrt{x}\\
t_2 := \sqrt{1 + z}\\
t_3 := t\_2 - \sqrt{z}\\
\mathbf{if}\;y \leq 3.1 \cdot 10^{-69}:\\
\;\;\;\;\left(t\_3 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(t\_1 + \left(1 + \left(y \cdot 0.5 - \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;y \leq 80000000:\\
\;\;\;\;\left(t\_1 + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \frac{1}{t\_2 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + t\_3\\
\end{array}
\end{array}
if y < 3.0999999999999999e-69Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 54.1%
Taylor expanded in y around 0 54.1%
associate--l+54.1%
Simplified54.1%
if 3.0999999999999999e-69 < y < 8e7Initial program 94.5%
associate-+l+94.5%
sub-neg94.5%
sub-neg94.5%
+-commutative94.5%
+-commutative94.5%
+-commutative94.5%
Simplified94.5%
Taylor expanded in x around 0 50.0%
+-commutative50.0%
flip--50.4%
+-commutative50.4%
flip--50.8%
frac-add50.8%
Applied egg-rr51.4%
Taylor expanded in t around inf 32.4%
if 8e7 < y Initial program 88.6%
associate-+l+88.6%
sub-neg88.6%
sub-neg88.6%
+-commutative88.6%
+-commutative88.6%
+-commutative88.6%
Simplified88.6%
flip--88.6%
div-inv88.6%
add-sqr-sqrt72.0%
+-commutative72.0%
add-sqr-sqrt88.7%
+-commutative88.7%
Applied egg-rr88.7%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
*-lft-identity90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in y around inf 93.1%
Taylor expanded in t around inf 49.2%
Final simplification49.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 (+ y 1.0)) (sqrt y))))
(if (<= t 5e+16)
(+
(+ (- 1.0 (sqrt x)) t_1)
(- (+ (sqrt (+ 1.0 t)) (- 1.0 (sqrt t))) (sqrt z)))
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double tmp;
if (t <= 5e+16) {
tmp = ((1.0 - sqrt(x)) + t_1) + ((sqrt((1.0 + t)) + (1.0 - sqrt(t))) - sqrt(z));
} else {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + 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((y + 1.0d0)) - sqrt(y)
if (t <= 5d+16) then
tmp = ((1.0d0 - sqrt(x)) + t_1) + ((sqrt((1.0d0 + t)) + (1.0d0 - sqrt(t))) - sqrt(z))
else
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + 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((y + 1.0)) - Math.sqrt(y);
double tmp;
if (t <= 5e+16) {
tmp = ((1.0 - Math.sqrt(x)) + t_1) + ((Math.sqrt((1.0 + t)) + (1.0 - Math.sqrt(t))) - Math.sqrt(z));
} else {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) tmp = 0 if t <= 5e+16: tmp = ((1.0 - math.sqrt(x)) + t_1) + ((math.sqrt((1.0 + t)) + (1.0 - math.sqrt(t))) - math.sqrt(z)) else: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) tmp = 0.0 if (t <= 5e+16) tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + t_1) + Float64(Float64(sqrt(Float64(1.0 + t)) + Float64(1.0 - sqrt(t))) - sqrt(z))); else tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + 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((y + 1.0)) - sqrt(y);
tmp = 0.0;
if (t <= 5e+16)
tmp = ((1.0 - sqrt(x)) + t_1) + ((sqrt((1.0 + t)) + (1.0 - sqrt(t))) - sqrt(z));
else
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + 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[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 5e+16], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $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{y + 1} - \sqrt{y}\\
\mathbf{if}\;t \leq 5 \cdot 10^{+16}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + t\_1\right) + \left(\left(\sqrt{1 + t} + \left(1 - \sqrt{t}\right)\right) - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + t\_1\right)\\
\end{array}
\end{array}
if t < 5e16Initial program 95.4%
associate-+l+95.4%
sub-neg95.4%
sub-neg95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in x around 0 51.3%
Taylor expanded in z around 0 26.0%
associate--r+26.1%
+-commutative26.1%
associate--l+26.1%
Simplified26.1%
if 5e16 < t Initial program 89.6%
associate-+l+89.6%
sub-neg89.6%
sub-neg89.6%
+-commutative89.6%
+-commutative89.6%
+-commutative89.6%
Simplified89.6%
flip--89.7%
div-inv89.7%
add-sqr-sqrt73.3%
+-commutative73.3%
add-sqr-sqrt89.8%
+-commutative89.8%
Applied egg-rr89.8%
associate--l+91.7%
+-inverses91.7%
metadata-eval91.7%
*-lft-identity91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in t around inf 91.7%
Final simplification57.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 z))))
(if (<= y 52000000.0)
(+
(+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y)))
(/ 1.0 (+ t_1 (sqrt z))))
(+
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))
(- t_1 (sqrt z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (y <= 52000000.0) {
tmp = ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (1.0 / (t_1 + sqrt(z)));
} else {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + (t_1 - sqrt(z));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (y <= 52000000.0d0) then
tmp = ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (1.0d0 / (t_1 + sqrt(z)))
else
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))) + (t_1 - sqrt(z))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 52000000.0) {
tmp = ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (1.0 / (t_1 + Math.sqrt(z)));
} else {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)))) + (t_1 - Math.sqrt(z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if y <= 52000000.0: tmp = ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (1.0 / (t_1 + math.sqrt(z))) else: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y)))) + (t_1 - math.sqrt(z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 52000000.0) tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(1.0 / Float64(t_1 + sqrt(z)))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(t_1 - sqrt(z))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 52000000.0)
tmp = ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (1.0 / (t_1 + sqrt(z)));
else
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + (t_1 - sqrt(z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 52000000.0], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 52000000:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \frac{1}{t\_1 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(t\_1 - \sqrt{z}\right)\\
\end{array}
\end{array}
if y < 5.2e7Initial program 96.3%
associate-+l+96.3%
sub-neg96.3%
sub-neg96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 53.1%
+-commutative53.1%
flip--53.2%
+-commutative53.2%
flip--53.3%
frac-add53.2%
Applied egg-rr54.1%
Taylor expanded in t around inf 33.8%
if 5.2e7 < y Initial program 88.6%
associate-+l+88.6%
sub-neg88.6%
sub-neg88.6%
+-commutative88.6%
+-commutative88.6%
+-commutative88.6%
Simplified88.6%
flip--88.6%
div-inv88.6%
add-sqr-sqrt72.0%
+-commutative72.0%
add-sqr-sqrt88.7%
+-commutative88.7%
Applied egg-rr88.7%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
*-lft-identity90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in y around inf 93.1%
Taylor expanded in t around inf 49.2%
Final simplification41.1%
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 (+ y 1.0)) (sqrt y))) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}
\end{array}
Initial program 92.6%
associate-+l+92.6%
sub-neg92.6%
sub-neg92.6%
+-commutative92.6%
+-commutative92.6%
+-commutative92.6%
Simplified92.6%
Taylor expanded in x around 0 50.2%
+-commutative50.2%
flip--50.2%
+-commutative50.2%
flip--50.2%
frac-add50.2%
Applied egg-rr51.1%
Taylor expanded in t around inf 29.8%
Final simplification29.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)
\end{array}
Initial program 92.6%
associate-+l+92.6%
sub-neg92.6%
sub-neg92.6%
+-commutative92.6%
+-commutative92.6%
+-commutative92.6%
Simplified92.6%
Taylor expanded in x around 0 50.2%
Taylor expanded in t around inf 29.7%
Final simplification29.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 0.0022)
(+
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))
(+ (- 1.0 (sqrt x)) (+ 1.0 (- (* y (+ 0.5 (* y -0.125))) (sqrt y)))))
(+ 1.0 (- (hypot 1.0 (sqrt y)) (+ (sqrt y) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.0022) {
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + ((1.0 - sqrt(x)) + (1.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))));
} else {
tmp = 1.0 + (hypot(1.0, sqrt(y)) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.0022) {
tmp = (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + ((1.0 - Math.sqrt(x)) + (1.0 + ((y * (0.5 + (y * -0.125))) - Math.sqrt(y))));
} else {
tmp = 1.0 + (Math.hypot(1.0, Math.sqrt(y)) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.0022: tmp = (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + ((1.0 - math.sqrt(x)) + (1.0 + ((y * (0.5 + (y * -0.125))) - math.sqrt(y)))) else: tmp = 1.0 + (math.hypot(1.0, math.sqrt(y)) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.0022) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 + Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) - sqrt(y))))); else tmp = Float64(1.0 + Float64(hypot(1.0, sqrt(y)) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 0.0022)
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + ((1.0 - sqrt(x)) + (1.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))));
else
tmp = 1.0 + (hypot(1.0, sqrt(y)) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 0.0022], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.0022:\\
\;\;\;\;\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\left(1 - \sqrt{x}\right) + \left(1 + \left(y \cdot \left(0.5 + y \cdot -0.125\right) - \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if y < 0.00220000000000000013Initial program 96.6%
associate-+l+96.6%
sub-neg96.6%
sub-neg96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 53.6%
Taylor expanded in t around inf 34.2%
Taylor expanded in y around 0 34.2%
associate--l+34.2%
Simplified34.2%
flip--53.7%
div-inv53.7%
add-sqr-sqrt43.2%
add-sqr-sqrt54.0%
associate--l+54.3%
Applied egg-rr34.4%
+-inverses54.3%
metadata-eval54.3%
*-lft-identity54.3%
+-commutative54.3%
Simplified34.4%
if 0.00220000000000000013 < y Initial program 88.5%
associate-+l+88.5%
sub-neg88.5%
sub-neg88.5%
+-commutative88.5%
+-commutative88.5%
+-commutative88.5%
Simplified88.5%
Taylor expanded in x around 0 46.6%
Taylor expanded in t around inf 25.0%
Taylor expanded in z around inf 3.1%
associate--l+29.3%
metadata-eval29.3%
rem-square-sqrt29.3%
hypot-undefine29.3%
Simplified29.3%
Final simplification31.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 6800000.0)
(- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
(+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y)))
(* 0.5 (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6800000.0) {
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (0.5 * sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 6800000.0d0) then
tmp = (sqrt((1.0d0 + z)) + 2.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (0.5d0 * sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6800000.0) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 6800000.0: tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 6800000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 6800000.0)
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (0.5 * sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 6800000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6800000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if z < 6.8e6Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in x around 0 47.5%
Taylor expanded in t around inf 27.8%
Taylor expanded in y around 0 15.7%
if 6.8e6 < z Initial program 88.1%
associate-+l+88.1%
sub-neg88.1%
sub-neg88.1%
+-commutative88.1%
+-commutative88.1%
+-commutative88.1%
Simplified88.1%
Taylor expanded in x around 0 53.2%
Taylor expanded in t around inf 31.9%
Taylor expanded in z around inf 32.0%
Final simplification23.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 (<= z 2650000000000.0) (- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z)))) (+ 1.0 (- (hypot 1.0 (sqrt y)) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2650000000000.0) {
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = 1.0 + (hypot(1.0, sqrt(y)) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2650000000000.0) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 1.0 + (Math.hypot(1.0, Math.sqrt(y)) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 2650000000000.0: tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = 1.0 + (math.hypot(1.0, math.sqrt(y)) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 2650000000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(1.0 + Float64(hypot(1.0, sqrt(y)) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 2650000000000.0)
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = 1.0 + (hypot(1.0, sqrt(y)) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 2650000000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2650000000000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 2.65e12Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in x around 0 48.0%
Taylor expanded in t around inf 27.9%
Taylor expanded in y around 0 16.1%
if 2.65e12 < z Initial program 88.2%
associate-+l+88.2%
sub-neg88.2%
sub-neg88.2%
+-commutative88.2%
+-commutative88.2%
+-commutative88.2%
Simplified88.2%
Taylor expanded in x around 0 52.8%
Taylor expanded in t around inf 31.8%
Taylor expanded in z around inf 21.1%
associate--l+36.1%
metadata-eval36.1%
rem-square-sqrt36.1%
hypot-undefine36.1%
Simplified36.1%
Final simplification25.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 y) (sqrt x))))
(if (<= z 11500000000000.0)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) t_1)))
(+ 1.0 (- (hypot 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(y) + sqrt(x);
double tmp;
if (z <= 11500000000000.0) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
} else {
tmp = 1.0 + (hypot(1.0, sqrt(y)) - t_1);
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(y) + Math.sqrt(x);
double tmp;
if (z <= 11500000000000.0) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + t_1));
} else {
tmp = 1.0 + (Math.hypot(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(y) + math.sqrt(x) tmp = 0 if z <= 11500000000000.0: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + t_1)) else: tmp = 1.0 + (math.hypot(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 = Float64(sqrt(y) + sqrt(x)) tmp = 0.0 if (z <= 11500000000000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + t_1))); else tmp = Float64(1.0 + Float64(hypot(1.0, 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(y) + sqrt(x);
tmp = 0.0;
if (z <= 11500000000000.0)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
else
tmp = 1.0 + (hypot(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[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 11500000000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $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{y} + \sqrt{x}\\
\mathbf{if}\;z \leq 11500000000000:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - t\_1\right)\\
\end{array}
\end{array}
if z < 1.15e13Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in x around 0 48.0%
Taylor expanded in t around inf 27.9%
Taylor expanded in y around 0 16.1%
associate--l+16.1%
+-commutative16.1%
+-commutative16.1%
associate-+l+16.1%
+-commutative16.1%
Simplified16.1%
if 1.15e13 < z Initial program 88.2%
associate-+l+88.2%
sub-neg88.2%
sub-neg88.2%
+-commutative88.2%
+-commutative88.2%
+-commutative88.2%
Simplified88.2%
Taylor expanded in x around 0 52.8%
Taylor expanded in t around inf 31.8%
Taylor expanded in z around inf 21.1%
associate--l+36.1%
metadata-eval36.1%
rem-square-sqrt36.1%
hypot-undefine36.1%
Simplified36.1%
Final simplification25.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 (<= z 3350000000000.0) (- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (sqrt z))) (+ 1.0 (- (hypot 1.0 (sqrt y)) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3350000000000.0) {
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + sqrt(z));
} else {
tmp = 1.0 + (hypot(1.0, sqrt(y)) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3350000000000.0) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(x) + Math.sqrt(z));
} else {
tmp = 1.0 + (Math.hypot(1.0, Math.sqrt(y)) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 3350000000000.0: tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(x) + math.sqrt(z)) else: tmp = 1.0 + (math.hypot(1.0, math.sqrt(y)) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 3350000000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(x) + sqrt(z))); else tmp = Float64(1.0 + Float64(hypot(1.0, sqrt(y)) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 3350000000000.0)
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + sqrt(z));
else
tmp = 1.0 + (hypot(1.0, sqrt(y)) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 3350000000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3350000000000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 3.35e12Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in x around 0 48.0%
Taylor expanded in t around inf 27.9%
Taylor expanded in y around 0 16.1%
Taylor expanded in z around inf 28.8%
if 3.35e12 < z Initial program 88.2%
associate-+l+88.2%
sub-neg88.2%
sub-neg88.2%
+-commutative88.2%
+-commutative88.2%
+-commutative88.2%
Simplified88.2%
Taylor expanded in x around 0 52.8%
Taylor expanded in t around inf 31.8%
Taylor expanded in z around inf 21.1%
associate--l+36.1%
metadata-eval36.1%
rem-square-sqrt36.1%
hypot-undefine36.1%
Simplified36.1%
Final simplification32.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 55000000000000.0) (- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (sqrt z))) (+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 55000000000000.0) {
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + sqrt(z));
} else {
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 55000000000000.0d0) then
tmp = (sqrt((1.0d0 + z)) + 2.0d0) - (sqrt(x) + sqrt(z))
else
tmp = 1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 55000000000000.0) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(x) + Math.sqrt(z));
} else {
tmp = 1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 55000000000000.0: tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(x) + math.sqrt(z)) else: tmp = 1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 55000000000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(x) + sqrt(z))); else tmp = Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 55000000000000.0)
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + sqrt(z));
else
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 55000000000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 55000000000000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 5.5e13Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in x around 0 48.0%
Taylor expanded in t around inf 27.9%
Taylor expanded in y around 0 16.1%
Taylor expanded in z around inf 28.8%
if 5.5e13 < z Initial program 88.2%
associate-+l+88.2%
sub-neg88.2%
sub-neg88.2%
+-commutative88.2%
+-commutative88.2%
+-commutative88.2%
Simplified88.2%
Taylor expanded in x around 0 52.8%
Taylor expanded in t around inf 31.8%
Taylor expanded in z around inf 21.1%
associate--l+36.1%
Simplified36.1%
Final simplification32.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 0.105) (- 3.0 (+ (sqrt y) (+ (sqrt x) (sqrt z)))) (+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.105) {
tmp = 3.0 - (sqrt(y) + (sqrt(x) + sqrt(z)));
} else {
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 0.105d0) then
tmp = 3.0d0 - (sqrt(y) + (sqrt(x) + sqrt(z)))
else
tmp = 1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.105) {
tmp = 3.0 - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)));
} else {
tmp = 1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.105: tmp = 3.0 - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))) else: tmp = 1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.105) tmp = Float64(3.0 - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))); else tmp = Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 0.105)
tmp = 3.0 - (sqrt(y) + (sqrt(x) + sqrt(z)));
else
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 0.105], N[(3.0 - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.105:\\
\;\;\;\;3 - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 0.104999999999999996Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in x around 0 48.5%
Taylor expanded in t around inf 28.0%
Taylor expanded in y around 0 16.2%
Taylor expanded in z around 0 15.5%
+-commutative15.5%
associate-+r+15.5%
+-commutative15.5%
Simplified15.5%
if 0.104999999999999996 < z Initial program 88.4%
associate-+l+88.4%
sub-neg88.4%
sub-neg88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
Simplified88.4%
Taylor expanded in x around 0 51.9%
Taylor expanded in t around inf 31.4%
Taylor expanded in z around inf 20.4%
associate--l+34.5%
Simplified34.5%
Final simplification24.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 1.02) (- 3.0 (+ (sqrt y) (+ (sqrt x) (sqrt z)))) (- (+ (* y (+ 0.5 (* y -0.125))) 2.0) (+ (sqrt y) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.02) {
tmp = 3.0 - (sqrt(y) + (sqrt(x) + sqrt(z)));
} else {
tmp = ((y * (0.5 + (y * -0.125))) + 2.0) - (sqrt(y) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.02d0) then
tmp = 3.0d0 - (sqrt(y) + (sqrt(x) + sqrt(z)))
else
tmp = ((y * (0.5d0 + (y * (-0.125d0)))) + 2.0d0) - (sqrt(y) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.02) {
tmp = 3.0 - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)));
} else {
tmp = ((y * (0.5 + (y * -0.125))) + 2.0) - (Math.sqrt(y) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1.02: tmp = 3.0 - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))) else: tmp = ((y * (0.5 + (y * -0.125))) + 2.0) - (math.sqrt(y) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1.02) tmp = Float64(3.0 - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))); else tmp = Float64(Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) + 2.0) - Float64(sqrt(y) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 1.02)
tmp = 3.0 - (sqrt(y) + (sqrt(x) + sqrt(z)));
else
tmp = ((y * (0.5 + (y * -0.125))) + 2.0) - (sqrt(y) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1.02], N[(3.0 - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.02:\\
\;\;\;\;3 - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(0.5 + y \cdot -0.125\right) + 2\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 1.02Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in x around 0 48.5%
Taylor expanded in t around inf 28.0%
Taylor expanded in y around 0 16.2%
Taylor expanded in z around 0 15.5%
+-commutative15.5%
associate-+r+15.5%
+-commutative15.5%
Simplified15.5%
if 1.02 < z Initial program 88.4%
associate-+l+88.4%
sub-neg88.4%
sub-neg88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
Simplified88.4%
Taylor expanded in x around 0 51.9%
Taylor expanded in t around inf 31.4%
Taylor expanded in y around 0 19.7%
associate--l+19.7%
Simplified19.7%
Taylor expanded in z around inf 19.4%
Final simplification17.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (+ (* y (+ 0.5 (* y -0.125))) 2.0) (+ (sqrt y) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((y * (0.5 + (y * -0.125))) + 2.0) - (sqrt(y) + sqrt(x));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((y * (0.5d0 + (y * (-0.125d0)))) + 2.0d0) - (sqrt(y) + sqrt(x))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return ((y * (0.5 + (y * -0.125))) + 2.0) - (Math.sqrt(y) + Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((y * (0.5 + (y * -0.125))) + 2.0) - (math.sqrt(y) + math.sqrt(x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) + 2.0) - Float64(sqrt(y) + sqrt(x))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((y * (0.5 + (y * -0.125))) + 2.0) - (sqrt(y) + sqrt(x));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(y \cdot \left(0.5 + y \cdot -0.125\right) + 2\right) - \left(\sqrt{y} + \sqrt{x}\right)
\end{array}
Initial program 92.6%
associate-+l+92.6%
sub-neg92.6%
sub-neg92.6%
+-commutative92.6%
+-commutative92.6%
+-commutative92.6%
Simplified92.6%
Taylor expanded in x around 0 50.2%
Taylor expanded in t around inf 29.7%
Taylor expanded in y around 0 17.9%
associate--l+17.9%
Simplified17.9%
Taylor expanded in z around inf 12.6%
Final simplification12.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 2.0 (+ (sqrt y) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 2.0 - (sqrt(y) + sqrt(x));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 2.0d0 - (sqrt(y) + sqrt(x))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 2.0 - (Math.sqrt(y) + Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 2.0 - (math.sqrt(y) + math.sqrt(x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(2.0 - Float64(sqrt(y) + sqrt(x))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 2.0 - (sqrt(y) + sqrt(x));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(2.0 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
2 - \left(\sqrt{y} + \sqrt{x}\right)
\end{array}
Initial program 92.6%
associate-+l+92.6%
sub-neg92.6%
sub-neg92.6%
+-commutative92.6%
+-commutative92.6%
+-commutative92.6%
Simplified92.6%
Taylor expanded in x around 0 50.2%
Taylor expanded in t around inf 29.7%
Taylor expanded in y around 0 10.3%
Taylor expanded in z around inf 12.7%
Final simplification12.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* 0.5 (sqrt (/ 1.0 t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.5 * sqrt((1.0 / 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 = 0.5d0 * sqrt((1.0d0 / t))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 0.5 * Math.sqrt((1.0 / t));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.5 * math.sqrt((1.0 / t))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(0.5 * sqrt(Float64(1.0 / t))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.5 * sqrt((1.0 / t));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot \sqrt{\frac{1}{t}}
\end{array}
Initial program 92.6%
associate-+l+92.6%
sub-neg92.6%
sub-neg92.6%
+-commutative92.6%
+-commutative92.6%
+-commutative92.6%
Simplified92.6%
Taylor expanded in x around 0 50.2%
Taylor expanded in t around inf 27.4%
Taylor expanded in z around 0 10.5%
associate-+r+10.5%
distribute-lft-out10.5%
+-commutative10.5%
Simplified10.5%
Taylor expanded in t around 0 8.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -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[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 92.6%
associate-+l+92.6%
sub-neg92.6%
sub-neg92.6%
+-commutative92.6%
+-commutative92.6%
+-commutative92.6%
Simplified92.6%
Taylor expanded in x around 0 50.2%
Taylor expanded in t around inf 29.7%
Taylor expanded in x around inf 1.6%
mul-1-neg1.6%
Simplified1.6%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024084
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(+ (+ (+ (/ 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))))