
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (- t_1 (sqrt x)))
(t_3 (sqrt (+ 1.0 z)))
(t_4 (- t_3 (sqrt z)))
(t_5 (sqrt (+ 1.0 y)))
(t_6 (+ t_4 (+ (- t_5 (sqrt y)) t_2)))
(t_7 (sqrt (+ 1.0 t))))
(if (<= t_6 4e-7)
(+
(/ 1.0 (+ (sqrt x) t_1))
(+ (+ t_4 (- t_7 (sqrt t))) (/ 1.0 (+ 1.0 (sqrt y)))))
(if (<= t_6 2.9999999998)
(+
t_1
(+
(/ 1.0 (+ t_5 (sqrt y)))
(- (/ (+ 1.0 (- z z)) (+ t_3 (sqrt z))) (sqrt x))))
(+ t_2 (+ 1.0 (+ t_4 (/ (+ 1.0 (- t t)) (+ t_7 (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 + x));
double t_2 = t_1 - sqrt(x);
double t_3 = sqrt((1.0 + z));
double t_4 = t_3 - sqrt(z);
double t_5 = sqrt((1.0 + y));
double t_6 = t_4 + ((t_5 - sqrt(y)) + t_2);
double t_7 = sqrt((1.0 + t));
double tmp;
if (t_6 <= 4e-7) {
tmp = (1.0 / (sqrt(x) + t_1)) + ((t_4 + (t_7 - sqrt(t))) + (1.0 / (1.0 + sqrt(y))));
} else if (t_6 <= 2.9999999998) {
tmp = t_1 + ((1.0 / (t_5 + sqrt(y))) + (((1.0 + (z - z)) / (t_3 + sqrt(z))) - sqrt(x)));
} else {
tmp = t_2 + (1.0 + (t_4 + ((1.0 + (t - t)) / (t_7 + sqrt(t)))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = t_1 - sqrt(x)
t_3 = sqrt((1.0d0 + z))
t_4 = t_3 - sqrt(z)
t_5 = sqrt((1.0d0 + y))
t_6 = t_4 + ((t_5 - sqrt(y)) + t_2)
t_7 = sqrt((1.0d0 + t))
if (t_6 <= 4d-7) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + ((t_4 + (t_7 - sqrt(t))) + (1.0d0 / (1.0d0 + sqrt(y))))
else if (t_6 <= 2.9999999998d0) then
tmp = t_1 + ((1.0d0 / (t_5 + sqrt(y))) + (((1.0d0 + (z - z)) / (t_3 + sqrt(z))) - sqrt(x)))
else
tmp = t_2 + (1.0d0 + (t_4 + ((1.0d0 + (t - t)) / (t_7 + sqrt(t)))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = t_1 - Math.sqrt(x);
double t_3 = Math.sqrt((1.0 + z));
double t_4 = t_3 - Math.sqrt(z);
double t_5 = Math.sqrt((1.0 + y));
double t_6 = t_4 + ((t_5 - Math.sqrt(y)) + t_2);
double t_7 = Math.sqrt((1.0 + t));
double tmp;
if (t_6 <= 4e-7) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + ((t_4 + (t_7 - Math.sqrt(t))) + (1.0 / (1.0 + Math.sqrt(y))));
} else if (t_6 <= 2.9999999998) {
tmp = t_1 + ((1.0 / (t_5 + Math.sqrt(y))) + (((1.0 + (z - z)) / (t_3 + Math.sqrt(z))) - Math.sqrt(x)));
} else {
tmp = t_2 + (1.0 + (t_4 + ((1.0 + (t - t)) / (t_7 + Math.sqrt(t)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = t_1 - math.sqrt(x) t_3 = math.sqrt((1.0 + z)) t_4 = t_3 - math.sqrt(z) t_5 = math.sqrt((1.0 + y)) t_6 = t_4 + ((t_5 - math.sqrt(y)) + t_2) t_7 = math.sqrt((1.0 + t)) tmp = 0 if t_6 <= 4e-7: tmp = (1.0 / (math.sqrt(x) + t_1)) + ((t_4 + (t_7 - math.sqrt(t))) + (1.0 / (1.0 + math.sqrt(y)))) elif t_6 <= 2.9999999998: tmp = t_1 + ((1.0 / (t_5 + math.sqrt(y))) + (((1.0 + (z - z)) / (t_3 + math.sqrt(z))) - math.sqrt(x))) else: tmp = t_2 + (1.0 + (t_4 + ((1.0 + (t - t)) / (t_7 + math.sqrt(t))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(t_1 - sqrt(x)) t_3 = sqrt(Float64(1.0 + z)) t_4 = Float64(t_3 - sqrt(z)) t_5 = sqrt(Float64(1.0 + y)) t_6 = Float64(t_4 + Float64(Float64(t_5 - sqrt(y)) + t_2)) t_7 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_6 <= 4e-7) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(Float64(t_4 + Float64(t_7 - sqrt(t))) + Float64(1.0 / Float64(1.0 + sqrt(y))))); elseif (t_6 <= 2.9999999998) tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(t_5 + sqrt(y))) + Float64(Float64(Float64(1.0 + Float64(z - z)) / Float64(t_3 + sqrt(z))) - sqrt(x)))); else tmp = Float64(t_2 + Float64(1.0 + Float64(t_4 + Float64(Float64(1.0 + Float64(t - t)) / Float64(t_7 + sqrt(t)))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = t_1 - sqrt(x);
t_3 = sqrt((1.0 + z));
t_4 = t_3 - sqrt(z);
t_5 = sqrt((1.0 + y));
t_6 = t_4 + ((t_5 - sqrt(y)) + t_2);
t_7 = sqrt((1.0 + t));
tmp = 0.0;
if (t_6 <= 4e-7)
tmp = (1.0 / (sqrt(x) + t_1)) + ((t_4 + (t_7 - sqrt(t))) + (1.0 / (1.0 + sqrt(y))));
elseif (t_6 <= 2.9999999998)
tmp = t_1 + ((1.0 / (t_5 + sqrt(y))) + (((1.0 + (z - z)) / (t_3 + sqrt(z))) - sqrt(x)));
else
tmp = t_2 + (1.0 + (t_4 + ((1.0 + (t - t)) / (t_7 + sqrt(t)))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$4 + N[(N[(t$95$5 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$6, 4e-7], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$4 + N[(t$95$7 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 2.9999999998], N[(t$95$1 + N[(N[(1.0 / N[(t$95$5 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + N[(z - z), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(1.0 + N[(t$95$4 + N[(N[(1.0 + N[(t - t), $MachinePrecision]), $MachinePrecision] / N[(t$95$7 + N[Sqrt[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 := t_1 - \sqrt{x}\\
t_3 := \sqrt{1 + z}\\
t_4 := t_3 - \sqrt{z}\\
t_5 := \sqrt{1 + y}\\
t_6 := t_4 + \left(\left(t_5 - \sqrt{y}\right) + t_2\right)\\
t_7 := \sqrt{1 + t}\\
\mathbf{if}\;t_6 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1} + \left(\left(t_4 + \left(t_7 - \sqrt{t}\right)\right) + \frac{1}{1 + \sqrt{y}}\right)\\
\mathbf{elif}\;t_6 \leq 2.9999999998:\\
\;\;\;\;t_1 + \left(\frac{1}{t_5 + \sqrt{y}} + \left(\frac{1 + \left(z - z\right)}{t_3 + \sqrt{z}} - \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(1 + \left(t_4 + \frac{1 + \left(t - t\right)}{t_7 + \sqrt{t}}\right)\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))) < 3.9999999999999998e-7Initial program 51.4%
associate-+l+51.4%
associate-+l+51.4%
associate-+r+51.4%
+-commutative51.4%
sub-neg51.4%
+-commutative51.4%
sub-neg51.4%
+-commutative51.4%
Simplified51.4%
flip--52.5%
add-sqr-sqrt28.6%
+-commutative28.6%
add-sqr-sqrt52.5%
+-commutative52.5%
Applied egg-rr52.5%
associate--l+67.8%
+-inverses67.8%
metadata-eval67.8%
+-commutative67.8%
Simplified67.8%
flip--67.8%
add-sqr-sqrt47.7%
add-sqr-sqrt67.8%
Applied egg-rr67.8%
associate--l+71.3%
+-inverses71.3%
metadata-eval71.3%
Simplified71.3%
Taylor expanded in y around 0 68.5%
if 3.9999999999999998e-7 < (+.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.9999999998Initial program 97.1%
associate-+l+97.1%
+-commutative97.1%
associate-+r-72.8%
associate-+l-57.0%
+-commutative57.0%
associate--l+57.0%
+-commutative57.0%
Simplified32.4%
Taylor expanded in t around inf 31.3%
+-commutative31.3%
+-commutative31.3%
associate--l+32.8%
Simplified32.8%
flip--32.9%
add-sqr-sqrt23.2%
add-sqr-sqrt32.9%
+-commutative32.9%
+-commutative32.9%
Applied egg-rr32.9%
+-commutative32.9%
associate--r+33.0%
+-commutative33.0%
Simplified33.0%
flip--98.1%
add-sqr-sqrt74.4%
add-sqr-sqrt98.2%
Applied egg-rr33.1%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified33.2%
if 2.9999999998 < (+.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 96.5%
associate-+l+96.5%
associate-+l+96.5%
associate-+r+96.5%
+-commutative96.5%
sub-neg96.5%
+-commutative96.5%
sub-neg96.5%
+-commutative96.5%
Simplified96.5%
flip--96.4%
add-sqr-sqrt80.6%
+-commutative80.6%
add-sqr-sqrt97.5%
+-commutative97.5%
Applied egg-rr97.5%
+-commutative97.5%
associate--l+100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Final simplification41.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (- t_3 (sqrt x))))
(if (<= (+ (- t_2 (sqrt y)) t_4) 4e-7)
(+ (/ 1.0 (+ (sqrt x) t_3)) (+ t_1 (/ 1.0 (+ 1.0 (sqrt y)))))
(+ (+ (/ 1.0 (+ t_2 (sqrt y))) t_1) t_4))))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)) + (sqrt((1.0 + t)) - sqrt(t));
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((1.0 + x));
double t_4 = t_3 - sqrt(x);
double tmp;
if (((t_2 - sqrt(y)) + t_4) <= 4e-7) {
tmp = (1.0 / (sqrt(x) + t_3)) + (t_1 + (1.0 / (1.0 + sqrt(y))));
} else {
tmp = ((1.0 / (t_2 + sqrt(y))) + t_1) + t_4;
}
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 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))
t_2 = sqrt((1.0d0 + y))
t_3 = sqrt((1.0d0 + x))
t_4 = t_3 - sqrt(x)
if (((t_2 - sqrt(y)) + t_4) <= 4d-7) then
tmp = (1.0d0 / (sqrt(x) + t_3)) + (t_1 + (1.0d0 / (1.0d0 + sqrt(y))))
else
tmp = ((1.0d0 / (t_2 + sqrt(y))) + t_1) + t_4
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)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t));
double t_2 = Math.sqrt((1.0 + y));
double t_3 = Math.sqrt((1.0 + x));
double t_4 = t_3 - Math.sqrt(x);
double tmp;
if (((t_2 - Math.sqrt(y)) + t_4) <= 4e-7) {
tmp = (1.0 / (Math.sqrt(x) + t_3)) + (t_1 + (1.0 / (1.0 + Math.sqrt(y))));
} else {
tmp = ((1.0 / (t_2 + Math.sqrt(y))) + t_1) + t_4;
}
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)) + (math.sqrt((1.0 + t)) - math.sqrt(t)) t_2 = math.sqrt((1.0 + y)) t_3 = math.sqrt((1.0 + x)) t_4 = t_3 - math.sqrt(x) tmp = 0 if ((t_2 - math.sqrt(y)) + t_4) <= 4e-7: tmp = (1.0 / (math.sqrt(x) + t_3)) + (t_1 + (1.0 / (1.0 + math.sqrt(y)))) else: tmp = ((1.0 / (t_2 + math.sqrt(y))) + t_1) + t_4 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) t_2 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(t_3 - sqrt(x)) tmp = 0.0 if (Float64(Float64(t_2 - sqrt(y)) + t_4) <= 4e-7) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(t_1 + Float64(1.0 / Float64(1.0 + sqrt(y))))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + t_1) + t_4); 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)) + (sqrt((1.0 + t)) - sqrt(t));
t_2 = sqrt((1.0 + y));
t_3 = sqrt((1.0 + x));
t_4 = t_3 - sqrt(x);
tmp = 0.0;
if (((t_2 - sqrt(y)) + t_4) <= 4e-7)
tmp = (1.0 / (sqrt(x) + t_3)) + (t_1 + (1.0 / (1.0 + sqrt(y))));
else
tmp = ((1.0 / (t_2 + sqrt(y))) + t_1) + t_4;
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[(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]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision], 4e-7], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + t$95$4), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + x}\\
t_4 := t_3 - \sqrt{x}\\
\mathbf{if}\;\left(t_2 - \sqrt{y}\right) + t_4 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_3} + \left(t_1 + \frac{1}{1 + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t_2 + \sqrt{y}} + t_1\right) + t_4\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 3.9999999999999998e-7Initial program 73.1%
associate-+l+73.1%
associate-+l+73.1%
associate-+r+73.1%
+-commutative73.1%
sub-neg73.1%
+-commutative73.1%
sub-neg73.1%
+-commutative73.1%
Simplified73.1%
flip--73.6%
add-sqr-sqrt35.5%
+-commutative35.5%
add-sqr-sqrt74.1%
+-commutative74.1%
Applied egg-rr74.1%
associate--l+82.8%
+-inverses82.8%
metadata-eval82.8%
+-commutative82.8%
Simplified82.8%
flip--82.8%
add-sqr-sqrt46.6%
add-sqr-sqrt82.8%
Applied egg-rr82.8%
associate--l+84.6%
+-inverses84.6%
metadata-eval84.6%
Simplified84.6%
Taylor expanded in y around 0 83.1%
if 3.9999999999999998e-7 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 97.2%
associate-+l+97.2%
associate-+l+97.2%
associate-+r+97.2%
+-commutative97.2%
sub-neg97.2%
+-commutative97.2%
sub-neg97.2%
+-commutative97.2%
Simplified97.2%
flip--97.9%
add-sqr-sqrt80.4%
add-sqr-sqrt98.1%
Applied egg-rr97.6%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
Simplified98.0%
Final simplification94.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 x) (sqrt (+ 1.0 x)))) (+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\right)
\end{array}
Initial program 91.9%
associate-+l+91.9%
associate-+l+91.9%
associate-+r+91.9%
+-commutative91.9%
sub-neg91.9%
+-commutative91.9%
sub-neg91.9%
+-commutative91.9%
Simplified91.9%
flip--92.0%
add-sqr-sqrt69.6%
+-commutative69.6%
add-sqr-sqrt92.2%
+-commutative92.2%
Applied egg-rr92.2%
associate--l+94.4%
+-inverses94.4%
metadata-eval94.4%
+-commutative94.4%
Simplified94.4%
flip--94.6%
add-sqr-sqrt72.8%
add-sqr-sqrt94.7%
Applied egg-rr94.7%
associate--l+95.4%
+-inverses95.4%
metadata-eval95.4%
Simplified95.4%
Final simplification95.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (+ (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))) (- (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(x) + sqrt((1.0 + x)))) + (((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (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(x) + sqrt((1.0d0 + x)))) + (((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (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(x) + Math.sqrt((1.0 + x)))) + (((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (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(x) + math.sqrt((1.0 + x)))) + (((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (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(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + 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(x) + sqrt((1.0 + x)))) + (((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (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[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)
\end{array}
Initial program 91.9%
associate-+l+91.9%
associate-+l+91.9%
associate-+r+91.9%
+-commutative91.9%
sub-neg91.9%
+-commutative91.9%
sub-neg91.9%
+-commutative91.9%
Simplified91.9%
flip--92.0%
add-sqr-sqrt69.6%
+-commutative69.6%
add-sqr-sqrt92.2%
+-commutative92.2%
Applied egg-rr92.2%
associate--l+94.4%
+-inverses94.4%
metadata-eval94.4%
+-commutative94.4%
Simplified94.4%
Final simplification94.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))) (t_2 (sqrt (+ 1.0 x))))
(if (<= y 1.7e-109)
(+
(- t_2 (sqrt x))
(+ 1.0 (+ (- t_1 (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))))
(if (<= y 7.2e+28)
(+
t_2
(+
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))
(- (/ (+ 1.0 (- z z)) (+ t_1 (sqrt z))) (sqrt x))))
(/ 1.0 (+ (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));
double t_2 = sqrt((1.0 + x));
double tmp;
if (y <= 1.7e-109) {
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))));
} else if (y <= 7.2e+28) {
tmp = t_2 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (((1.0 + (z - z)) / (t_1 + sqrt(z))) - sqrt(x)));
} else {
tmp = 1.0 / (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))
t_2 = sqrt((1.0d0 + x))
if (y <= 1.7d-109) then
tmp = (t_2 - sqrt(x)) + (1.0d0 + ((t_1 - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))))
else if (y <= 7.2d+28) then
tmp = t_2 + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (((1.0d0 + (z - z)) / (t_1 + sqrt(z))) - sqrt(x)))
else
tmp = 1.0d0 / (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));
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.7e-109) {
tmp = (t_2 - Math.sqrt(x)) + (1.0 + ((t_1 - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))));
} else if (y <= 7.2e+28) {
tmp = t_2 + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (((1.0 + (z - z)) / (t_1 + Math.sqrt(z))) - Math.sqrt(x)));
} else {
tmp = 1.0 / (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)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.7e-109: tmp = (t_2 - math.sqrt(x)) + (1.0 + ((t_1 - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t)))) elif y <= 7.2e+28: tmp = t_2 + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (((1.0 + (z - z)) / (t_1 + math.sqrt(z))) - math.sqrt(x))) else: tmp = 1.0 / (math.sqrt(x) + 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 + z)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.7e-109) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 + Float64(Float64(t_1 - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))))); elseif (y <= 7.2e+28) tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(Float64(Float64(1.0 + Float64(z - z)) / Float64(t_1 + sqrt(z))) - sqrt(x)))); else tmp = Float64(1.0 / 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));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.7e-109)
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))));
elseif (y <= 7.2e+28)
tmp = t_2 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (((1.0 + (z - z)) / (t_1 + sqrt(z))) - sqrt(x)));
else
tmp = 1.0 / (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[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.7e-109], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+28], N[(t$95$2 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + N[(z - z), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.7 \cdot 10^{-109}:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(1 + \left(\left(t_1 - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\right)\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+28}:\\
\;\;\;\;t_2 + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\frac{1 + \left(z - z\right)}{t_1 + \sqrt{z}} - \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_2}\\
\end{array}
\end{array}
if y < 1.70000000000000006e-109Initial program 96.6%
associate-+l+96.6%
associate-+l+96.6%
associate-+r+96.6%
+-commutative96.6%
sub-neg96.6%
+-commutative96.6%
sub-neg96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in y around 0 96.6%
if 1.70000000000000006e-109 < y < 7.1999999999999999e28Initial program 95.8%
associate-+l+95.9%
+-commutative95.9%
associate-+r-60.6%
associate-+l-53.7%
+-commutative53.7%
associate--l+53.7%
+-commutative53.7%
Simplified33.7%
Taylor expanded in t around inf 32.7%
+-commutative32.7%
+-commutative32.7%
associate--l+32.7%
Simplified32.7%
flip--32.7%
add-sqr-sqrt23.3%
add-sqr-sqrt32.7%
+-commutative32.7%
+-commutative32.7%
Applied egg-rr32.7%
+-commutative32.7%
associate--r+32.8%
+-commutative32.8%
Simplified32.8%
flip--96.5%
add-sqr-sqrt93.7%
add-sqr-sqrt97.2%
Applied egg-rr32.9%
associate--l+99.1%
+-inverses99.1%
metadata-eval99.1%
Simplified33.5%
if 7.1999999999999999e28 < y Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-87.4%
associate-+l-59.2%
+-commutative59.2%
associate--l+59.2%
+-commutative59.2%
Simplified37.9%
Taylor expanded in t around inf 32.3%
+-commutative32.3%
+-commutative32.3%
associate--l+32.4%
Simplified32.4%
Taylor expanded in z around inf 21.0%
+-commutative21.0%
Simplified21.0%
Taylor expanded in y around inf 20.8%
flip--20.8%
add-sqr-sqrt21.1%
add-sqr-sqrt20.8%
+-commutative20.8%
Applied egg-rr20.8%
associate--l+25.0%
+-inverses25.0%
metadata-eval25.0%
Simplified25.0%
Final simplification48.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 z))) (t_2 (sqrt (+ 1.0 x))))
(if (<= y 1.7e-109)
(+
(- t_2 (sqrt x))
(+
1.0
(+ (- t_1 (sqrt z)) (/ (+ 1.0 (- t t)) (+ (sqrt (+ 1.0 t)) (sqrt t))))))
(if (<= y 7.2e+28)
(+
t_2
(+
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))
(- (/ (+ 1.0 (- z z)) (+ t_1 (sqrt z))) (sqrt x))))
(/ 1.0 (+ (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));
double t_2 = sqrt((1.0 + x));
double tmp;
if (y <= 1.7e-109) {
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 - sqrt(z)) + ((1.0 + (t - t)) / (sqrt((1.0 + t)) + sqrt(t)))));
} else if (y <= 7.2e+28) {
tmp = t_2 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (((1.0 + (z - z)) / (t_1 + sqrt(z))) - sqrt(x)));
} else {
tmp = 1.0 / (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))
t_2 = sqrt((1.0d0 + x))
if (y <= 1.7d-109) then
tmp = (t_2 - sqrt(x)) + (1.0d0 + ((t_1 - sqrt(z)) + ((1.0d0 + (t - t)) / (sqrt((1.0d0 + t)) + sqrt(t)))))
else if (y <= 7.2d+28) then
tmp = t_2 + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (((1.0d0 + (z - z)) / (t_1 + sqrt(z))) - sqrt(x)))
else
tmp = 1.0d0 / (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));
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.7e-109) {
tmp = (t_2 - Math.sqrt(x)) + (1.0 + ((t_1 - Math.sqrt(z)) + ((1.0 + (t - t)) / (Math.sqrt((1.0 + t)) + Math.sqrt(t)))));
} else if (y <= 7.2e+28) {
tmp = t_2 + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (((1.0 + (z - z)) / (t_1 + Math.sqrt(z))) - Math.sqrt(x)));
} else {
tmp = 1.0 / (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)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.7e-109: tmp = (t_2 - math.sqrt(x)) + (1.0 + ((t_1 - math.sqrt(z)) + ((1.0 + (t - t)) / (math.sqrt((1.0 + t)) + math.sqrt(t))))) elif y <= 7.2e+28: tmp = t_2 + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (((1.0 + (z - z)) / (t_1 + math.sqrt(z))) - math.sqrt(x))) else: tmp = 1.0 / (math.sqrt(x) + 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 + z)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.7e-109) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 + Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 + Float64(t - t)) / Float64(sqrt(Float64(1.0 + t)) + sqrt(t)))))); elseif (y <= 7.2e+28) tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(Float64(Float64(1.0 + Float64(z - z)) / Float64(t_1 + sqrt(z))) - sqrt(x)))); else tmp = Float64(1.0 / 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));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.7e-109)
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 - sqrt(z)) + ((1.0 + (t - t)) / (sqrt((1.0 + t)) + sqrt(t)))));
elseif (y <= 7.2e+28)
tmp = t_2 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (((1.0 + (z - z)) / (t_1 + sqrt(z))) - sqrt(x)));
else
tmp = 1.0 / (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[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.7e-109], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(t - t), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+28], N[(t$95$2 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + N[(z - z), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.7 \cdot 10^{-109}:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(1 + \left(\left(t_1 - \sqrt{z}\right) + \frac{1 + \left(t - t\right)}{\sqrt{1 + t} + \sqrt{t}}\right)\right)\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+28}:\\
\;\;\;\;t_2 + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\frac{1 + \left(z - z\right)}{t_1 + \sqrt{z}} - \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_2}\\
\end{array}
\end{array}
if y < 1.70000000000000006e-109Initial program 96.6%
associate-+l+96.6%
associate-+l+96.6%
associate-+r+96.6%
+-commutative96.6%
sub-neg96.6%
+-commutative96.6%
sub-neg96.6%
+-commutative96.6%
Simplified96.6%
flip--96.6%
add-sqr-sqrt74.2%
+-commutative74.2%
add-sqr-sqrt97.1%
+-commutative97.1%
Applied egg-rr97.1%
+-commutative97.1%
associate--l+97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in y around 0 97.7%
if 1.70000000000000006e-109 < y < 7.1999999999999999e28Initial program 95.8%
associate-+l+95.9%
+-commutative95.9%
associate-+r-60.6%
associate-+l-53.7%
+-commutative53.7%
associate--l+53.7%
+-commutative53.7%
Simplified33.7%
Taylor expanded in t around inf 32.7%
+-commutative32.7%
+-commutative32.7%
associate--l+32.7%
Simplified32.7%
flip--32.7%
add-sqr-sqrt23.3%
add-sqr-sqrt32.7%
+-commutative32.7%
+-commutative32.7%
Applied egg-rr32.7%
+-commutative32.7%
associate--r+32.8%
+-commutative32.8%
Simplified32.8%
flip--96.5%
add-sqr-sqrt93.7%
add-sqr-sqrt97.2%
Applied egg-rr32.9%
associate--l+99.1%
+-inverses99.1%
metadata-eval99.1%
Simplified33.5%
if 7.1999999999999999e28 < y Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-87.4%
associate-+l-59.2%
+-commutative59.2%
associate--l+59.2%
+-commutative59.2%
Simplified37.9%
Taylor expanded in t around inf 32.3%
+-commutative32.3%
+-commutative32.3%
associate--l+32.4%
Simplified32.4%
Taylor expanded in z around inf 21.0%
+-commutative21.0%
Simplified21.0%
Taylor expanded in y around inf 20.8%
flip--20.8%
add-sqr-sqrt21.1%
add-sqr-sqrt20.8%
+-commutative20.8%
Applied egg-rr20.8%
associate--l+25.0%
+-inverses25.0%
metadata-eval25.0%
Simplified25.0%
Final simplification49.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))) (t_2 (sqrt (+ 1.0 x))))
(if (<= y 1.7e-109)
(+
(- t_2 (sqrt x))
(+ 1.0 (+ (- t_1 (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))))
(if (<= y 7.2e+28)
(+
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))
(+ 1.0 (/ 1.0 (+ t_1 (sqrt z)))))
(/ 1.0 (+ (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));
double t_2 = sqrt((1.0 + x));
double tmp;
if (y <= 1.7e-109) {
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))));
} else if (y <= 7.2e+28) {
tmp = (1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 + (1.0 / (t_1 + sqrt(z))));
} else {
tmp = 1.0 / (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))
t_2 = sqrt((1.0d0 + x))
if (y <= 1.7d-109) then
tmp = (t_2 - sqrt(x)) + (1.0d0 + ((t_1 - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))))
else if (y <= 7.2d+28) then
tmp = (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (1.0d0 + (1.0d0 / (t_1 + sqrt(z))))
else
tmp = 1.0d0 / (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));
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.7e-109) {
tmp = (t_2 - Math.sqrt(x)) + (1.0 + ((t_1 - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))));
} else if (y <= 7.2e+28) {
tmp = (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (1.0 + (1.0 / (t_1 + Math.sqrt(z))));
} else {
tmp = 1.0 / (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)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.7e-109: tmp = (t_2 - math.sqrt(x)) + (1.0 + ((t_1 - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t)))) elif y <= 7.2e+28: tmp = (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (1.0 + (1.0 / (t_1 + math.sqrt(z)))) else: tmp = 1.0 / (math.sqrt(x) + 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 + z)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.7e-109) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 + Float64(Float64(t_1 - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))))); elseif (y <= 7.2e+28) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(1.0 + Float64(1.0 / Float64(t_1 + sqrt(z))))); else tmp = Float64(1.0 / 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));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.7e-109)
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))));
elseif (y <= 7.2e+28)
tmp = (1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 + (1.0 / (t_1 + sqrt(z))));
else
tmp = 1.0 / (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[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.7e-109], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+28], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.7 \cdot 10^{-109}:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(1 + \left(\left(t_1 - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\right)\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+28}:\\
\;\;\;\;\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(1 + \frac{1}{t_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_2}\\
\end{array}
\end{array}
if y < 1.70000000000000006e-109Initial program 96.6%
associate-+l+96.6%
associate-+l+96.6%
associate-+r+96.6%
+-commutative96.6%
sub-neg96.6%
+-commutative96.6%
sub-neg96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in y around 0 96.6%
if 1.70000000000000006e-109 < y < 7.1999999999999999e28Initial program 95.8%
associate-+l+95.9%
+-commutative95.9%
associate-+r-60.6%
associate-+l-53.7%
+-commutative53.7%
associate--l+53.7%
+-commutative53.7%
Simplified33.7%
Taylor expanded in t around inf 32.7%
+-commutative32.7%
+-commutative32.7%
associate--l+32.7%
Simplified32.7%
flip--32.7%
add-sqr-sqrt23.3%
add-sqr-sqrt32.7%
+-commutative32.7%
+-commutative32.7%
Applied egg-rr32.7%
+-commutative32.7%
associate--r+32.8%
+-commutative32.8%
Simplified32.8%
flip--96.5%
add-sqr-sqrt93.7%
add-sqr-sqrt97.2%
Applied egg-rr32.9%
associate--l+99.1%
+-inverses99.1%
metadata-eval99.1%
Simplified33.5%
Taylor expanded in x around 0 55.1%
associate-+r+55.2%
+-commutative55.2%
+-commutative55.2%
associate-+l+55.2%
Simplified55.2%
if 7.1999999999999999e28 < y Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-87.4%
associate-+l-59.2%
+-commutative59.2%
associate--l+59.2%
+-commutative59.2%
Simplified37.9%
Taylor expanded in t around inf 32.3%
+-commutative32.3%
+-commutative32.3%
associate--l+32.4%
Simplified32.4%
Taylor expanded in z around inf 21.0%
+-commutative21.0%
Simplified21.0%
Taylor expanded in y around inf 20.8%
flip--20.8%
add-sqr-sqrt21.1%
add-sqr-sqrt20.8%
+-commutative20.8%
Applied egg-rr20.8%
associate--l+25.0%
+-inverses25.0%
metadata-eval25.0%
Simplified25.0%
Final simplification52.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 (<= x 4.4e-30)
(+
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))
(+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))
(/ 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) {
double tmp;
if (x <= 4.4e-30) {
tmp = (1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
} else {
tmp = 1.0 / (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 (x <= 4.4d-30) then
tmp = (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (1.0d0 + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))
else
tmp = 1.0d0 / (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 (x <= 4.4e-30) {
tmp = (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (1.0 + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))));
} else {
tmp = 1.0 / (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 x <= 4.4e-30: tmp = (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (1.0 + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) else: tmp = 1.0 / (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 (x <= 4.4e-30) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))); else tmp = Float64(1.0 / 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 (x <= 4.4e-30)
tmp = (1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
else
tmp = 1.0 / (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[x, 4.4e-30], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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}\;x \leq 4.4 \cdot 10^{-30}:\\
\;\;\;\;\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(1 + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if x < 4.39999999999999967e-30Initial program 97.7%
associate-+l+97.7%
+-commutative97.7%
associate-+r-97.7%
associate-+l-97.7%
+-commutative97.7%
associate--l+97.7%
+-commutative97.7%
Simplified60.7%
Taylor expanded in t around inf 53.3%
+-commutative53.3%
+-commutative53.3%
associate--l+53.3%
Simplified53.3%
flip--53.3%
add-sqr-sqrt39.4%
add-sqr-sqrt53.3%
+-commutative53.3%
+-commutative53.3%
Applied egg-rr53.3%
+-commutative53.3%
associate--r+53.6%
+-commutative53.6%
Simplified53.6%
flip--97.8%
add-sqr-sqrt70.5%
add-sqr-sqrt97.8%
Applied egg-rr53.6%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
Simplified53.8%
Taylor expanded in x around 0 53.8%
associate-+r+53.8%
+-commutative53.8%
+-commutative53.8%
associate-+l+53.9%
Simplified53.9%
if 4.39999999999999967e-30 < x Initial program 86.9%
associate-+l+86.9%
+-commutative86.9%
associate-+r-49.9%
associate-+l-17.2%
+-commutative17.2%
associate--l+17.2%
+-commutative17.2%
Simplified10.3%
Taylor expanded in t around inf 9.5%
+-commutative9.5%
+-commutative9.5%
associate--l+11.6%
Simplified11.6%
Taylor expanded in z around inf 8.8%
+-commutative8.8%
Simplified8.8%
Taylor expanded in y around inf 5.4%
flip--5.4%
add-sqr-sqrt6.0%
add-sqr-sqrt5.4%
+-commutative5.4%
Applied egg-rr5.4%
associate--l+10.9%
+-inverses10.9%
metadata-eval10.9%
Simplified10.9%
Final simplification30.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 4.4e-30)
(+
1.0
(+ (sqrt (+ 1.0 y)) (- (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) (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) {
double tmp;
if (x <= 4.4e-30) {
tmp = 1.0 + (sqrt((1.0 + y)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) - sqrt(y)));
} else {
tmp = 1.0 / (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 (x <= 4.4d-30) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) - sqrt(y)))
else
tmp = 1.0d0 / (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 (x <= 4.4e-30) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) - Math.sqrt(y)));
} else {
tmp = 1.0 / (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 x <= 4.4e-30: tmp = 1.0 + (math.sqrt((1.0 + y)) + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) - math.sqrt(y))) else: tmp = 1.0 / (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 (x <= 4.4e-30) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) - sqrt(y)))); else tmp = Float64(1.0 / 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 (x <= 4.4e-30)
tmp = 1.0 + (sqrt((1.0 + y)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) - sqrt(y)));
else
tmp = 1.0 / (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[x, 4.4e-30], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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}\;x \leq 4.4 \cdot 10^{-30}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if x < 4.39999999999999967e-30Initial program 97.7%
associate-+l+97.7%
+-commutative97.7%
associate-+r-97.7%
associate-+l-97.7%
+-commutative97.7%
associate--l+97.7%
+-commutative97.7%
Simplified60.7%
Taylor expanded in t around inf 53.3%
+-commutative53.3%
+-commutative53.3%
associate--l+53.3%
Simplified53.3%
flip--53.3%
add-sqr-sqrt39.4%
add-sqr-sqrt53.3%
+-commutative53.3%
+-commutative53.3%
Applied egg-rr53.3%
+-commutative53.3%
associate--r+53.6%
+-commutative53.6%
Simplified53.6%
Taylor expanded in x around 0 26.2%
associate--l+43.2%
associate--l+43.2%
+-commutative43.2%
Simplified43.2%
if 4.39999999999999967e-30 < x Initial program 86.9%
associate-+l+86.9%
+-commutative86.9%
associate-+r-49.9%
associate-+l-17.2%
+-commutative17.2%
associate--l+17.2%
+-commutative17.2%
Simplified10.3%
Taylor expanded in t around inf 9.5%
+-commutative9.5%
+-commutative9.5%
associate--l+11.6%
Simplified11.6%
Taylor expanded in z around inf 8.8%
+-commutative8.8%
Simplified8.8%
Taylor expanded in y around inf 5.4%
flip--5.4%
add-sqr-sqrt6.0%
add-sqr-sqrt5.4%
+-commutative5.4%
Applied egg-rr5.4%
associate--l+10.9%
+-inverses10.9%
metadata-eval10.9%
Simplified10.9%
Final simplification25.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 2.1e-28)
(+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) 2.0)
(if (<= y 2.8e+28)
(+ 1.0 (/ 1.0 (+ (sqrt y) (hypot 1.0 (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) {
double tmp;
if (y <= 2.1e-28) {
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + 2.0;
} else if (y <= 2.8e+28) {
tmp = 1.0 + (1.0 / (sqrt(y) + hypot(1.0, sqrt(y))));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.1e-28) {
tmp = (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + 2.0;
} else if (y <= 2.8e+28) {
tmp = 1.0 + (1.0 / (Math.sqrt(y) + Math.hypot(1.0, Math.sqrt(y))));
} else {
tmp = 1.0 / (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 <= 2.1e-28: tmp = (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + 2.0 elif y <= 2.8e+28: tmp = 1.0 + (1.0 / (math.sqrt(y) + math.hypot(1.0, math.sqrt(y)))) else: tmp = 1.0 / (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 <= 2.1e-28) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + 2.0); elseif (y <= 2.8e+28) tmp = Float64(1.0 + Float64(1.0 / Float64(sqrt(y) + hypot(1.0, sqrt(y))))); else tmp = Float64(1.0 / 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 <= 2.1e-28)
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + 2.0;
elseif (y <= 2.8e+28)
tmp = 1.0 + (1.0 / (sqrt(y) + hypot(1.0, sqrt(y))));
else
tmp = 1.0 / (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, 2.1e-28], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2.8e+28], N[(1.0 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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 2.1 \cdot 10^{-28}:\\
\;\;\;\;\frac{1}{\sqrt{1 + z} + \sqrt{z}} + 2\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+28}:\\
\;\;\;\;1 + \frac{1}{\sqrt{y} + \mathsf{hypot}\left(1, \sqrt{y}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 2.10000000000000006e-28Initial program 97.3%
associate-+l+97.4%
+-commutative97.4%
associate-+r-57.6%
associate-+l-51.0%
+-commutative51.0%
associate--l+51.0%
+-commutative51.0%
Simplified29.8%
Taylor expanded in t around inf 28.5%
+-commutative28.5%
+-commutative28.5%
associate--l+31.1%
Simplified31.1%
flip--31.1%
add-sqr-sqrt21.0%
add-sqr-sqrt31.1%
+-commutative31.1%
+-commutative31.1%
Applied egg-rr31.1%
+-commutative31.1%
associate--r+31.4%
+-commutative31.4%
Simplified31.4%
Taylor expanded in y around 0 31.4%
associate-+r+31.4%
associate--l+31.4%
+-commutative31.4%
Simplified31.4%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
Simplified51.9%
if 2.10000000000000006e-28 < y < 2.8000000000000001e28Initial program 91.5%
associate-+l+91.5%
+-commutative91.5%
associate-+r-51.0%
associate-+l-41.5%
+-commutative41.5%
associate--l+41.5%
+-commutative41.5%
Simplified26.1%
Taylor expanded in t around inf 20.1%
+-commutative20.1%
+-commutative20.1%
associate--l+20.0%
Simplified20.0%
Taylor expanded in z around inf 14.5%
+-commutative14.5%
Simplified14.5%
Taylor expanded in x around 0 42.7%
associate--l+42.6%
rem-square-sqrt42.6%
hypot-1-def42.6%
Simplified42.6%
flip--44.5%
hypot-udef44.5%
metadata-eval44.5%
add-sqr-sqrt43.3%
hypot-udef43.3%
metadata-eval43.3%
add-sqr-sqrt43.3%
add-sqr-sqrt42.3%
add-sqr-sqrt44.5%
+-commutative44.5%
Applied egg-rr44.5%
associate--l+44.5%
+-inverses44.5%
metadata-eval44.5%
Simplified44.5%
if 2.8000000000000001e28 < y Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-87.4%
associate-+l-59.2%
+-commutative59.2%
associate--l+59.2%
+-commutative59.2%
Simplified37.9%
Taylor expanded in t around inf 32.3%
+-commutative32.3%
+-commutative32.3%
associate--l+32.4%
Simplified32.4%
Taylor expanded in z around inf 21.0%
+-commutative21.0%
Simplified21.0%
Taylor expanded in y around inf 20.8%
flip--20.8%
add-sqr-sqrt21.1%
add-sqr-sqrt20.8%
+-commutative20.8%
Applied egg-rr20.8%
associate--l+25.0%
+-inverses25.0%
metadata-eval25.0%
Simplified25.0%
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 2.15e-28)
(+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) 2.0)
(if (<= y 1.95e+28)
(+ 1.0 (/ 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) {
double tmp;
if (y <= 2.15e-28) {
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + 2.0;
} else if (y <= 1.95e+28) {
tmp = 1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
} else {
tmp = 1.0 / (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 <= 2.15d-28) then
tmp = (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + 2.0d0
else if (y <= 1.95d+28) then
tmp = 1.0d0 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))
else
tmp = 1.0d0 / (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 <= 2.15e-28) {
tmp = (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + 2.0;
} else if (y <= 1.95e+28) {
tmp = 1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)));
} else {
tmp = 1.0 / (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 <= 2.15e-28: tmp = (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + 2.0 elif y <= 1.95e+28: tmp = 1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) else: tmp = 1.0 / (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 <= 2.15e-28) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + 2.0); elseif (y <= 1.95e+28) tmp = Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))); else tmp = Float64(1.0 / 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 <= 2.15e-28)
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + 2.0;
elseif (y <= 1.95e+28)
tmp = 1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
else
tmp = 1.0 / (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, 2.15e-28], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 1.95e+28], N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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 2.15 \cdot 10^{-28}:\\
\;\;\;\;\frac{1}{\sqrt{1 + z} + \sqrt{z}} + 2\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+28}:\\
\;\;\;\;1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 2.15e-28Initial program 97.3%
associate-+l+97.4%
+-commutative97.4%
associate-+r-57.6%
associate-+l-51.0%
+-commutative51.0%
associate--l+51.0%
+-commutative51.0%
Simplified29.8%
Taylor expanded in t around inf 28.5%
+-commutative28.5%
+-commutative28.5%
associate--l+31.1%
Simplified31.1%
flip--31.1%
add-sqr-sqrt21.0%
add-sqr-sqrt31.1%
+-commutative31.1%
+-commutative31.1%
Applied egg-rr31.1%
+-commutative31.1%
associate--r+31.4%
+-commutative31.4%
Simplified31.4%
Taylor expanded in y around 0 31.4%
associate-+r+31.4%
associate--l+31.4%
+-commutative31.4%
Simplified31.4%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
Simplified51.9%
if 2.15e-28 < y < 1.9499999999999999e28Initial program 91.5%
associate-+l+91.5%
+-commutative91.5%
associate-+r-51.0%
associate-+l-41.5%
+-commutative41.5%
associate--l+41.5%
+-commutative41.5%
Simplified26.1%
Taylor expanded in t around inf 20.1%
+-commutative20.1%
+-commutative20.1%
associate--l+20.0%
Simplified20.0%
Taylor expanded in z around inf 14.5%
+-commutative14.5%
Simplified14.5%
Taylor expanded in x around 0 42.7%
associate--l+42.6%
rem-square-sqrt42.6%
hypot-1-def42.6%
Simplified42.6%
flip--44.5%
hypot-udef44.5%
metadata-eval44.5%
add-sqr-sqrt43.3%
hypot-udef43.3%
metadata-eval43.3%
add-sqr-sqrt43.3%
add-sqr-sqrt42.3%
add-sqr-sqrt44.5%
+-commutative44.5%
Applied egg-rr44.5%
associate--l+44.5%
+-inverses44.5%
metadata-eval44.5%
hypot-1-def44.5%
rem-square-sqrt44.5%
Simplified44.5%
if 1.9499999999999999e28 < y Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-87.4%
associate-+l-59.2%
+-commutative59.2%
associate--l+59.2%
+-commutative59.2%
Simplified37.9%
Taylor expanded in t around inf 32.3%
+-commutative32.3%
+-commutative32.3%
associate--l+32.4%
Simplified32.4%
Taylor expanded in z around inf 21.0%
+-commutative21.0%
Simplified21.0%
Taylor expanded in y around inf 20.8%
flip--20.8%
add-sqr-sqrt21.1%
add-sqr-sqrt20.8%
+-commutative20.8%
Applied egg-rr20.8%
associate--l+25.0%
+-inverses25.0%
metadata-eval25.0%
Simplified25.0%
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 (<= z 0.49) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0) (+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.49) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else {
tmp = 1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 0.49d0) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else
tmp = 1.0d0 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.49) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else {
tmp = 1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.49: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 else: tmp = 1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.49) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); else tmp = Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 0.49)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
else
tmp = 1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 0.49], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.49:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\end{array}
\end{array}
if z < 0.48999999999999999Initial program 97.1%
associate-+l+97.1%
+-commutative97.1%
associate-+r-75.4%
associate-+l-51.6%
+-commutative51.6%
associate--l+51.6%
+-commutative51.6%
Simplified50.5%
Taylor expanded in z around 0 15.7%
associate--l+38.6%
+-commutative38.6%
associate-+r+38.6%
Simplified38.6%
Taylor expanded in x around 0 17.4%
associate--l+53.4%
+-commutative53.4%
associate--l+43.2%
+-commutative43.2%
Simplified43.2%
Taylor expanded in y around 0 19.7%
associate--l+30.5%
Simplified30.5%
if 0.48999999999999999 < z Initial program 86.5%
associate-+l+86.5%
+-commutative86.5%
associate-+r-68.4%
associate-+l-57.0%
+-commutative57.0%
associate--l+57.0%
+-commutative57.0%
Simplified16.3%
Taylor expanded in t around inf 29.8%
+-commutative29.8%
+-commutative29.8%
associate--l+32.1%
Simplified32.1%
Taylor expanded in z around inf 31.3%
+-commutative31.3%
Simplified31.3%
Taylor expanded in x around 0 27.2%
associate--l+50.7%
rem-square-sqrt50.7%
hypot-1-def50.7%
Simplified50.7%
flip--50.8%
hypot-udef50.8%
metadata-eval50.8%
add-sqr-sqrt50.8%
hypot-udef50.8%
metadata-eval50.8%
add-sqr-sqrt50.8%
add-sqr-sqrt41.6%
add-sqr-sqrt50.8%
+-commutative50.8%
Applied egg-rr50.8%
associate--l+50.8%
+-inverses50.8%
metadata-eval50.8%
hypot-1-def50.8%
rem-square-sqrt50.8%
Simplified50.8%
Final simplification40.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 0.38) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.38) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 0.38d0) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.38) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.38: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.38) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 0.38)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 0.38], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.38:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 0.38Initial program 97.1%
associate-+l+97.1%
+-commutative97.1%
associate-+r-75.4%
associate-+l-51.6%
+-commutative51.6%
associate--l+51.6%
+-commutative51.6%
Simplified50.5%
Taylor expanded in z around 0 15.7%
associate--l+38.6%
+-commutative38.6%
associate-+r+38.6%
Simplified38.6%
Taylor expanded in x around 0 17.4%
associate--l+53.4%
+-commutative53.4%
associate--l+43.2%
+-commutative43.2%
Simplified43.2%
Taylor expanded in y around 0 19.7%
associate--l+30.5%
Simplified30.5%
if 0.38 < z Initial program 86.5%
associate-+l+86.5%
+-commutative86.5%
associate-+r-68.4%
associate-+l-57.0%
+-commutative57.0%
associate--l+57.0%
+-commutative57.0%
Simplified16.3%
Taylor expanded in t around inf 29.8%
+-commutative29.8%
+-commutative29.8%
associate--l+32.1%
Simplified32.1%
Taylor expanded in z around inf 31.3%
+-commutative31.3%
Simplified31.3%
Taylor expanded in x around 0 27.2%
associate--l+50.7%
Simplified50.7%
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 (if (<= y 1.55) 2.0 (- (sqrt (+ 1.0 x)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.55) {
tmp = 2.0;
} else {
tmp = sqrt((1.0 + x)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.55d0) then
tmp = 2.0d0
else
tmp = sqrt((1.0d0 + x)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.55) {
tmp = 2.0;
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.55: tmp = 2.0 else: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.55) tmp = 2.0; else tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.55)
tmp = 2.0;
else
tmp = sqrt((1.0 + x)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.55], 2.0, N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.55000000000000004Initial program 97.5%
associate-+l+97.5%
+-commutative97.5%
associate-+r-55.7%
associate-+l-49.0%
+-commutative49.0%
associate--l+49.0%
+-commutative49.0%
Simplified28.4%
Taylor expanded in t around inf 27.2%
+-commutative27.2%
+-commutative27.2%
associate--l+29.6%
Simplified29.6%
Taylor expanded in z around inf 22.4%
+-commutative22.4%
Simplified22.4%
Taylor expanded in x around 0 47.4%
associate--l+47.4%
rem-square-sqrt47.4%
hypot-1-def47.4%
Simplified47.4%
Taylor expanded in y around 0 46.6%
if 1.55000000000000004 < y Initial program 87.1%
associate-+l+87.1%
+-commutative87.1%
associate-+r-85.6%
associate-+l-58.8%
+-commutative58.8%
associate--l+58.8%
+-commutative58.8%
Simplified37.9%
Taylor expanded in t around inf 31.7%
+-commutative31.7%
+-commutative31.7%
associate--l+31.8%
Simplified31.8%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in y around inf 20.2%
Final simplification32.3%
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 91.9%
associate-+l+91.9%
+-commutative91.9%
associate-+r-71.9%
associate-+l-54.3%
+-commutative54.3%
associate--l+54.3%
+-commutative54.3%
Simplified33.5%
Taylor expanded in t around inf 29.7%
+-commutative29.7%
+-commutative29.7%
associate--l+30.8%
Simplified30.8%
Taylor expanded in z around inf 21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in x around 0 25.3%
associate--l+45.5%
Simplified45.5%
Final simplification45.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 1.35) 2.0 (- (+ 1.0 (* x 0.5)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.35) {
tmp = 2.0;
} else {
tmp = (1.0 + (x * 0.5)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.35d0) then
tmp = 2.0d0
else
tmp = (1.0d0 + (x * 0.5d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.35) {
tmp = 2.0;
} else {
tmp = (1.0 + (x * 0.5)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.35: tmp = 2.0 else: tmp = (1.0 + (x * 0.5)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.35) tmp = 2.0; else tmp = Float64(Float64(1.0 + Float64(x * 0.5)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.35)
tmp = 2.0;
else
tmp = (1.0 + (x * 0.5)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.35], 2.0, N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.35:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.3500000000000001Initial program 97.5%
associate-+l+97.5%
+-commutative97.5%
associate-+r-55.7%
associate-+l-49.0%
+-commutative49.0%
associate--l+49.0%
+-commutative49.0%
Simplified28.4%
Taylor expanded in t around inf 27.2%
+-commutative27.2%
+-commutative27.2%
associate--l+29.6%
Simplified29.6%
Taylor expanded in z around inf 22.4%
+-commutative22.4%
Simplified22.4%
Taylor expanded in x around 0 47.4%
associate--l+47.4%
rem-square-sqrt47.4%
hypot-1-def47.4%
Simplified47.4%
Taylor expanded in y around 0 46.6%
if 1.3500000000000001 < y Initial program 87.1%
associate-+l+87.1%
+-commutative87.1%
associate-+r-85.6%
associate-+l-58.8%
+-commutative58.8%
associate--l+58.8%
+-commutative58.8%
Simplified37.9%
Taylor expanded in t around inf 31.7%
+-commutative31.7%
+-commutative31.7%
associate--l+31.8%
Simplified31.8%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in y around inf 20.2%
Taylor expanded in x around 0 20.8%
Final simplification32.6%
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 1.55) 2.0 (- 1.0 (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.55) {
tmp = 2.0;
} else {
tmp = 1.0 - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.55d0) then
tmp = 2.0d0
else
tmp = 1.0d0 - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.55) {
tmp = 2.0;
} else {
tmp = 1.0 - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.55: tmp = 2.0 else: tmp = 1.0 - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.55) tmp = 2.0; else tmp = Float64(1.0 - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.55)
tmp = 2.0;
else
tmp = 1.0 - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.55], 2.0, N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.55000000000000004Initial program 97.5%
associate-+l+97.5%
+-commutative97.5%
associate-+r-55.7%
associate-+l-49.0%
+-commutative49.0%
associate--l+49.0%
+-commutative49.0%
Simplified28.4%
Taylor expanded in t around inf 27.2%
+-commutative27.2%
+-commutative27.2%
associate--l+29.6%
Simplified29.6%
Taylor expanded in z around inf 22.4%
+-commutative22.4%
Simplified22.4%
Taylor expanded in x around 0 47.4%
associate--l+47.4%
rem-square-sqrt47.4%
hypot-1-def47.4%
Simplified47.4%
Taylor expanded in y around 0 46.6%
if 1.55000000000000004 < y Initial program 87.1%
associate-+l+87.1%
+-commutative87.1%
associate-+r-85.6%
associate-+l-58.8%
+-commutative58.8%
associate--l+58.8%
+-commutative58.8%
Simplified37.9%
Taylor expanded in t around inf 31.7%
+-commutative31.7%
+-commutative31.7%
associate--l+31.8%
Simplified31.8%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in y around inf 20.2%
Taylor expanded in x around 0 18.8%
Final simplification31.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 2.0)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 2.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 2.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 2.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 2.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 2.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 2.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 2.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
2
\end{array}
Initial program 91.9%
associate-+l+91.9%
+-commutative91.9%
associate-+r-71.9%
associate-+l-54.3%
+-commutative54.3%
associate--l+54.3%
+-commutative54.3%
Simplified33.5%
Taylor expanded in t around inf 29.7%
+-commutative29.7%
+-commutative29.7%
associate--l+30.8%
Simplified30.8%
Taylor expanded in z around inf 21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in x around 0 25.3%
associate--l+45.5%
rem-square-sqrt45.5%
hypot-1-def45.5%
Simplified45.5%
Taylor expanded in y around 0 44.7%
Final simplification44.7%
(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 2023230
(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))))