
(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 19 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 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (sqrt (+ 1.0 z))))
(if (<= (- t_2 (sqrt x)) 0.2)
(+
(- t_3 (sqrt z))
(expm1 (log1p (+ t_1 (/ (+ 1.0 (- x x)) (+ (sqrt x) t_2))))))
(+
(+ t_2 (- t_1 (sqrt x)))
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(/ (+ 1.0 (- z z)) (+ (sqrt z) 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((1.0 + y)) + sqrt(y));
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((1.0 + z));
double tmp;
if ((t_2 - sqrt(x)) <= 0.2) {
tmp = (t_3 - sqrt(z)) + expm1(log1p((t_1 + ((1.0 + (x - x)) / (sqrt(x) + t_2)))));
} else {
tmp = (t_2 + (t_1 - sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) + ((1.0 + (z - z)) / (sqrt(z) + t_3)));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((1.0 + z));
double tmp;
if ((t_2 - Math.sqrt(x)) <= 0.2) {
tmp = (t_3 - Math.sqrt(z)) + Math.expm1(Math.log1p((t_1 + ((1.0 + (x - x)) / (Math.sqrt(x) + t_2)))));
} else {
tmp = (t_2 + (t_1 - Math.sqrt(x))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((1.0 + (z - z)) / (Math.sqrt(z) + 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((1.0 + y)) + math.sqrt(y)) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((1.0 + z)) tmp = 0 if (t_2 - math.sqrt(x)) <= 0.2: tmp = (t_3 - math.sqrt(z)) + math.expm1(math.log1p((t_1 + ((1.0 + (x - x)) / (math.sqrt(x) + t_2))))) else: tmp = (t_2 + (t_1 - math.sqrt(x))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + ((1.0 + (z - z)) / (math.sqrt(z) + t_3))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) t_2 = sqrt(Float64(1.0 + x)) t_3 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(t_2 - sqrt(x)) <= 0.2) tmp = Float64(Float64(t_3 - sqrt(z)) + expm1(log1p(Float64(t_1 + Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + t_2)))))); else tmp = Float64(Float64(t_2 + Float64(t_1 - sqrt(x))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(1.0 + Float64(z - z)) / Float64(sqrt(z) + t_3)))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.2], N[(N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(Exp[N[Log[1 + N[(t$95$1 + N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(z - z), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[z], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{1 + z}\\
\mathbf{if}\;t_2 - \sqrt{x} \leq 0.2:\\
\;\;\;\;\left(t_3 - \sqrt{z}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(t_1 + \frac{1 + \left(x - x\right)}{\sqrt{x} + t_2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_2 + \left(t_1 - \sqrt{x}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1 + \left(z - z\right)}{\sqrt{z} + t_3}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.20000000000000001Initial program 88.9%
associate-+l+88.9%
associate-+l-47.6%
+-commutative47.6%
sub-neg47.6%
sub-neg47.6%
+-commutative47.6%
+-commutative47.6%
Simplified47.6%
expm1-log1p-u47.6%
associate--r-88.9%
+-commutative88.9%
Applied egg-rr88.9%
flip--88.9%
add-sqr-sqrt53.6%
+-commutative53.6%
add-sqr-sqrt89.9%
+-commutative89.9%
Applied egg-rr89.9%
+-commutative89.9%
associate--l+92.1%
+-commutative92.1%
+-commutative92.1%
Simplified92.1%
flip--92.1%
add-sqr-sqrt73.5%
add-sqr-sqrt92.6%
Applied egg-rr92.6%
associate--l+94.5%
+-inverses94.5%
metadata-eval94.5%
Simplified94.5%
Taylor expanded in t around inf 58.1%
if 0.20000000000000001 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 98.0%
associate-+l+98.0%
associate-+l-98.0%
+-commutative98.0%
sub-neg98.0%
sub-neg98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
flip--97.4%
add-sqr-sqrt79.5%
add-sqr-sqrt97.5%
Applied egg-rr98.2%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified98.4%
flip--98.9%
add-sqr-sqrt75.1%
+-commutative75.1%
add-sqr-sqrt99.2%
+-commutative99.2%
Applied egg-rr99.2%
associate--l+99.3%
Applied egg-rr99.3%
associate-+r-99.2%
+-commutative99.2%
associate--l+99.3%
Simplified99.3%
Final simplification78.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 x)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (sqrt (+ 1.0 z)))
(t_4 (- (- (- t_2 (sqrt y)) (- (sqrt x) t_1)) (- (sqrt z) t_3))))
(if (<= t_4 0.2)
(/ (+ 1.0 (- x x)) (+ (sqrt x) t_1))
(if (<= t_4 2.05)
(+
t_1
(+
(/ 1.0 (+ t_2 (sqrt y)))
(- (/ (- z (+ z -1.0)) (+ (sqrt z) t_3)) (sqrt x))))
(+
(- (+ 1.0 t_2) (sqrt y))
(+
(- t_3 (sqrt z))
(/ (- (+ 1.0 t) t) (+ (sqrt t) (sqrt (+ 1.0 t))))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((1.0 + z));
double t_4 = ((t_2 - sqrt(y)) - (sqrt(x) - t_1)) - (sqrt(z) - t_3);
double tmp;
if (t_4 <= 0.2) {
tmp = (1.0 + (x - x)) / (sqrt(x) + t_1);
} else if (t_4 <= 2.05) {
tmp = t_1 + ((1.0 / (t_2 + sqrt(y))) + (((z - (z + -1.0)) / (sqrt(z) + t_3)) - sqrt(x)));
} else {
tmp = ((1.0 + t_2) - sqrt(y)) + ((t_3 - sqrt(z)) + (((1.0 + t) - t) / (sqrt(t) + sqrt((1.0 + 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 + x))
t_2 = sqrt((1.0d0 + y))
t_3 = sqrt((1.0d0 + z))
t_4 = ((t_2 - sqrt(y)) - (sqrt(x) - t_1)) - (sqrt(z) - t_3)
if (t_4 <= 0.2d0) then
tmp = (1.0d0 + (x - x)) / (sqrt(x) + t_1)
else if (t_4 <= 2.05d0) then
tmp = t_1 + ((1.0d0 / (t_2 + sqrt(y))) + (((z - (z + (-1.0d0))) / (sqrt(z) + t_3)) - sqrt(x)))
else
tmp = ((1.0d0 + t_2) - sqrt(y)) + ((t_3 - sqrt(z)) + (((1.0d0 + t) - t) / (sqrt(t) + sqrt((1.0d0 + 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 + x));
double t_2 = Math.sqrt((1.0 + y));
double t_3 = Math.sqrt((1.0 + z));
double t_4 = ((t_2 - Math.sqrt(y)) - (Math.sqrt(x) - t_1)) - (Math.sqrt(z) - t_3);
double tmp;
if (t_4 <= 0.2) {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + t_1);
} else if (t_4 <= 2.05) {
tmp = t_1 + ((1.0 / (t_2 + Math.sqrt(y))) + (((z - (z + -1.0)) / (Math.sqrt(z) + t_3)) - Math.sqrt(x)));
} else {
tmp = ((1.0 + t_2) - Math.sqrt(y)) + ((t_3 - Math.sqrt(z)) + (((1.0 + t) - t) / (Math.sqrt(t) + Math.sqrt((1.0 + t)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) t_3 = math.sqrt((1.0 + z)) t_4 = ((t_2 - math.sqrt(y)) - (math.sqrt(x) - t_1)) - (math.sqrt(z) - t_3) tmp = 0 if t_4 <= 0.2: tmp = (1.0 + (x - x)) / (math.sqrt(x) + t_1) elif t_4 <= 2.05: tmp = t_1 + ((1.0 / (t_2 + math.sqrt(y))) + (((z - (z + -1.0)) / (math.sqrt(z) + t_3)) - math.sqrt(x))) else: tmp = ((1.0 + t_2) - math.sqrt(y)) + ((t_3 - math.sqrt(z)) + (((1.0 + t) - t) / (math.sqrt(t) + math.sqrt((1.0 + t))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(1.0 + z)) t_4 = Float64(Float64(Float64(t_2 - sqrt(y)) - Float64(sqrt(x) - t_1)) - Float64(sqrt(z) - t_3)) tmp = 0.0 if (t_4 <= 0.2) tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + t_1)); elseif (t_4 <= 2.05) tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(Float64(Float64(z - Float64(z + -1.0)) / Float64(sqrt(z) + t_3)) - sqrt(x)))); else tmp = Float64(Float64(Float64(1.0 + t_2) - sqrt(y)) + Float64(Float64(t_3 - sqrt(z)) + Float64(Float64(Float64(1.0 + t) - t) / Float64(sqrt(t) + sqrt(Float64(1.0 + 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 + x));
t_2 = sqrt((1.0 + y));
t_3 = sqrt((1.0 + z));
t_4 = ((t_2 - sqrt(y)) - (sqrt(x) - t_1)) - (sqrt(z) - t_3);
tmp = 0.0;
if (t_4 <= 0.2)
tmp = (1.0 + (x - x)) / (sqrt(x) + t_1);
elseif (t_4 <= 2.05)
tmp = t_1 + ((1.0 / (t_2 + sqrt(y))) + (((z - (z + -1.0)) / (sqrt(z) + t_3)) - sqrt(x)));
else
tmp = ((1.0 + t_2) - sqrt(y)) + ((t_3 - sqrt(z)) + (((1.0 + t) - t) / (sqrt(t) + sqrt((1.0 + 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 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, 0.2], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2.05], N[(t$95$1 + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(z - N[(z + -1.0), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[z], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$2), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t), $MachinePrecision] - t), $MachinePrecision] / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + z}\\
t_4 := \left(\left(t_2 - \sqrt{y}\right) - \left(\sqrt{x} - t_1\right)\right) - \left(\sqrt{z} - t_3\right)\\
\mathbf{if}\;t_4 \leq 0.2:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t_1}\\
\mathbf{elif}\;t_4 \leq 2.05:\\
\;\;\;\;t_1 + \left(\frac{1}{t_2 + \sqrt{y}} + \left(\frac{z - \left(z + -1\right)}{\sqrt{z} + t_3} - \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t_2\right) - \sqrt{y}\right) + \left(\left(t_3 - \sqrt{z}\right) + \frac{\left(1 + t\right) - t}{\sqrt{t} + \sqrt{1 + t}}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) < 0.20000000000000001Initial program 56.3%
associate-+l+56.3%
+-commutative56.3%
associate-+r-56.3%
associate-+l-16.9%
+-commutative16.9%
associate--l+16.9%
+-commutative16.9%
Simplified5.3%
Taylor expanded in t around inf 5.7%
+-commutative5.7%
+-commutative5.7%
associate--l+8.4%
Simplified8.4%
Taylor expanded in z around inf 5.3%
+-commutative5.3%
Simplified5.3%
Taylor expanded in y around inf 8.4%
flip--56.2%
add-sqr-sqrt42.2%
+-commutative42.2%
add-sqr-sqrt58.5%
+-commutative58.5%
Applied egg-rr9.5%
+-commutative58.5%
associate--l+67.9%
+-commutative67.9%
+-commutative67.9%
Simplified19.8%
if 0.20000000000000001 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) < 2.0499999999999998Initial program 97.3%
associate-+l+97.3%
+-commutative97.3%
associate-+r-68.4%
associate-+l-50.2%
+-commutative50.2%
associate--l+50.2%
+-commutative50.2%
Simplified33.1%
Taylor expanded in t around inf 30.3%
+-commutative30.3%
+-commutative30.3%
associate--l+31.7%
Simplified31.7%
flip--31.9%
add-sqr-sqrt23.1%
add-sqr-sqrt31.9%
+-commutative31.9%
+-commutative31.9%
Applied egg-rr31.9%
associate--r+31.9%
+-commutative31.9%
Simplified31.9%
flip--97.7%
add-sqr-sqrt77.5%
add-sqr-sqrt98.1%
Applied egg-rr32.0%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
Simplified32.2%
if 2.0499999999999998 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) Initial program 99.9%
associate-+l+99.9%
associate-+l-99.9%
+-commutative99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 92.4%
flip--92.4%
add-sqr-sqrt68.0%
+-commutative68.0%
add-sqr-sqrt92.5%
+-commutative92.5%
Applied egg-rr92.5%
Final simplification40.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (sqrt (+ 1.0 z))) (t_3 (sqrt (+ 1.0 y))))
(if (<= (- (- t_3 (sqrt y)) (- (sqrt x) t_1)) 1.999985)
(+
(- t_2 (sqrt z))
(expm1
(log1p
(+ (/ 1.0 (+ t_3 (sqrt y))) (/ (+ 1.0 (- x x)) (+ (sqrt x) t_1))))))
(+
(- t_1 (+ (sqrt x) (- (sqrt y) t_3)))
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(/ (- (+ 1.0 z) z) (+ (sqrt z) 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 + x));
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + y));
double tmp;
if (((t_3 - sqrt(y)) - (sqrt(x) - t_1)) <= 1.999985) {
tmp = (t_2 - sqrt(z)) + expm1(log1p(((1.0 / (t_3 + sqrt(y))) + ((1.0 + (x - x)) / (sqrt(x) + t_1)))));
} else {
tmp = (t_1 - (sqrt(x) + (sqrt(y) - t_3))) + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (sqrt(z) + t_2)));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + y));
double tmp;
if (((t_3 - Math.sqrt(y)) - (Math.sqrt(x) - t_1)) <= 1.999985) {
tmp = (t_2 - Math.sqrt(z)) + Math.expm1(Math.log1p(((1.0 / (t_3 + Math.sqrt(y))) + ((1.0 + (x - x)) / (Math.sqrt(x) + t_1)))));
} else {
tmp = (t_1 - (Math.sqrt(x) + (Math.sqrt(y) - t_3))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + z) - z) / (Math.sqrt(z) + 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 + x)) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + y)) tmp = 0 if ((t_3 - math.sqrt(y)) - (math.sqrt(x) - t_1)) <= 1.999985: tmp = (t_2 - math.sqrt(z)) + math.expm1(math.log1p(((1.0 / (t_3 + math.sqrt(y))) + ((1.0 + (x - x)) / (math.sqrt(x) + t_1))))) else: tmp = (t_1 - (math.sqrt(x) + (math.sqrt(y) - t_3))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + z) - z) / (math.sqrt(z) + 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 + x)) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (Float64(Float64(t_3 - sqrt(y)) - Float64(sqrt(x) - t_1)) <= 1.999985) tmp = Float64(Float64(t_2 - sqrt(z)) + expm1(log1p(Float64(Float64(1.0 / Float64(t_3 + sqrt(y))) + Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + t_1)))))); else tmp = Float64(Float64(t_1 - Float64(sqrt(x) + Float64(sqrt(y) - t_3))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + z) - z) / Float64(sqrt(z) + t_2)))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], 1.999985], N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(Exp[N[Log[1 + N[(N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + z), $MachinePrecision] - z), $MachinePrecision] / N[(N[Sqrt[z], $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 + x}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;\left(t_3 - \sqrt{y}\right) - \left(\sqrt{x} - t_1\right) \leq 1.999985:\\
\;\;\;\;\left(t_2 - \sqrt{z}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{t_3 + \sqrt{y}} + \frac{1 + \left(x - x\right)}{\sqrt{x} + t_1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - \left(\sqrt{x} + \left(\sqrt{y} - t_3\right)\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{\left(1 + z\right) - z}{\sqrt{z} + t_2}\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 1.9999849999999999Initial program 91.6%
associate-+l+91.6%
associate-+l-63.7%
+-commutative63.7%
sub-neg63.7%
sub-neg63.7%
+-commutative63.7%
+-commutative63.7%
Simplified63.7%
expm1-log1p-u63.7%
associate--r-91.6%
+-commutative91.6%
Applied egg-rr91.6%
flip--91.6%
add-sqr-sqrt67.8%
+-commutative67.8%
add-sqr-sqrt92.3%
+-commutative92.3%
Applied egg-rr92.3%
+-commutative92.3%
associate--l+93.8%
+-commutative93.8%
+-commutative93.8%
Simplified93.8%
flip--93.8%
add-sqr-sqrt69.7%
add-sqr-sqrt94.2%
Applied egg-rr94.2%
associate--l+95.7%
+-inverses95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in t around inf 61.0%
if 1.9999849999999999 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 98.8%
associate-+l+98.8%
associate-+l-98.8%
+-commutative98.8%
sub-neg98.8%
sub-neg98.8%
+-commutative98.8%
+-commutative98.8%
Simplified98.8%
flip--99.2%
add-sqr-sqrt78.9%
+-commutative78.9%
add-sqr-sqrt99.9%
+-commutative99.9%
Applied egg-rr99.8%
Final simplification70.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (+ (sqrt x) (sqrt (+ 1.0 x)))))
(+
(/ (/ (+ t_1 (+ (sqrt y) t_2)) t_2) (+ t_1 (sqrt y)))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt(x) + sqrt((1.0 + x));
return (((t_1 + (sqrt(y) + t_2)) / t_2) / (t_1 + sqrt(y))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt(x) + sqrt((1.0d0 + x))
code = (((t_1 + (sqrt(y) + t_2)) / t_2) / (t_1 + sqrt(y))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt(x) + Math.sqrt((1.0 + x));
return (((t_1 + (Math.sqrt(y) + t_2)) / t_2) / (t_1 + Math.sqrt(y))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt(x) + math.sqrt((1.0 + x)) return (((t_1 + (math.sqrt(y) + t_2)) / t_2) / (t_1 + math.sqrt(y))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = Float64(sqrt(x) + sqrt(Float64(1.0 + x))) return Float64(Float64(Float64(Float64(t_1 + Float64(sqrt(y) + t_2)) / t_2) / Float64(t_1 + sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt(x) + sqrt((1.0 + x));
tmp = (((t_1 + (sqrt(y) + t_2)) / t_2) / (t_1 + sqrt(y))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(t$95$1 + N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{x} + \sqrt{1 + x}\\
\frac{\frac{t_1 + \left(\sqrt{y} + t_2\right)}{t_2}}{t_1 + \sqrt{y}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)
\end{array}
\end{array}
Initial program 93.4%
associate-+l+93.4%
associate-+l-72.2%
+-commutative72.2%
sub-neg72.2%
sub-neg72.2%
+-commutative72.2%
+-commutative72.2%
Simplified72.2%
expm1-log1p-u71.9%
associate--r-93.0%
+-commutative93.0%
Applied egg-rr93.0%
flip--93.0%
add-sqr-sqrt75.0%
+-commutative75.0%
add-sqr-sqrt93.5%
+-commutative93.5%
Applied egg-rr93.5%
+-commutative93.5%
associate--l+94.7%
+-commutative94.7%
+-commutative94.7%
Simplified94.7%
flip--94.7%
add-sqr-sqrt76.4%
add-sqr-sqrt95.0%
Applied egg-rr95.0%
associate--l+96.1%
+-inverses96.1%
metadata-eval96.1%
Simplified96.1%
expm1-log1p-u96.4%
frac-add96.4%
+-inverses96.4%
metadata-eval96.4%
*-un-lft-identity96.4%
Applied egg-rr96.4%
associate-/r*96.4%
*-rgt-identity96.4%
associate-+l+96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Final simplification96.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (+ (sqrt x) (sqrt (+ 1.0 x)))))
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(/ (+ t_1 (+ (sqrt y) t_2)) (* t_2 (+ 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(x) + sqrt((1.0 + x));
return ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((t_1 + (sqrt(y) + t_2)) / (t_2 * (t_1 + 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
real(8) :: t_1
real(8) :: t_2
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt(x) + sqrt((1.0d0 + x))
code = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((t_1 + (sqrt(y) + t_2)) / (t_2 * (t_1 + sqrt(y))))
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(x) + Math.sqrt((1.0 + x));
return ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((t_1 + (Math.sqrt(y) + t_2)) / (t_2 * (t_1 + Math.sqrt(y))));
}
[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(x) + math.sqrt((1.0 + x)) return ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((t_1 + (math.sqrt(y) + t_2)) / (t_2 * (t_1 + math.sqrt(y))))
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(x) + sqrt(Float64(1.0 + x))) return Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(t_1 + Float64(sqrt(y) + t_2)) / Float64(t_2 * Float64(t_1 + sqrt(y))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt(x) + sqrt((1.0 + x));
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((t_1 + (sqrt(y) + t_2)) / (t_2 * (t_1 + sqrt(y))));
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[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 + N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{x} + \sqrt{1 + x}\\
\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \frac{t_1 + \left(\sqrt{y} + t_2\right)}{t_2 \cdot \left(t_1 + \sqrt{y}\right)}
\end{array}
\end{array}
Initial program 93.4%
associate-+l+93.4%
associate-+l-72.2%
+-commutative72.2%
sub-neg72.2%
sub-neg72.2%
+-commutative72.2%
+-commutative72.2%
Simplified72.2%
expm1-log1p-u71.9%
associate--r-93.0%
+-commutative93.0%
Applied egg-rr93.0%
flip--93.0%
add-sqr-sqrt75.0%
+-commutative75.0%
add-sqr-sqrt93.5%
+-commutative93.5%
Applied egg-rr93.5%
+-commutative93.5%
associate--l+94.7%
+-commutative94.7%
+-commutative94.7%
Simplified94.7%
flip--94.7%
add-sqr-sqrt76.4%
add-sqr-sqrt95.0%
Applied egg-rr95.0%
associate--l+96.1%
+-inverses96.1%
metadata-eval96.1%
Simplified96.1%
expm1-log1p-u96.4%
frac-add96.4%
+-inverses96.4%
metadata-eval96.4%
*-un-lft-identity96.4%
Applied egg-rr96.4%
*-rgt-identity96.4%
associate-+l+96.4%
+-commutative96.4%
*-commutative96.4%
+-commutative96.4%
Simplified96.4%
Final simplification96.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (sqrt (+ 1.0 z))))
(if (<= (- t_1 (sqrt y)) 0.9999995)
(+
(- t_2 (sqrt z))
(expm1
(log1p
(+
(/ 1.0 (+ t_1 (sqrt y)))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))))))
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ (- (+ 1.0 z) z) (+ (sqrt z) t_2)))
(- (+ 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 t_2 = sqrt((1.0 + z));
double tmp;
if ((t_1 - sqrt(y)) <= 0.9999995) {
tmp = (t_2 - sqrt(z)) + expm1(log1p(((1.0 / (t_1 + sqrt(y))) + ((1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)))))));
} else {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (sqrt(z) + t_2))) + ((1.0 + t_1) - sqrt(y));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if ((t_1 - Math.sqrt(y)) <= 0.9999995) {
tmp = (t_2 - Math.sqrt(z)) + Math.expm1(Math.log1p(((1.0 / (t_1 + Math.sqrt(y))) + ((1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)))))));
} else {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + z) - z) / (Math.sqrt(z) + t_2))) + ((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)) t_2 = math.sqrt((1.0 + z)) tmp = 0 if (t_1 - math.sqrt(y)) <= 0.9999995: tmp = (t_2 - math.sqrt(z)) + math.expm1(math.log1p(((1.0 / (t_1 + math.sqrt(y))) + ((1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))))))) else: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + z) - z) / (math.sqrt(z) + t_2))) + ((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)) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(t_1 - sqrt(y)) <= 0.9999995) tmp = Float64(Float64(t_2 - sqrt(z)) + expm1(log1p(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))))))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + z) - z) / Float64(sqrt(z) + t_2))) + Float64(Float64(1.0 + t_1) - sqrt(y))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 0.9999995], N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(Exp[N[Log[1 + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + z), $MachinePrecision] - z), $MachinePrecision] / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + t$95$1), $MachinePrecision] - 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}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;t_1 - \sqrt{y} \leq 0.9999995:\\
\;\;\;\;\left(t_2 - \sqrt{z}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{t_1 + \sqrt{y}} + \frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{\left(1 + z\right) - z}{\sqrt{z} + t_2}\right) + \left(\left(1 + t_1\right) - \sqrt{y}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 0.999999500000000041Initial program 87.8%
associate-+l+87.8%
associate-+l-85.6%
+-commutative85.6%
sub-neg85.6%
sub-neg85.6%
+-commutative85.6%
+-commutative85.6%
Simplified85.6%
expm1-log1p-u85.6%
associate--r-87.8%
+-commutative87.8%
Applied egg-rr87.8%
flip--87.8%
add-sqr-sqrt73.6%
+-commutative73.6%
add-sqr-sqrt88.3%
+-commutative88.3%
Applied egg-rr88.3%
+-commutative88.3%
associate--l+90.4%
+-commutative90.4%
+-commutative90.4%
Simplified90.4%
flip--90.4%
add-sqr-sqrt51.5%
add-sqr-sqrt91.1%
Applied egg-rr91.1%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
Simplified93.4%
Taylor expanded in t around inf 54.2%
if 0.999999500000000041 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) Initial program 98.3%
associate-+l+98.3%
associate-+l-60.4%
+-commutative60.4%
sub-neg60.4%
sub-neg60.4%
+-commutative60.4%
+-commutative60.4%
Simplified60.4%
Taylor expanded in x around 0 55.5%
flip--60.5%
add-sqr-sqrt49.1%
+-commutative49.1%
add-sqr-sqrt60.9%
+-commutative60.9%
Applied egg-rr55.9%
Final simplification55.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(exp
(log
(+
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + exp(log(((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 / (sqrt(x) + sqrt((1.0 + 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 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + exp(log(((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (1.0d0 / (sqrt(x) + sqrt((1.0d0 + 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 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + Math.exp(Math.log(((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + math.exp(math.log(((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + exp(log(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + exp(log(((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x)))))));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Exp[N[Log[N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + e^{\log \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right)}
\end{array}
Initial program 93.4%
associate-+l+93.4%
associate-+l-72.2%
+-commutative72.2%
sub-neg72.2%
sub-neg72.2%
+-commutative72.2%
+-commutative72.2%
Simplified72.2%
expm1-log1p-u71.9%
associate--r-93.0%
+-commutative93.0%
Applied egg-rr93.0%
flip--93.0%
add-sqr-sqrt75.0%
+-commutative75.0%
add-sqr-sqrt93.5%
+-commutative93.5%
Applied egg-rr93.5%
+-commutative93.5%
associate--l+94.7%
+-commutative94.7%
+-commutative94.7%
Simplified94.7%
flip--94.7%
add-sqr-sqrt76.4%
add-sqr-sqrt95.0%
Applied egg-rr95.0%
associate--l+96.1%
+-inverses96.1%
metadata-eval96.1%
Simplified96.1%
expm1-log1p-u96.4%
add-exp-log96.3%
+-commutative96.3%
+-inverses96.3%
metadata-eval96.3%
Applied egg-rr96.3%
Final simplification96.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 (sqrt (+ 1.0 x))) (t_2 (sqrt (+ 1.0 z))))
(if (<= y 4.5e-27)
(+ (+ (- t_2 (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))) 2.0)
(if (<= y 3.3e+28)
(-
t_1
(+
(+ (sqrt x) (/ -1.0 (+ (sqrt z) t_2)))
(- (sqrt y) (sqrt (+ 1.0 y)))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) 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));
double t_2 = sqrt((1.0 + z));
double tmp;
if (y <= 4.5e-27) {
tmp = ((t_2 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + 2.0;
} else if (y <= 3.3e+28) {
tmp = t_1 - ((sqrt(x) + (-1.0 / (sqrt(z) + t_2))) + (sqrt(y) - sqrt((1.0 + y))));
} else {
tmp = (1.0 + (x - x)) / (sqrt(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) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + z))
if (y <= 4.5d-27) then
tmp = ((t_2 - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + 2.0d0
else if (y <= 3.3d+28) then
tmp = t_1 - ((sqrt(x) + ((-1.0d0) / (sqrt(z) + t_2))) + (sqrt(y) - sqrt((1.0d0 + y))))
else
tmp = (1.0d0 + (x - x)) / (sqrt(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((1.0 + x));
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 4.5e-27) {
tmp = ((t_2 - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + 2.0;
} else if (y <= 3.3e+28) {
tmp = t_1 - ((Math.sqrt(x) + (-1.0 / (Math.sqrt(z) + t_2))) + (Math.sqrt(y) - Math.sqrt((1.0 + y))));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + 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)) t_2 = math.sqrt((1.0 + z)) tmp = 0 if y <= 4.5e-27: tmp = ((t_2 - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + 2.0 elif y <= 3.3e+28: tmp = t_1 - ((math.sqrt(x) + (-1.0 / (math.sqrt(z) + t_2))) + (math.sqrt(y) - math.sqrt((1.0 + y)))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 4.5e-27) tmp = Float64(Float64(Float64(t_2 - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + 2.0); elseif (y <= 3.3e+28) tmp = Float64(t_1 - Float64(Float64(sqrt(x) + Float64(-1.0 / Float64(sqrt(z) + t_2))) + Float64(sqrt(y) - sqrt(Float64(1.0 + y))))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(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((1.0 + x));
t_2 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 4.5e-27)
tmp = ((t_2 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + 2.0;
elseif (y <= 3.3e+28)
tmp = t_1 - ((sqrt(x) + (-1.0 / (sqrt(z) + t_2))) + (sqrt(y) - sqrt((1.0 + y))));
else
tmp = (1.0 + (x - x)) / (sqrt(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[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 4.5e-27], N[(N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 3.3e+28], N[(t$95$1 - N[(N[(N[Sqrt[x], $MachinePrecision] + N[(-1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 4.5 \cdot 10^{-27}:\\
\;\;\;\;\left(\left(t_2 - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+28}:\\
\;\;\;\;t_1 - \left(\left(\sqrt{x} + \frac{-1}{\sqrt{z} + t_2}\right) + \left(\sqrt{y} - \sqrt{1 + y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t_1}\\
\end{array}
\end{array}
if y < 4.5000000000000002e-27Initial program 98.3%
associate-+l+98.3%
associate-+l-59.8%
+-commutative59.8%
sub-neg59.8%
sub-neg59.8%
+-commutative59.8%
+-commutative59.8%
Simplified59.8%
Taylor expanded in x around 0 54.9%
Taylor expanded in y around 0 54.9%
if 4.5000000000000002e-27 < y < 3.3e28Initial program 88.9%
associate-+l+88.9%
+-commutative88.9%
associate-+r-69.2%
associate-+l-49.8%
+-commutative49.8%
associate--l+49.8%
+-commutative49.8%
Simplified34.5%
Taylor expanded in t around inf 35.5%
+-commutative35.5%
+-commutative35.5%
associate--l+35.5%
Simplified35.5%
flip--35.5%
add-sqr-sqrt22.7%
add-sqr-sqrt35.5%
+-commutative35.5%
+-commutative35.5%
Applied egg-rr35.5%
associate--r+35.5%
+-commutative35.5%
Simplified35.5%
Taylor expanded in z around 0 35.5%
if 3.3e28 < y Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-87.8%
associate-+l-55.8%
+-commutative55.8%
associate--l+55.8%
+-commutative55.8%
Simplified40.0%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+34.6%
Simplified34.6%
Taylor expanded in z around inf 18.1%
+-commutative18.1%
Simplified18.1%
Taylor expanded in y around inf 18.1%
flip--87.8%
add-sqr-sqrt74.6%
+-commutative74.6%
add-sqr-sqrt88.4%
+-commutative88.4%
Applied egg-rr18.4%
+-commutative88.4%
associate--l+90.8%
+-commutative90.8%
+-commutative90.8%
Simplified21.9%
Final simplification39.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))) (t_2 (sqrt (+ 1.0 x))))
(if (<= y 4.5e-27)
(+ (+ t_1 (- (sqrt (+ 1.0 t)) (sqrt t))) 2.0)
(if (<= y 3.3e+28)
(+ t_2 (+ (- (sqrt (+ 1.0 y)) (sqrt y)) (- t_1 (sqrt x))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) 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 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + x));
double tmp;
if (y <= 4.5e-27) {
tmp = (t_1 + (sqrt((1.0 + t)) - sqrt(t))) + 2.0;
} else if (y <= 3.3e+28) {
tmp = t_2 + ((sqrt((1.0 + y)) - sqrt(y)) + (t_1 - sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + 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 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + x))
if (y <= 4.5d-27) then
tmp = (t_1 + (sqrt((1.0d0 + t)) - sqrt(t))) + 2.0d0
else if (y <= 3.3d+28) then
tmp = t_2 + ((sqrt((1.0d0 + y)) - sqrt(y)) + (t_1 - sqrt(x)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + 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 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 4.5e-27) {
tmp = (t_1 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + 2.0;
} else if (y <= 3.3e+28) {
tmp = t_2 + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + (t_1 - Math.sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + 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 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + x)) tmp = 0 if y <= 4.5e-27: tmp = (t_1 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + 2.0 elif y <= 3.3e+28: tmp = t_2 + ((math.sqrt((1.0 + y)) - math.sqrt(y)) + (t_1 - math.sqrt(x))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + 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 + z)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 4.5e-27) tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + 2.0); elseif (y <= 3.3e+28) tmp = Float64(t_2 + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + Float64(t_1 - sqrt(x)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + 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 + z)) - sqrt(z);
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 4.5e-27)
tmp = (t_1 + (sqrt((1.0 + t)) - sqrt(t))) + 2.0;
elseif (y <= 3.3e+28)
tmp = t_2 + ((sqrt((1.0 + y)) - sqrt(y)) + (t_1 - sqrt(x)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + 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 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 4.5e-27], N[(N[(t$95$1 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 3.3e+28], N[(t$95$2 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 4.5 \cdot 10^{-27}:\\
\;\;\;\;\left(t_1 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+28}:\\
\;\;\;\;t_2 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(t_1 - \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t_2}\\
\end{array}
\end{array}
if y < 4.5000000000000002e-27Initial program 98.3%
associate-+l+98.3%
associate-+l-59.8%
+-commutative59.8%
sub-neg59.8%
sub-neg59.8%
+-commutative59.8%
+-commutative59.8%
Simplified59.8%
Taylor expanded in x around 0 54.9%
Taylor expanded in y around 0 54.9%
if 4.5000000000000002e-27 < y < 3.3e28Initial program 88.9%
associate-+l+88.9%
+-commutative88.9%
associate-+r-69.2%
associate-+l-49.8%
+-commutative49.8%
associate--l+49.8%
+-commutative49.8%
Simplified34.5%
Taylor expanded in t around inf 35.5%
+-commutative35.5%
+-commutative35.5%
associate--l+35.5%
Simplified35.5%
if 3.3e28 < y Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-87.8%
associate-+l-55.8%
+-commutative55.8%
associate--l+55.8%
+-commutative55.8%
Simplified40.0%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+34.6%
Simplified34.6%
Taylor expanded in z around inf 18.1%
+-commutative18.1%
Simplified18.1%
Taylor expanded in y around inf 18.1%
flip--87.8%
add-sqr-sqrt74.6%
+-commutative74.6%
add-sqr-sqrt88.4%
+-commutative88.4%
Applied egg-rr18.4%
+-commutative88.4%
associate--l+90.8%
+-commutative90.8%
+-commutative90.8%
Simplified21.9%
Final simplification39.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 3.3e+28)
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.3e+28) {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (sqrt((1.0 + y)) - sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3.3d+28) then
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.3e+28) {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3.3e+28: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 3.3e+28) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 3.3e+28)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (sqrt((1.0 + y)) - sqrt(y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 3.3e+28], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + 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 3.3 \cdot 10^{+28}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 3.3e28Initial program 97.5%
associate-+l+97.5%
associate-+l-60.6%
+-commutative60.6%
sub-neg60.6%
sub-neg60.6%
+-commutative60.6%
+-commutative60.6%
Simplified60.6%
Taylor expanded in x around 0 55.0%
associate--l+55.0%
Simplified55.0%
if 3.3e28 < y Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-87.8%
associate-+l-55.8%
+-commutative55.8%
associate--l+55.8%
+-commutative55.8%
Simplified40.0%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+34.6%
Simplified34.6%
Taylor expanded in z around inf 18.1%
+-commutative18.1%
Simplified18.1%
Taylor expanded in y around inf 18.1%
flip--87.8%
add-sqr-sqrt74.6%
+-commutative74.6%
add-sqr-sqrt88.4%
+-commutative88.4%
Applied egg-rr18.4%
+-commutative88.4%
associate--l+90.8%
+-commutative90.8%
+-commutative90.8%
Simplified21.9%
Final simplification40.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 (<= y 3.3e+28) (+ 1.0 (- (- (sqrt (+ 1.0 y)) (sqrt y)) (- (sqrt z) (sqrt (+ 1.0 z))))) (/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.3e+28) {
tmp = 1.0 + ((sqrt((1.0 + y)) - sqrt(y)) - (sqrt(z) - sqrt((1.0 + z))));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3.3d+28) then
tmp = 1.0d0 + ((sqrt((1.0d0 + y)) - sqrt(y)) - (sqrt(z) - sqrt((1.0d0 + z))))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.3e+28) {
tmp = 1.0 + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) - (Math.sqrt(z) - Math.sqrt((1.0 + z))));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3.3e+28: tmp = 1.0 + ((math.sqrt((1.0 + y)) - math.sqrt(y)) - (math.sqrt(z) - math.sqrt((1.0 + z)))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 3.3e+28) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) - Float64(sqrt(z) - sqrt(Float64(1.0 + z))))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 3.3e+28)
tmp = 1.0 + ((sqrt((1.0 + y)) - sqrt(y)) - (sqrt(z) - sqrt((1.0 + z))));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 3.3e+28], N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] - N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + 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 3.3 \cdot 10^{+28}:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\sqrt{z} - \sqrt{1 + z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 3.3e28Initial program 97.5%
associate-+l+97.5%
+-commutative97.5%
associate-+r-60.6%
associate-+l-53.8%
+-commutative53.8%
associate--l+53.8%
+-commutative53.8%
Simplified39.8%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+35.7%
Simplified35.7%
Taylor expanded in x around 0 34.0%
associate--l+52.4%
associate--l+52.4%
+-commutative52.4%
Simplified52.4%
associate-+r-52.4%
Applied egg-rr52.4%
associate-+r-52.4%
+-commutative52.4%
associate--r+52.4%
associate-+l-52.1%
Simplified52.1%
if 3.3e28 < y Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-87.8%
associate-+l-55.8%
+-commutative55.8%
associate--l+55.8%
+-commutative55.8%
Simplified40.0%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+34.6%
Simplified34.6%
Taylor expanded in z around inf 18.1%
+-commutative18.1%
Simplified18.1%
Taylor expanded in y around inf 18.1%
flip--87.8%
add-sqr-sqrt74.6%
+-commutative74.6%
add-sqr-sqrt88.4%
+-commutative88.4%
Applied egg-rr18.4%
+-commutative88.4%
associate--l+90.8%
+-commutative90.8%
+-commutative90.8%
Simplified21.9%
Final simplification39.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 7.5e-24)
(+ (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))) 2.0)
(if (<= y 2e+21)
(- (+ 1.0 (* x 0.5)) (- (+ (sqrt y) (sqrt x)) (sqrt (+ 1.0 y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.5e-24) {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + 2.0;
} else if (y <= 2e+21) {
tmp = (1.0 + (x * 0.5)) - ((sqrt(y) + sqrt(x)) - sqrt((1.0 + y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 7.5d-24) then
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + 2.0d0
else if (y <= 2d+21) then
tmp = (1.0d0 + (x * 0.5d0)) - ((sqrt(y) + sqrt(x)) - sqrt((1.0d0 + y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.5e-24) {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + 2.0;
} else if (y <= 2e+21) {
tmp = (1.0 + (x * 0.5)) - ((Math.sqrt(y) + Math.sqrt(x)) - Math.sqrt((1.0 + y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 7.5e-24: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + 2.0 elif y <= 2e+21: tmp = (1.0 + (x * 0.5)) - ((math.sqrt(y) + math.sqrt(x)) - math.sqrt((1.0 + y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 7.5e-24) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + 2.0); elseif (y <= 2e+21) tmp = Float64(Float64(1.0 + Float64(x * 0.5)) - Float64(Float64(sqrt(y) + sqrt(x)) - sqrt(Float64(1.0 + y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 <= 7.5e-24)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + 2.0;
elseif (y <= 2e+21)
tmp = (1.0 + (x * 0.5)) - ((sqrt(y) + sqrt(x)) - sqrt((1.0 + y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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, 7.5e-24], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2e+21], N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + 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 7.5 \cdot 10^{-24}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+21}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) - \left(\left(\sqrt{y} + \sqrt{x}\right) - \sqrt{1 + y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 7.50000000000000007e-24Initial program 98.3%
associate-+l+98.3%
associate-+l-60.1%
+-commutative60.1%
sub-neg60.1%
sub-neg60.1%
+-commutative60.1%
+-commutative60.1%
Simplified60.1%
Taylor expanded in x around 0 55.1%
Taylor expanded in y around 0 55.1%
if 7.50000000000000007e-24 < y < 2e21Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-64.5%
associate-+l-49.5%
+-commutative49.5%
associate--l+49.5%
+-commutative49.5%
Simplified31.4%
Taylor expanded in t around inf 39.6%
+-commutative39.6%
+-commutative39.6%
associate--l+39.6%
Simplified39.6%
Taylor expanded in z around inf 32.3%
+-commutative32.3%
Simplified32.3%
Taylor expanded in x around 0 32.9%
if 2e21 < y Initial program 87.9%
associate-+l+87.9%
+-commutative87.9%
associate-+r-87.9%
associate-+l-55.4%
+-commutative55.4%
associate--l+55.4%
+-commutative55.4%
Simplified39.7%
Taylor expanded in t around inf 33.7%
+-commutative33.7%
+-commutative33.7%
associate--l+34.4%
Simplified34.4%
Taylor expanded in z around inf 17.9%
+-commutative17.9%
Simplified17.9%
Taylor expanded in y around inf 18.0%
flip--87.9%
add-sqr-sqrt73.9%
+-commutative73.9%
add-sqr-sqrt88.4%
+-commutative88.4%
Applied egg-rr18.3%
+-commutative88.4%
associate--l+90.8%
+-commutative90.8%
+-commutative90.8%
Simplified21.7%
Final simplification39.8%
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 8.5e-24)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 2e+21)
(- (+ 1.0 (* x 0.5)) (- (+ (sqrt y) (sqrt x)) (sqrt (+ 1.0 y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8.5e-24) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 2e+21) {
tmp = (1.0 + (x * 0.5)) - ((sqrt(y) + sqrt(x)) - sqrt((1.0 + y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 8.5d-24) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 2d+21) then
tmp = (1.0d0 + (x * 0.5d0)) - ((sqrt(y) + sqrt(x)) - sqrt((1.0d0 + y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8.5e-24) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 2e+21) {
tmp = (1.0 + (x * 0.5)) - ((Math.sqrt(y) + Math.sqrt(x)) - Math.sqrt((1.0 + y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 8.5e-24: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 2e+21: tmp = (1.0 + (x * 0.5)) - ((math.sqrt(y) + math.sqrt(x)) - math.sqrt((1.0 + y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 8.5e-24) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 2e+21) tmp = Float64(Float64(1.0 + Float64(x * 0.5)) - Float64(Float64(sqrt(y) + sqrt(x)) - sqrt(Float64(1.0 + y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 <= 8.5e-24)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 2e+21)
tmp = (1.0 + (x * 0.5)) - ((sqrt(y) + sqrt(x)) - sqrt((1.0 + y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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, 8.5e-24], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2e+21], N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + 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 8.5 \cdot 10^{-24}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+21}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) - \left(\left(\sqrt{y} + \sqrt{x}\right) - \sqrt{1 + y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 8.5000000000000002e-24Initial program 98.3%
associate-+l+98.3%
+-commutative98.3%
associate-+r-60.0%
associate-+l-54.5%
+-commutative54.5%
associate--l+54.5%
+-commutative54.5%
Simplified40.7%
Taylor expanded in t around inf 33.8%
+-commutative33.8%
+-commutative33.8%
associate--l+35.6%
Simplified35.6%
Taylor expanded in x around 0 34.0%
associate--l+52.6%
associate--l+52.6%
+-commutative52.6%
Simplified52.6%
Taylor expanded in y around 0 34.0%
associate--l+51.3%
Simplified51.3%
if 8.5000000000000002e-24 < y < 2e21Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-64.5%
associate-+l-49.5%
+-commutative49.5%
associate--l+49.5%
+-commutative49.5%
Simplified31.4%
Taylor expanded in t around inf 39.6%
+-commutative39.6%
+-commutative39.6%
associate--l+39.6%
Simplified39.6%
Taylor expanded in z around inf 32.3%
+-commutative32.3%
Simplified32.3%
Taylor expanded in x around 0 32.9%
if 2e21 < y Initial program 87.9%
associate-+l+87.9%
+-commutative87.9%
associate-+r-87.9%
associate-+l-55.4%
+-commutative55.4%
associate--l+55.4%
+-commutative55.4%
Simplified39.7%
Taylor expanded in t around inf 33.7%
+-commutative33.7%
+-commutative33.7%
associate--l+34.4%
Simplified34.4%
Taylor expanded in z around inf 17.9%
+-commutative17.9%
Simplified17.9%
Taylor expanded in y around inf 18.0%
flip--87.9%
add-sqr-sqrt73.9%
+-commutative73.9%
add-sqr-sqrt88.4%
+-commutative88.4%
Applied egg-rr18.3%
+-commutative88.4%
associate--l+90.8%
+-commutative90.8%
+-commutative90.8%
Simplified21.7%
Final simplification37.8%
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 7e-24)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 2e+21)
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt y) (sqrt x))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7e-24) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 2e+21) {
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(y) + sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 7d-24) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 2d+21) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(y) + sqrt(x)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7e-24) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 2e+21) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 7e-24: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 2e+21: tmp = 1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 7e-24) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 2e+21) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 <= 7e-24)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 2e+21)
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(y) + sqrt(x)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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, 7e-24], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2e+21], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + 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 7 \cdot 10^{-24}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+21}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 6.9999999999999993e-24Initial program 98.3%
associate-+l+98.3%
+-commutative98.3%
associate-+r-60.0%
associate-+l-54.5%
+-commutative54.5%
associate--l+54.5%
+-commutative54.5%
Simplified40.7%
Taylor expanded in t around inf 33.8%
+-commutative33.8%
+-commutative33.8%
associate--l+35.6%
Simplified35.6%
Taylor expanded in x around 0 34.0%
associate--l+52.6%
associate--l+52.6%
+-commutative52.6%
Simplified52.6%
Taylor expanded in y around 0 34.0%
associate--l+51.3%
Simplified51.3%
if 6.9999999999999993e-24 < y < 2e21Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-64.5%
associate-+l-49.5%
+-commutative49.5%
associate--l+49.5%
+-commutative49.5%
Simplified31.4%
Taylor expanded in t around inf 39.6%
+-commutative39.6%
+-commutative39.6%
associate--l+39.6%
Simplified39.6%
Taylor expanded in z around inf 32.3%
+-commutative32.3%
Simplified32.3%
Taylor expanded in x around 0 31.4%
if 2e21 < y Initial program 87.9%
associate-+l+87.9%
+-commutative87.9%
associate-+r-87.9%
associate-+l-55.4%
+-commutative55.4%
associate--l+55.4%
+-commutative55.4%
Simplified39.7%
Taylor expanded in t around inf 33.7%
+-commutative33.7%
+-commutative33.7%
associate--l+34.4%
Simplified34.4%
Taylor expanded in z around inf 17.9%
+-commutative17.9%
Simplified17.9%
Taylor expanded in y around inf 18.0%
flip--87.9%
add-sqr-sqrt73.9%
+-commutative73.9%
add-sqr-sqrt88.4%
+-commutative88.4%
Applied egg-rr18.3%
+-commutative88.4%
associate--l+90.8%
+-commutative90.8%
+-commutative90.8%
Simplified21.7%
Final simplification37.8%
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 4.6e-24)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 1e+22)
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.6e-24) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 1e+22) {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 4.6d-24) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 1d+22) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.6e-24) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 1e+22) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 4.6e-24: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 1e+22: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 4.6e-24) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 1e+22) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 <= 4.6e-24)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 1e+22)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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, 4.6e-24], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 1e+22], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + 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 4.6 \cdot 10^{-24}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 10^{+22}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 4.6000000000000002e-24Initial program 98.3%
associate-+l+98.3%
+-commutative98.3%
associate-+r-60.0%
associate-+l-54.5%
+-commutative54.5%
associate--l+54.5%
+-commutative54.5%
Simplified40.7%
Taylor expanded in t around inf 33.8%
+-commutative33.8%
+-commutative33.8%
associate--l+35.6%
Simplified35.6%
Taylor expanded in x around 0 34.0%
associate--l+52.6%
associate--l+52.6%
+-commutative52.6%
Simplified52.6%
Taylor expanded in y around 0 34.0%
associate--l+51.3%
Simplified51.3%
if 4.6000000000000002e-24 < y < 1e22Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-64.5%
associate-+l-49.5%
+-commutative49.5%
associate--l+49.5%
+-commutative49.5%
Simplified31.4%
Taylor expanded in t around inf 39.6%
+-commutative39.6%
+-commutative39.6%
associate--l+39.6%
Simplified39.6%
Taylor expanded in z around inf 32.3%
+-commutative32.3%
Simplified32.3%
Taylor expanded in x around 0 53.2%
associate--l+53.2%
Simplified53.2%
if 1e22 < y Initial program 87.9%
associate-+l+87.9%
+-commutative87.9%
associate-+r-87.9%
associate-+l-55.4%
+-commutative55.4%
associate--l+55.4%
+-commutative55.4%
Simplified39.7%
Taylor expanded in t around inf 33.7%
+-commutative33.7%
+-commutative33.7%
associate--l+34.4%
Simplified34.4%
Taylor expanded in z around inf 17.9%
+-commutative17.9%
Simplified17.9%
Taylor expanded in y around inf 18.0%
flip--87.9%
add-sqr-sqrt73.9%
+-commutative73.9%
add-sqr-sqrt88.4%
+-commutative88.4%
Applied egg-rr18.3%
+-commutative88.4%
associate--l+90.8%
+-commutative90.8%
+-commutative90.8%
Simplified21.7%
Final simplification38.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (- (sqrt (+ 1.0 x)) (sqrt x)))) (if (<= y 1.15) (+ 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 <= 1.15) {
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 <= 1.15d0) 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 <= 1.15) {
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 <= 1.15: 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 <= 1.15) 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 <= 1.15)
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, 1.15], 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 1.15:\\
\;\;\;\;1 + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < 1.1499999999999999Initial program 98.4%
associate-+l+98.4%
+-commutative98.4%
associate-+r-60.3%
associate-+l-54.7%
+-commutative54.7%
associate--l+54.7%
+-commutative54.7%
Simplified40.3%
Taylor expanded in t around inf 34.2%
+-commutative34.2%
+-commutative34.2%
associate--l+36.0%
Simplified36.0%
Taylor expanded in z around inf 20.3%
+-commutative20.3%
Simplified20.3%
Taylor expanded in y around 0 20.2%
associate--l+37.7%
Simplified37.7%
if 1.1499999999999999 < y Initial program 87.3%
associate-+l+87.3%
+-commutative87.3%
associate-+r-86.5%
associate-+l-54.6%
+-commutative54.6%
associate--l+54.6%
+-commutative54.6%
Simplified39.5%
Taylor expanded in t around inf 33.8%
+-commutative33.8%
+-commutative33.8%
associate--l+34.4%
Simplified34.4%
Taylor expanded in z around inf 18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in y around inf 18.5%
Final simplification29.0%
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 4.6e-24) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.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 (y <= 4.6e-24) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.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 (y <= 4.6d-24) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.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 (y <= 4.6e-24) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.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 y <= 4.6e-24: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.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 (y <= 4.6e-24) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.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 (y <= 4.6e-24)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.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[y, 4.6e-24], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.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}\;y \leq 4.6 \cdot 10^{-24}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if y < 4.6000000000000002e-24Initial program 98.3%
associate-+l+98.3%
+-commutative98.3%
associate-+r-60.0%
associate-+l-54.5%
+-commutative54.5%
associate--l+54.5%
+-commutative54.5%
Simplified40.7%
Taylor expanded in t around inf 33.8%
+-commutative33.8%
+-commutative33.8%
associate--l+35.6%
Simplified35.6%
Taylor expanded in x around 0 34.0%
associate--l+52.6%
associate--l+52.6%
+-commutative52.6%
Simplified52.6%
Taylor expanded in y around 0 34.0%
associate--l+51.3%
Simplified51.3%
if 4.6000000000000002e-24 < y Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-85.7%
associate-+l-54.8%
+-commutative54.8%
associate--l+54.8%
+-commutative54.8%
Simplified38.9%
Taylor expanded in t around inf 34.2%
+-commutative34.2%
+-commutative34.2%
associate--l+34.8%
Simplified34.8%
Taylor expanded in z around inf 19.2%
+-commutative19.2%
Simplified19.2%
Taylor expanded in x around 0 9.0%
associate--l+43.6%
Simplified43.6%
Final simplification47.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \sqrt{y}\right)
\end{array}
Initial program 93.4%
associate-+l+93.4%
+-commutative93.4%
associate-+r-72.2%
associate-+l-54.7%
+-commutative54.7%
associate--l+54.7%
+-commutative54.7%
Simplified39.9%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+35.3%
Simplified35.3%
Taylor expanded in z around inf 19.6%
+-commutative19.6%
Simplified19.6%
Taylor expanded in x around 0 26.6%
associate--l+43.0%
Simplified43.0%
Final simplification43.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ 1.0 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + x)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((1.0d0 + x)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + x)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + x} - \sqrt{x}
\end{array}
Initial program 93.4%
associate-+l+93.4%
+-commutative93.4%
associate-+r-72.2%
associate-+l-54.7%
+-commutative54.7%
associate--l+54.7%
+-commutative54.7%
Simplified39.9%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+35.3%
Simplified35.3%
Taylor expanded in z around inf 19.6%
+-commutative19.6%
Simplified19.6%
Taylor expanded in y around inf 14.2%
Final simplification14.2%
(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 2023199
(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))))