
(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 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (sqrt (+ 1.0 t)))
(t_4 (sqrt (+ x 1.0)))
(t_5 (- t_2 (sqrt z)))
(t_6 (+ t_5 (+ (- t_4 (sqrt x)) (- t_1 (sqrt y)))))
(t_7 (+ (sqrt x) (sqrt y))))
(if (<= t_6 1.0002)
(+
(+ t_5 (- t_3 (sqrt t)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_4))))
(if (<= t_6 2.01)
(-
(+
t_4
(+
t_1
(+ (* -0.125 (sqrt (/ 1.0 (pow z 3.0)))) (* 0.5 (sqrt (/ 1.0 z))))))
t_7)
(+
1.0
(-
(+ (+ t_2 t_4) (fma 0.5 y (/ 1.0 (+ t_3 (sqrt t)))))
(+ (sqrt z) t_7)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + t));
double t_4 = sqrt((x + 1.0));
double t_5 = t_2 - sqrt(z);
double t_6 = t_5 + ((t_4 - sqrt(x)) + (t_1 - sqrt(y)));
double t_7 = sqrt(x) + sqrt(y);
double tmp;
if (t_6 <= 1.0002) {
tmp = (t_5 + (t_3 - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_4)));
} else if (t_6 <= 2.01) {
tmp = (t_4 + (t_1 + ((-0.125 * sqrt((1.0 / pow(z, 3.0)))) + (0.5 * sqrt((1.0 / z)))))) - t_7;
} else {
tmp = 1.0 + (((t_2 + t_4) + fma(0.5, y, (1.0 / (t_3 + sqrt(t))))) - (sqrt(z) + t_7));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + t)) t_4 = sqrt(Float64(x + 1.0)) t_5 = Float64(t_2 - sqrt(z)) t_6 = Float64(t_5 + Float64(Float64(t_4 - sqrt(x)) + Float64(t_1 - sqrt(y)))) t_7 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (t_6 <= 1.0002) tmp = Float64(Float64(t_5 + Float64(t_3 - sqrt(t))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_4)))); elseif (t_6 <= 2.01) tmp = Float64(Float64(t_4 + Float64(t_1 + Float64(Float64(-0.125 * sqrt(Float64(1.0 / (z ^ 3.0)))) + Float64(0.5 * sqrt(Float64(1.0 / z)))))) - t_7); else tmp = Float64(1.0 + Float64(Float64(Float64(t_2 + t_4) + fma(0.5, y, Float64(1.0 / Float64(t_3 + sqrt(t))))) - Float64(sqrt(z) + t_7))); 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]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 + N[(N[(t$95$4 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 1.0002], N[(N[(t$95$5 + N[(t$95$3 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 2.01], N[(N[(t$95$4 + N[(t$95$1 + N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$7), $MachinePrecision], N[(1.0 + N[(N[(N[(t$95$2 + t$95$4), $MachinePrecision] + N[(0.5 * y + N[(1.0 / N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$7), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t}\\
t_4 := \sqrt{x + 1}\\
t_5 := t\_2 - \sqrt{z}\\
t_6 := t\_5 + \left(\left(t\_4 - \sqrt{x}\right) + \left(t\_1 - \sqrt{y}\right)\right)\\
t_7 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;t\_6 \leq 1.0002:\\
\;\;\;\;\left(t\_5 + \left(t\_3 - \sqrt{t}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_4}\right)\\
\mathbf{elif}\;t\_6 \leq 2.01:\\
\;\;\;\;\left(t\_4 + \left(t\_1 + \left(-0.125 \cdot \sqrt{\frac{1}{{z}^{3}}} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\right)\right) - t\_7\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(\left(t\_2 + t\_4\right) + \mathsf{fma}\left(0.5, y, \frac{1}{t\_3 + \sqrt{t}}\right)\right) - \left(\sqrt{z} + t\_7\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.0002Initial program 86.4%
associate-+l+86.4%
associate-+l-64.2%
associate-+l-86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--87.1%
flip--87.4%
frac-add87.4%
Applied egg-rr88.0%
fma-define88.0%
associate--l+88.0%
+-commutative88.0%
+-commutative88.0%
associate--l+91.1%
+-commutative91.1%
+-commutative91.1%
Simplified91.1%
Taylor expanded in y around inf 68.4%
if 1.0002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.0099999999999998Initial program 97.8%
associate-+l+97.8%
associate-+l-73.5%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in t around inf 6.6%
associate--l+15.9%
Simplified15.9%
Taylor expanded in z around inf 26.5%
if 2.0099999999999998 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 97.9%
associate-+l+97.9%
associate-+l-97.9%
associate-+l-97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
flip--98.9%
add-sqr-sqrt82.1%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
associate--l+100.0%
+-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
associate--l+99.9%
associate-+r+99.9%
+-commutative99.9%
fma-define99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
Simplified99.9%
Final simplification55.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 t)) (sqrt t)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (sqrt (+ 1.0 z)))
(t_4 (- t_3 (sqrt z)))
(t_5 (+ (sqrt y) t_2))
(t_6 (sqrt (+ x 1.0)))
(t_7 (+ (sqrt x) t_6)))
(if (<= (+ t_4 (+ (- t_6 (sqrt x)) (- t_2 (sqrt y)))) 0.0)
(+ (* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y)))) (+ t_4 t_1))
(+
(/ (fma (+ x (- 1.0 x)) t_5 (* t_7 (+ 1.0 (- y y)))) (* t_5 t_7))
(+ t_1 (/ 1.0 (+ (sqrt z) t_3)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((1.0 + z));
double t_4 = t_3 - sqrt(z);
double t_5 = sqrt(y) + t_2;
double t_6 = sqrt((x + 1.0));
double t_7 = sqrt(x) + t_6;
double tmp;
if ((t_4 + ((t_6 - sqrt(x)) + (t_2 - sqrt(y)))) <= 0.0) {
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_4 + t_1);
} else {
tmp = (fma((x + (1.0 - x)), t_5, (t_7 * (1.0 + (y - y)))) / (t_5 * t_7)) + (t_1 + (1.0 / (sqrt(z) + t_3)));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(1.0 + z)) t_4 = Float64(t_3 - sqrt(z)) t_5 = Float64(sqrt(y) + t_2) t_6 = sqrt(Float64(x + 1.0)) t_7 = Float64(sqrt(x) + t_6) tmp = 0.0 if (Float64(t_4 + Float64(Float64(t_6 - sqrt(x)) + Float64(t_2 - sqrt(y)))) <= 0.0) tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))) + Float64(t_4 + t_1)); else tmp = Float64(Float64(fma(Float64(x + Float64(1.0 - x)), t_5, Float64(t_7 * Float64(1.0 + Float64(y - y)))) / Float64(t_5 * t_7)) + Float64(t_1 + Float64(1.0 / 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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, 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[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$7 = N[(N[Sqrt[x], $MachinePrecision] + t$95$6), $MachinePrecision]}, If[LessEqual[N[(t$95$4 + N[(N[(t$95$6 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] * t$95$5 + N[(t$95$7 * N[(1.0 + N[(y - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$5 * t$95$7), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / 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 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + z}\\
t_4 := t\_3 - \sqrt{z}\\
t_5 := \sqrt{y} + t\_2\\
t_6 := \sqrt{x + 1}\\
t_7 := \sqrt{x} + t\_6\\
\mathbf{if}\;t\_4 + \left(\left(t\_6 - \sqrt{x}\right) + \left(t\_2 - \sqrt{y}\right)\right) \leq 0:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right) + \left(t\_4 + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x + \left(1 - x\right), t\_5, t\_7 \cdot \left(1 + \left(y - y\right)\right)\right)}{t\_5 \cdot t\_7} + \left(t\_1 + \frac{1}{\sqrt{z} + t\_3}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.0Initial program 51.5%
associate-+l+51.5%
associate-+l-51.5%
associate-+l-51.5%
+-commutative51.5%
+-commutative51.5%
+-commutative51.5%
Simplified51.5%
Taylor expanded in y around inf 51.5%
Taylor expanded in x around inf 73.2%
distribute-lft-out73.2%
Simplified73.2%
if 0.0 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 96.3%
associate-+l+96.3%
associate-+l-73.2%
associate-+l-96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
flip--96.7%
flip--96.9%
frac-add96.9%
Applied egg-rr97.3%
fma-define97.3%
associate--l+97.3%
+-commutative97.3%
+-commutative97.3%
associate--l+97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
flip--98.1%
add-sqr-sqrt78.8%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
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 y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (sqrt (+ 1.0 t)))
(t_4 (sqrt (+ x 1.0)))
(t_5 (- t_2 (sqrt z)))
(t_6 (+ t_5 (+ (- t_4 (sqrt x)) (- t_1 (sqrt y)))))
(t_7 (+ (sqrt x) (sqrt y))))
(if (<= t_6 1.0002)
(+
(+ t_5 (- t_3 (sqrt t)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_4))))
(if (<= t_6 2.01)
(-
(+
t_4
(+
t_1
(+ (* -0.125 (sqrt (/ 1.0 (pow z 3.0)))) (* 0.5 (sqrt (/ 1.0 z))))))
t_7)
(-
(+ (+ 1.0 t_4) (+ t_2 (/ 1.0 (+ t_3 (sqrt t)))))
(+ (sqrt z) t_7))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + t));
double t_4 = sqrt((x + 1.0));
double t_5 = t_2 - sqrt(z);
double t_6 = t_5 + ((t_4 - sqrt(x)) + (t_1 - sqrt(y)));
double t_7 = sqrt(x) + sqrt(y);
double tmp;
if (t_6 <= 1.0002) {
tmp = (t_5 + (t_3 - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_4)));
} else if (t_6 <= 2.01) {
tmp = (t_4 + (t_1 + ((-0.125 * sqrt((1.0 / pow(z, 3.0)))) + (0.5 * sqrt((1.0 / z)))))) - t_7;
} else {
tmp = ((1.0 + t_4) + (t_2 + (1.0 / (t_3 + sqrt(t))))) - (sqrt(z) + t_7);
}
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 + y))
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + t))
t_4 = sqrt((x + 1.0d0))
t_5 = t_2 - sqrt(z)
t_6 = t_5 + ((t_4 - sqrt(x)) + (t_1 - sqrt(y)))
t_7 = sqrt(x) + sqrt(y)
if (t_6 <= 1.0002d0) then
tmp = (t_5 + (t_3 - sqrt(t))) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_4)))
else if (t_6 <= 2.01d0) then
tmp = (t_4 + (t_1 + (((-0.125d0) * sqrt((1.0d0 / (z ** 3.0d0)))) + (0.5d0 * sqrt((1.0d0 / z)))))) - t_7
else
tmp = ((1.0d0 + t_4) + (t_2 + (1.0d0 / (t_3 + sqrt(t))))) - (sqrt(z) + t_7)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + t));
double t_4 = Math.sqrt((x + 1.0));
double t_5 = t_2 - Math.sqrt(z);
double t_6 = t_5 + ((t_4 - Math.sqrt(x)) + (t_1 - Math.sqrt(y)));
double t_7 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (t_6 <= 1.0002) {
tmp = (t_5 + (t_3 - Math.sqrt(t))) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_4)));
} else if (t_6 <= 2.01) {
tmp = (t_4 + (t_1 + ((-0.125 * Math.sqrt((1.0 / Math.pow(z, 3.0)))) + (0.5 * Math.sqrt((1.0 / z)))))) - t_7;
} else {
tmp = ((1.0 + t_4) + (t_2 + (1.0 / (t_3 + Math.sqrt(t))))) - (Math.sqrt(z) + t_7);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + t)) t_4 = math.sqrt((x + 1.0)) t_5 = t_2 - math.sqrt(z) t_6 = t_5 + ((t_4 - math.sqrt(x)) + (t_1 - math.sqrt(y))) t_7 = math.sqrt(x) + math.sqrt(y) tmp = 0 if t_6 <= 1.0002: tmp = (t_5 + (t_3 - math.sqrt(t))) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_4))) elif t_6 <= 2.01: tmp = (t_4 + (t_1 + ((-0.125 * math.sqrt((1.0 / math.pow(z, 3.0)))) + (0.5 * math.sqrt((1.0 / z)))))) - t_7 else: tmp = ((1.0 + t_4) + (t_2 + (1.0 / (t_3 + math.sqrt(t))))) - (math.sqrt(z) + t_7) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + t)) t_4 = sqrt(Float64(x + 1.0)) t_5 = Float64(t_2 - sqrt(z)) t_6 = Float64(t_5 + Float64(Float64(t_4 - sqrt(x)) + Float64(t_1 - sqrt(y)))) t_7 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (t_6 <= 1.0002) tmp = Float64(Float64(t_5 + Float64(t_3 - sqrt(t))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_4)))); elseif (t_6 <= 2.01) tmp = Float64(Float64(t_4 + Float64(t_1 + Float64(Float64(-0.125 * sqrt(Float64(1.0 / (z ^ 3.0)))) + Float64(0.5 * sqrt(Float64(1.0 / z)))))) - t_7); else tmp = Float64(Float64(Float64(1.0 + t_4) + Float64(t_2 + Float64(1.0 / Float64(t_3 + sqrt(t))))) - Float64(sqrt(z) + t_7)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + t));
t_4 = sqrt((x + 1.0));
t_5 = t_2 - sqrt(z);
t_6 = t_5 + ((t_4 - sqrt(x)) + (t_1 - sqrt(y)));
t_7 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (t_6 <= 1.0002)
tmp = (t_5 + (t_3 - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_4)));
elseif (t_6 <= 2.01)
tmp = (t_4 + (t_1 + ((-0.125 * sqrt((1.0 / (z ^ 3.0)))) + (0.5 * sqrt((1.0 / z)))))) - t_7;
else
tmp = ((1.0 + t_4) + (t_2 + (1.0 / (t_3 + sqrt(t))))) - (sqrt(z) + t_7);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 + N[(N[(t$95$4 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 1.0002], N[(N[(t$95$5 + N[(t$95$3 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 2.01], N[(N[(t$95$4 + N[(t$95$1 + N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$7), $MachinePrecision], N[(N[(N[(1.0 + t$95$4), $MachinePrecision] + N[(t$95$2 + N[(1.0 / N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$7), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t}\\
t_4 := \sqrt{x + 1}\\
t_5 := t\_2 - \sqrt{z}\\
t_6 := t\_5 + \left(\left(t\_4 - \sqrt{x}\right) + \left(t\_1 - \sqrt{y}\right)\right)\\
t_7 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;t\_6 \leq 1.0002:\\
\;\;\;\;\left(t\_5 + \left(t\_3 - \sqrt{t}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_4}\right)\\
\mathbf{elif}\;t\_6 \leq 2.01:\\
\;\;\;\;\left(t\_4 + \left(t\_1 + \left(-0.125 \cdot \sqrt{\frac{1}{{z}^{3}}} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\right)\right) - t\_7\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t\_4\right) + \left(t\_2 + \frac{1}{t\_3 + \sqrt{t}}\right)\right) - \left(\sqrt{z} + t\_7\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.0002Initial program 86.4%
associate-+l+86.4%
associate-+l-64.2%
associate-+l-86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--87.1%
flip--87.4%
frac-add87.4%
Applied egg-rr88.0%
fma-define88.0%
associate--l+88.0%
+-commutative88.0%
+-commutative88.0%
associate--l+91.1%
+-commutative91.1%
+-commutative91.1%
Simplified91.1%
Taylor expanded in y around inf 68.4%
if 1.0002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.0099999999999998Initial program 97.8%
associate-+l+97.8%
associate-+l-73.5%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in t around inf 6.6%
associate--l+15.9%
Simplified15.9%
Taylor expanded in z around inf 26.5%
if 2.0099999999999998 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 97.9%
associate-+l+97.9%
associate-+l-97.9%
associate-+l-97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
flip--98.9%
add-sqr-sqrt82.1%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
associate--l+100.0%
+-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
Simplified100.0%
Final simplification55.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 y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- t_2 (sqrt z)))
(t_4 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_5 (sqrt (+ x 1.0))))
(if (<= (+ t_3 (+ (- t_5 (sqrt x)) (- t_1 (sqrt y)))) 0.999)
(+ (+ t_3 t_4) (+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_5))))
(+
(+ t_4 (/ 1.0 (+ (sqrt z) t_2)))
(/
(+ 1.0 (+ t_1 (+ (sqrt x) (sqrt y))))
(* (+ (sqrt y) t_1) (+ 1.0 (sqrt x))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z));
double t_3 = t_2 - sqrt(z);
double t_4 = sqrt((1.0 + t)) - sqrt(t);
double t_5 = sqrt((x + 1.0));
double tmp;
if ((t_3 + ((t_5 - sqrt(x)) + (t_1 - sqrt(y)))) <= 0.999) {
tmp = (t_3 + t_4) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_5)));
} else {
tmp = (t_4 + (1.0 / (sqrt(z) + t_2))) + ((1.0 + (t_1 + (sqrt(x) + sqrt(y)))) / ((sqrt(y) + t_1) * (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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
t_4 = sqrt((1.0d0 + t)) - sqrt(t)
t_5 = sqrt((x + 1.0d0))
if ((t_3 + ((t_5 - sqrt(x)) + (t_1 - sqrt(y)))) <= 0.999d0) then
tmp = (t_3 + t_4) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_5)))
else
tmp = (t_4 + (1.0d0 / (sqrt(z) + t_2))) + ((1.0d0 + (t_1 + (sqrt(x) + sqrt(y)))) / ((sqrt(y) + t_1) * (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 t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = t_2 - Math.sqrt(z);
double t_4 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_5 = Math.sqrt((x + 1.0));
double tmp;
if ((t_3 + ((t_5 - Math.sqrt(x)) + (t_1 - Math.sqrt(y)))) <= 0.999) {
tmp = (t_3 + t_4) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_5)));
} else {
tmp = (t_4 + (1.0 / (Math.sqrt(z) + t_2))) + ((1.0 + (t_1 + (Math.sqrt(x) + Math.sqrt(y)))) / ((Math.sqrt(y) + t_1) * (1.0 + Math.sqrt(x))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + z)) t_3 = t_2 - math.sqrt(z) t_4 = math.sqrt((1.0 + t)) - math.sqrt(t) t_5 = math.sqrt((x + 1.0)) tmp = 0 if (t_3 + ((t_5 - math.sqrt(x)) + (t_1 - math.sqrt(y)))) <= 0.999: tmp = (t_3 + t_4) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_5))) else: tmp = (t_4 + (1.0 / (math.sqrt(z) + t_2))) + ((1.0 + (t_1 + (math.sqrt(x) + math.sqrt(y)))) / ((math.sqrt(y) + t_1) * (1.0 + math.sqrt(x)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(t_2 - sqrt(z)) t_4 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_5 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(t_3 + Float64(Float64(t_5 - sqrt(x)) + Float64(t_1 - sqrt(y)))) <= 0.999) tmp = Float64(Float64(t_3 + t_4) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_5)))); else tmp = Float64(Float64(t_4 + Float64(1.0 / Float64(sqrt(z) + t_2))) + Float64(Float64(1.0 + Float64(t_1 + Float64(sqrt(x) + sqrt(y)))) / Float64(Float64(sqrt(y) + t_1) * 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)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + z));
t_3 = t_2 - sqrt(z);
t_4 = sqrt((1.0 + t)) - sqrt(t);
t_5 = sqrt((x + 1.0));
tmp = 0.0;
if ((t_3 + ((t_5 - sqrt(x)) + (t_1 - sqrt(y)))) <= 0.999)
tmp = (t_3 + t_4) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_5)));
else
tmp = (t_4 + (1.0 / (sqrt(z) + t_2))) + ((1.0 + (t_1 + (sqrt(x) + sqrt(y)))) / ((sqrt(y) + t_1) * (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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 + N[(N[(t$95$5 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.999], N[(N[(t$95$3 + t$95$4), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$4 + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(t$95$1 + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision] * N[(1.0 + N[Sqrt[x], $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{1 + z}\\
t_3 := t\_2 - \sqrt{z}\\
t_4 := \sqrt{1 + t} - \sqrt{t}\\
t_5 := \sqrt{x + 1}\\
\mathbf{if}\;t\_3 + \left(\left(t\_5 - \sqrt{x}\right) + \left(t\_1 - \sqrt{y}\right)\right) \leq 0.999:\\
\;\;\;\;\left(t\_3 + t\_4\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_4 + \frac{1}{\sqrt{z} + t\_2}\right) + \frac{1 + \left(t\_1 + \left(\sqrt{x} + \sqrt{y}\right)\right)}{\left(\sqrt{y} + t\_1\right) \cdot \left(1 + \sqrt{x}\right)}\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.998999999999999999Initial program 59.1%
associate-+l+59.1%
associate-+l-50.8%
associate-+l-59.1%
+-commutative59.1%
+-commutative59.1%
+-commutative59.1%
Simplified59.1%
flip--61.3%
flip--61.3%
frac-add61.4%
Applied egg-rr62.0%
fma-define62.0%
associate--l+62.0%
+-commutative62.0%
+-commutative62.0%
associate--l+72.6%
+-commutative72.6%
+-commutative72.6%
Simplified72.6%
Taylor expanded in y around inf 71.7%
if 0.998999999999999999 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 96.8%
associate-+l+96.8%
associate-+l-74.1%
associate-+l-96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
flip--96.9%
flip--97.0%
frac-add97.0%
Applied egg-rr97.4%
fma-define97.4%
associate--l+97.4%
+-commutative97.4%
+-commutative97.4%
associate--l+97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
flip--98.1%
add-sqr-sqrt79.3%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in x around 0 96.7%
associate-+r+96.7%
Simplified96.7%
Final simplification93.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 z)))
(t_2 (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt z) t_1))))
(t_3 (sqrt (+ x 1.0)))
(t_4 (+ (- t_3 (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y)))))
(if (<= (+ (- t_1 (sqrt z)) t_4) 1.002)
(+
t_2
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_3)))
(* -0.125 (sqrt (/ 1.0 (pow y 3.0))))))
(+ t_2 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));
double t_2 = (sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt(z) + t_1));
double t_3 = sqrt((x + 1.0));
double t_4 = (t_3 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
double tmp;
if (((t_1 - sqrt(z)) + t_4) <= 1.002) {
tmp = t_2 + (((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3))) + (-0.125 * sqrt((1.0 / pow(y, 3.0)))));
} else {
tmp = t_2 + 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))
t_2 = (sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt(z) + t_1))
t_3 = sqrt((x + 1.0d0))
t_4 = (t_3 - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y))
if (((t_1 - sqrt(z)) + t_4) <= 1.002d0) then
tmp = t_2 + (((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_3))) + ((-0.125d0) * sqrt((1.0d0 / (y ** 3.0d0)))))
else
tmp = t_2 + 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));
double t_2 = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt(z) + t_1));
double t_3 = Math.sqrt((x + 1.0));
double t_4 = (t_3 - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
double tmp;
if (((t_1 - Math.sqrt(z)) + t_4) <= 1.002) {
tmp = t_2 + (((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_3))) + (-0.125 * Math.sqrt((1.0 / Math.pow(y, 3.0)))));
} else {
tmp = t_2 + 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)) t_2 = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt(z) + t_1)) t_3 = math.sqrt((x + 1.0)) t_4 = (t_3 - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y)) tmp = 0 if ((t_1 - math.sqrt(z)) + t_4) <= 1.002: tmp = t_2 + (((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_3))) + (-0.125 * math.sqrt((1.0 / math.pow(y, 3.0))))) else: tmp = t_2 + t_4 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 = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(z) + t_1))) t_3 = sqrt(Float64(x + 1.0)) t_4 = Float64(Float64(t_3 - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) tmp = 0.0 if (Float64(Float64(t_1 - sqrt(z)) + t_4) <= 1.002) tmp = Float64(t_2 + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_3))) + Float64(-0.125 * sqrt(Float64(1.0 / (y ^ 3.0)))))); else tmp = Float64(t_2 + 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));
t_2 = (sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt(z) + t_1));
t_3 = sqrt((x + 1.0));
t_4 = (t_3 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
tmp = 0.0;
if (((t_1 - sqrt(z)) + t_4) <= 1.002)
tmp = t_2 + (((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3))) + (-0.125 * sqrt((1.0 / (y ^ 3.0)))));
else
tmp = t_2 + 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[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision], 1.002], N[(t$95$2 + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + t$95$4), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{z} + t\_1}\\
t_3 := \sqrt{x + 1}\\
t_4 := \left(t\_3 - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{if}\;\left(t\_1 - \sqrt{z}\right) + t\_4 \leq 1.002:\\
\;\;\;\;t\_2 + \left(\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_3}\right) + -0.125 \cdot \sqrt{\frac{1}{{y}^{3}}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + t\_4\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.002Initial program 86.4%
associate-+l+86.4%
associate-+l-64.2%
associate-+l-86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--87.1%
flip--87.4%
frac-add87.4%
Applied egg-rr88.0%
fma-define88.0%
associate--l+88.0%
+-commutative88.0%
+-commutative88.0%
associate--l+91.1%
+-commutative91.1%
+-commutative91.1%
Simplified91.1%
flip--91.9%
add-sqr-sqrt65.4%
add-sqr-sqrt92.2%
Applied egg-rr92.2%
associate--l+95.4%
+-inverses95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in y around inf 70.9%
if 1.002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 97.8%
associate-+l+97.8%
associate-+l-78.4%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--98.0%
add-sqr-sqrt85.1%
add-sqr-sqrt98.2%
Applied egg-rr98.0%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.5%
Final simplification84.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 z)))
(t_2 (- t_1 (sqrt z)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_4 (sqrt (+ x 1.0)))
(t_5 (+ (- t_4 (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y)))))
(if (<= (+ t_2 t_5) 1.002)
(+
(+ t_2 t_3)
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_4)))
(* -0.125 (sqrt (/ 1.0 (pow y 3.0))))))
(+ (+ t_3 (/ 1.0 (+ (sqrt z) t_1))) t_5))))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 = t_1 - sqrt(z);
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double t_4 = sqrt((x + 1.0));
double t_5 = (t_4 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
double tmp;
if ((t_2 + t_5) <= 1.002) {
tmp = (t_2 + t_3) + (((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_4))) + (-0.125 * sqrt((1.0 / pow(y, 3.0)))));
} else {
tmp = (t_3 + (1.0 / (sqrt(z) + t_1))) + t_5;
}
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) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = t_1 - sqrt(z)
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
t_4 = sqrt((x + 1.0d0))
t_5 = (t_4 - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y))
if ((t_2 + t_5) <= 1.002d0) then
tmp = (t_2 + t_3) + (((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_4))) + ((-0.125d0) * sqrt((1.0d0 / (y ** 3.0d0)))))
else
tmp = (t_3 + (1.0d0 / (sqrt(z) + t_1))) + t_5
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 = t_1 - Math.sqrt(z);
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_4 = Math.sqrt((x + 1.0));
double t_5 = (t_4 - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
double tmp;
if ((t_2 + t_5) <= 1.002) {
tmp = (t_2 + t_3) + (((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_4))) + (-0.125 * Math.sqrt((1.0 / Math.pow(y, 3.0)))));
} else {
tmp = (t_3 + (1.0 / (Math.sqrt(z) + t_1))) + t_5;
}
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 = t_1 - math.sqrt(z) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) t_4 = math.sqrt((x + 1.0)) t_5 = (t_4 - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y)) tmp = 0 if (t_2 + t_5) <= 1.002: tmp = (t_2 + t_3) + (((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_4))) + (-0.125 * math.sqrt((1.0 / math.pow(y, 3.0))))) else: tmp = (t_3 + (1.0 / (math.sqrt(z) + t_1))) + t_5 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 = Float64(t_1 - sqrt(z)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_4 = sqrt(Float64(x + 1.0)) t_5 = Float64(Float64(t_4 - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) tmp = 0.0 if (Float64(t_2 + t_5) <= 1.002) tmp = Float64(Float64(t_2 + t_3) + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_4))) + Float64(-0.125 * sqrt(Float64(1.0 / (y ^ 3.0)))))); else tmp = Float64(Float64(t_3 + Float64(1.0 / Float64(sqrt(z) + t_1))) + t_5); 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 = t_1 - sqrt(z);
t_3 = sqrt((1.0 + t)) - sqrt(t);
t_4 = sqrt((x + 1.0));
t_5 = (t_4 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
tmp = 0.0;
if ((t_2 + t_5) <= 1.002)
tmp = (t_2 + t_3) + (((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_4))) + (-0.125 * sqrt((1.0 / (y ^ 3.0)))));
else
tmp = (t_3 + (1.0 / (sqrt(z) + t_1))) + t_5;
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[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$4 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$2 + t$95$5), $MachinePrecision], 1.002], N[(N[(t$95$2 + t$95$3), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$3 + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := t\_1 - \sqrt{z}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
t_4 := \sqrt{x + 1}\\
t_5 := \left(t\_4 - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{if}\;t\_2 + t\_5 \leq 1.002:\\
\;\;\;\;\left(t\_2 + t\_3\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_4}\right) + -0.125 \cdot \sqrt{\frac{1}{{y}^{3}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_3 + \frac{1}{\sqrt{z} + t\_1}\right) + t\_5\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.002Initial program 86.4%
associate-+l+86.4%
associate-+l-64.2%
associate-+l-86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--87.1%
flip--87.4%
frac-add87.4%
Applied egg-rr88.0%
fma-define88.0%
associate--l+88.0%
+-commutative88.0%
+-commutative88.0%
associate--l+91.1%
+-commutative91.1%
+-commutative91.1%
Simplified91.1%
Taylor expanded in y around inf 67.2%
if 1.002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 97.8%
associate-+l+97.8%
associate-+l-78.4%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--98.0%
add-sqr-sqrt85.1%
add-sqr-sqrt98.2%
Applied egg-rr98.0%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.5%
Final simplification82.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 z)) (sqrt z)))
(t_2 (sqrt (+ 1.0 t)))
(t_3 (sqrt (+ x 1.0)))
(t_4 (+ (- t_3 (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y)))))
(if (<= (+ t_1 t_4) 1.0002)
(+
(+ t_1 (- t_2 (sqrt t)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_3))))
(+ t_4 (+ t_1 (/ 1.0 (+ t_2 (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 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + t));
double t_3 = sqrt((x + 1.0));
double t_4 = (t_3 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
double tmp;
if ((t_1 + t_4) <= 1.0002) {
tmp = (t_1 + (t_2 - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3)));
} else {
tmp = t_4 + (t_1 + (1.0 / (t_2 + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + t))
t_3 = sqrt((x + 1.0d0))
t_4 = (t_3 - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y))
if ((t_1 + t_4) <= 1.0002d0) then
tmp = (t_1 + (t_2 - sqrt(t))) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_3)))
else
tmp = t_4 + (t_1 + (1.0d0 / (t_2 + 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 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + t));
double t_3 = Math.sqrt((x + 1.0));
double t_4 = (t_3 - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
double tmp;
if ((t_1 + t_4) <= 1.0002) {
tmp = (t_1 + (t_2 - Math.sqrt(t))) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_3)));
} else {
tmp = t_4 + (t_1 + (1.0 / (t_2 + 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 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + t)) t_3 = math.sqrt((x + 1.0)) t_4 = (t_3 - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y)) tmp = 0 if (t_1 + t_4) <= 1.0002: tmp = (t_1 + (t_2 - math.sqrt(t))) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_3))) else: tmp = t_4 + (t_1 + (1.0 / (t_2 + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + t)) t_3 = sqrt(Float64(x + 1.0)) t_4 = Float64(Float64(t_3 - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) tmp = 0.0 if (Float64(t_1 + t_4) <= 1.0002) tmp = Float64(Float64(t_1 + Float64(t_2 - sqrt(t))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_3)))); else tmp = Float64(t_4 + Float64(t_1 + Float64(1.0 / Float64(t_2 + 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 + z)) - sqrt(z);
t_2 = sqrt((1.0 + t));
t_3 = sqrt((x + 1.0));
t_4 = (t_3 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
tmp = 0.0;
if ((t_1 + t_4) <= 1.0002)
tmp = (t_1 + (t_2 - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3)));
else
tmp = t_4 + (t_1 + (1.0 / (t_2 + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 + t$95$4), $MachinePrecision], 1.0002], N[(N[(t$95$1 + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 + N[(t$95$1 + N[(1.0 / N[(t$95$2 + N[Sqrt[t], $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 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + t}\\
t_3 := \sqrt{x + 1}\\
t_4 := \left(t\_3 - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{if}\;t\_1 + t\_4 \leq 1.0002:\\
\;\;\;\;\left(t\_1 + \left(t\_2 - \sqrt{t}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_3}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4 + \left(t\_1 + \frac{1}{t\_2 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.0002Initial program 86.4%
associate-+l+86.4%
associate-+l-64.2%
associate-+l-86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--87.1%
flip--87.4%
frac-add87.4%
Applied egg-rr88.0%
fma-define88.0%
associate--l+88.0%
+-commutative88.0%
+-commutative88.0%
associate--l+91.1%
+-commutative91.1%
+-commutative91.1%
Simplified91.1%
Taylor expanded in y around inf 68.4%
if 1.0002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 97.8%
associate-+l+97.8%
associate-+l-78.4%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--98.0%
add-sqr-sqrt79.4%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Final simplification83.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_4 (- (sqrt (+ 1.0 y)) (sqrt y))))
(if (<= t_4 5e-5)
(+
(+ (- t_1 (sqrt z)) t_3)
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_2))))
(+ (+ t_3 (/ 1.0 (+ (sqrt z) t_1))) (+ (- t_2 (sqrt x)) 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));
double t_2 = sqrt((x + 1.0));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double t_4 = sqrt((1.0 + y)) - sqrt(y);
double tmp;
if (t_4 <= 5e-5) {
tmp = ((t_1 - sqrt(z)) + t_3) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2)));
} else {
tmp = (t_3 + (1.0 / (sqrt(z) + t_1))) + ((t_2 - sqrt(x)) + 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))
t_2 = sqrt((x + 1.0d0))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
t_4 = sqrt((1.0d0 + y)) - sqrt(y)
if (t_4 <= 5d-5) then
tmp = ((t_1 - sqrt(z)) + t_3) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_2)))
else
tmp = (t_3 + (1.0d0 / (sqrt(z) + t_1))) + ((t_2 - sqrt(x)) + 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));
double t_2 = Math.sqrt((x + 1.0));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_4 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double tmp;
if (t_4 <= 5e-5) {
tmp = ((t_1 - Math.sqrt(z)) + t_3) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_2)));
} else {
tmp = (t_3 + (1.0 / (Math.sqrt(z) + t_1))) + ((t_2 - Math.sqrt(x)) + 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)) t_2 = math.sqrt((x + 1.0)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) t_4 = math.sqrt((1.0 + y)) - math.sqrt(y) tmp = 0 if t_4 <= 5e-5: tmp = ((t_1 - math.sqrt(z)) + t_3) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_2))) else: tmp = (t_3 + (1.0 / (math.sqrt(z) + t_1))) + ((t_2 - math.sqrt(x)) + t_4) 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(x + 1.0)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_4 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) tmp = 0.0 if (t_4 <= 5e-5) tmp = Float64(Float64(Float64(t_1 - sqrt(z)) + t_3) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_2)))); else tmp = Float64(Float64(t_3 + Float64(1.0 / Float64(sqrt(z) + t_1))) + Float64(Float64(t_2 - sqrt(x)) + 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));
t_2 = sqrt((x + 1.0));
t_3 = sqrt((1.0 + t)) - sqrt(t);
t_4 = sqrt((1.0 + y)) - sqrt(y);
tmp = 0.0;
if (t_4 <= 5e-5)
tmp = ((t_1 - sqrt(z)) + t_3) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2)));
else
tmp = (t_3 + (1.0 / (sqrt(z) + t_1))) + ((t_2 - sqrt(x)) + 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[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, 5e-5], N[(N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$3 + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$4), $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{x + 1}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
t_4 := \sqrt{1 + y} - \sqrt{y}\\
\mathbf{if}\;t\_4 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{z}\right) + t\_3\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_3 + \frac{1}{\sqrt{z} + t\_1}\right) + \left(\left(t\_2 - \sqrt{x}\right) + t\_4\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.00000000000000024e-5Initial program 86.8%
associate-+l+86.8%
associate-+l-86.7%
associate-+l-86.8%
+-commutative86.8%
+-commutative86.8%
+-commutative86.8%
Simplified86.8%
flip--87.5%
flip--87.8%
frac-add87.8%
Applied egg-rr88.1%
fma-define88.1%
associate--l+88.1%
+-commutative88.1%
+-commutative88.1%
associate--l+91.3%
+-commutative91.3%
+-commutative91.3%
Simplified91.3%
Taylor expanded in y around inf 92.9%
if 5.00000000000000024e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 97.0%
associate-+l+97.0%
associate-+l-55.7%
associate-+l-97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
flip--98.0%
add-sqr-sqrt73.8%
add-sqr-sqrt98.1%
Applied egg-rr97.6%
associate--l+98.9%
+-inverses98.9%
metadata-eval98.9%
Simplified98.3%
Final simplification95.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 (+ x 1.0)))
(t_2 (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))))
(if (<= (- t_1 (sqrt x)) 1.0)
(+ t_2 (/ 1.0 (+ (sqrt x) t_1)))
(+ t_2 (+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = (sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t));
double tmp;
if ((t_1 - sqrt(x)) <= 1.0) {
tmp = t_2 + (1.0 / (sqrt(x) + t_1));
} else {
tmp = t_2 + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = (sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))
if ((t_1 - sqrt(x)) <= 1.0d0) then
tmp = t_2 + (1.0d0 / (sqrt(x) + t_1))
else
tmp = t_2 + (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t));
double tmp;
if ((t_1 - Math.sqrt(x)) <= 1.0) {
tmp = t_2 + (1.0 / (Math.sqrt(x) + t_1));
} else {
tmp = t_2 + (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = (math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t)) tmp = 0 if (t_1 - math.sqrt(x)) <= 1.0: tmp = t_2 + (1.0 / (math.sqrt(x) + t_1)) else: tmp = t_2 + (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) tmp = 0.0 if (Float64(t_1 - sqrt(x)) <= 1.0) tmp = Float64(t_2 + Float64(1.0 / Float64(sqrt(x) + t_1))); else tmp = Float64(t_2 + Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = (sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t));
tmp = 0.0;
if ((t_1 - sqrt(x)) <= 1.0)
tmp = t_2 + (1.0 / (sqrt(x) + t_1));
else
tmp = t_2 + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1.0], N[(t$95$2 + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + 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{x + 1}\\
t_2 := \left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\\
\mathbf{if}\;t\_1 - \sqrt{x} \leq 1:\\
\;\;\;\;t\_2 + \frac{1}{\sqrt{x} + t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 1Initial program 91.9%
associate-+l+91.9%
associate-+l-71.1%
associate-+l-91.9%
+-commutative91.9%
+-commutative91.9%
+-commutative91.9%
Simplified91.9%
flip--92.3%
flip--92.4%
frac-add92.4%
Applied egg-rr92.8%
fma-define92.8%
associate--l+92.8%
+-commutative92.8%
+-commutative92.8%
associate--l+94.4%
+-commutative94.4%
+-commutative94.4%
Simplified94.4%
Taylor expanded in y around inf 53.4%
if 1 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 91.9%
associate-+l+91.9%
associate-+l-71.1%
associate-+l-91.9%
+-commutative91.9%
+-commutative91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in x around 0 36.9%
associate--l+46.8%
Simplified46.8%
Final simplification53.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 (+ x 1.0)) (sqrt x)))
(t_2 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= t_1 5e-7)
(+
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y))))
(+ t_2 (- (sqrt (+ 1.0 t)) (sqrt t))))
(+ t_1 (+ t_2 (- (sqrt (+ 1.0 y)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (t_1 <= 5e-7) {
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_2 + (sqrt((1.0 + t)) - sqrt(t)));
} else {
tmp = t_1 + (t_2 + (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
if (t_1 <= 5d-7) then
tmp = (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y)))) + (t_2 + (sqrt((1.0d0 + t)) - sqrt(t)))
else
tmp = t_1 + (t_2 + (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 t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (t_1 <= 5e-7) {
tmp = (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y)))) + (t_2 + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
} else {
tmp = t_1 + (t_2 + (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): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if t_1 <= 5e-7: tmp = (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y)))) + (t_2 + (math.sqrt((1.0 + t)) - math.sqrt(t))) else: tmp = t_1 + (t_2 + (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) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (t_1 <= 5e-7) tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))) + Float64(t_2 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); else tmp = Float64(t_1 + Float64(t_2 + 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)
t_1 = sqrt((x + 1.0)) - sqrt(x);
t_2 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (t_1 <= 5e-7)
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_2 + (sqrt((1.0 + t)) - sqrt(t)));
else
tmp = t_1 + (t_2 + (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_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-7], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 + 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}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right) + \left(t\_2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_2 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 4.99999999999999977e-7Initial program 87.6%
associate-+l+87.6%
associate-+l-47.1%
associate-+l-87.6%
+-commutative87.6%
+-commutative87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in y around inf 43.8%
Taylor expanded in x around inf 47.3%
distribute-lft-out47.3%
Simplified47.3%
if 4.99999999999999977e-7 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.6%
associate-+l+96.6%
associate-+l+96.6%
+-commutative96.6%
+-commutative96.6%
associate-+l-79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
Taylor expanded in t around inf 59.3%
Final simplification53.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (- t_1 (sqrt x)))
(t_3 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= t_2 0.5)
(+ (+ t_3 (- (sqrt (+ 1.0 t)) (sqrt t))) (/ 1.0 (+ (sqrt x) t_1)))
(+ t_2 (+ t_3 (- (sqrt (+ 1.0 y)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = t_1 - sqrt(x);
double t_3 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (t_2 <= 0.5) {
tmp = (t_3 + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 / (sqrt(x) + t_1));
} else {
tmp = t_2 + (t_3 + (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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = t_1 - sqrt(x)
t_3 = sqrt((1.0d0 + z)) - sqrt(z)
if (t_2 <= 0.5d0) then
tmp = (t_3 + (sqrt((1.0d0 + t)) - sqrt(t))) + (1.0d0 / (sqrt(x) + t_1))
else
tmp = t_2 + (t_3 + (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 t_1 = Math.sqrt((x + 1.0));
double t_2 = t_1 - Math.sqrt(x);
double t_3 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (t_2 <= 0.5) {
tmp = (t_3 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (1.0 / (Math.sqrt(x) + t_1));
} else {
tmp = t_2 + (t_3 + (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): t_1 = math.sqrt((x + 1.0)) t_2 = t_1 - math.sqrt(x) t_3 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if t_2 <= 0.5: tmp = (t_3 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (1.0 / (math.sqrt(x) + t_1)) else: tmp = t_2 + (t_3 + (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) t_1 = sqrt(Float64(x + 1.0)) t_2 = Float64(t_1 - sqrt(x)) t_3 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (t_2 <= 0.5) tmp = Float64(Float64(t_3 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(1.0 / Float64(sqrt(x) + t_1))); else tmp = Float64(t_2 + Float64(t_3 + 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)
t_1 = sqrt((x + 1.0));
t_2 = t_1 - sqrt(x);
t_3 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (t_2 <= 0.5)
tmp = (t_3 + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 / (sqrt(x) + t_1));
else
tmp = t_2 + (t_3 + (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_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.5], N[(N[(t$95$3 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(t$95$3 + 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}
t_1 := \sqrt{x + 1}\\
t_2 := t\_1 - \sqrt{x}\\
t_3 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;t\_2 \leq 0.5:\\
\;\;\;\;\left(t\_3 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \frac{1}{\sqrt{x} + t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(t\_3 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.5Initial program 87.7%
associate-+l+87.7%
associate-+l-48.9%
associate-+l-87.7%
+-commutative87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
flip--88.3%
flip--88.5%
frac-add88.6%
Applied egg-rr89.3%
fma-define89.3%
associate--l+89.3%
+-commutative89.3%
+-commutative89.3%
associate--l+91.9%
+-commutative91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in y around inf 49.3%
if 0.5 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.0%
associate-+l+97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
associate-+l-79.3%
+-commutative79.3%
+-commutative79.3%
Simplified79.3%
Taylor expanded in t around inf 61.4%
Final simplification54.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= t 1.15e+28)
(-
(+ 2.0 (+ t_1 (sqrt (+ 1.0 t))))
(+ (sqrt t) (+ (sqrt z) (+ (sqrt x) (sqrt y)))))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (- t_1 (sqrt z)) (- (sqrt (+ 1.0 y)) (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 + z));
double tmp;
if (t <= 1.15e+28) {
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(t) + (sqrt(z) + (sqrt(x) + sqrt(y))));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 1.15d+28) then
tmp = (2.0d0 + (t_1 + sqrt((1.0d0 + t)))) - (sqrt(t) + (sqrt(z) + (sqrt(x) + sqrt(y))))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (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 t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 1.15e+28) {
tmp = (2.0 + (t_1 + Math.sqrt((1.0 + t)))) - (Math.sqrt(t) + (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y))));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((t_1 - Math.sqrt(z)) + (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): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 1.15e+28: tmp = (2.0 + (t_1 + math.sqrt((1.0 + t)))) - (math.sqrt(t) + (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y)))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((t_1 - math.sqrt(z)) + (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) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 1.15e+28) tmp = Float64(Float64(2.0 + Float64(t_1 + sqrt(Float64(1.0 + t)))) - Float64(sqrt(t) + Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y))))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(t_1 - sqrt(z)) + 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)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 1.15e+28)
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(t) + (sqrt(z) + (sqrt(x) + sqrt(y))));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.15e+28], N[(N[(2.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $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])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 1.15 \cdot 10^{+28}:\\
\;\;\;\;\left(2 + \left(t\_1 + \sqrt{1 + t}\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(t\_1 - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 1.14999999999999992e28Initial program 95.5%
associate-+l+95.5%
associate-+l-76.7%
associate-+l-95.5%
+-commutative95.5%
+-commutative95.5%
+-commutative95.5%
Simplified95.5%
Taylor expanded in y around 0 11.9%
associate-+r+11.9%
+-commutative11.9%
Simplified11.9%
Taylor expanded in x around 0 9.6%
associate-+r+9.6%
Simplified9.6%
if 1.14999999999999992e28 < t Initial program 87.8%
associate-+l+87.8%
associate-+l+87.8%
+-commutative87.8%
+-commutative87.8%
associate-+l-50.5%
+-commutative50.5%
+-commutative50.5%
Simplified50.5%
Taylor expanded in t around inf 87.8%
Final simplification46.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 (+ x 1.0)) (sqrt x)) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((1.0 + z)) - sqrt(z)) + (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 = (sqrt((x + 1.0d0)) - sqrt(x)) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (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 (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (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(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 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 = (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((1.0 + z)) - sqrt(z)) + (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[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $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])\\
\\
\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)
\end{array}
Initial program 91.9%
associate-+l+91.9%
associate-+l+91.9%
+-commutative91.9%
+-commutative91.9%
associate-+l-74.6%
+-commutative74.6%
+-commutative74.6%
Simplified74.6%
Taylor expanded in t around inf 51.9%
Final simplification51.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt x) (sqrt y))))
(if (<= z 2.9e+15)
(- (+ (+ (sqrt (+ 1.0 z)) 2.0) (* 0.5 (sqrt (/ 1.0 t)))) (+ (sqrt z) t_1))
(+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (z <= 2.9e+15) {
tmp = ((sqrt((1.0 + z)) + 2.0) + (0.5 * sqrt((1.0 / t)))) - (sqrt(z) + t_1);
} else {
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
if (z <= 2.9d+15) then
tmp = ((sqrt((1.0d0 + z)) + 2.0d0) + (0.5d0 * sqrt((1.0d0 / t)))) - (sqrt(z) + t_1)
else
tmp = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (z <= 2.9e+15) {
tmp = ((Math.sqrt((1.0 + z)) + 2.0) + (0.5 * Math.sqrt((1.0 / t)))) - (Math.sqrt(z) + t_1);
} else {
tmp = Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if z <= 2.9e+15: tmp = ((math.sqrt((1.0 + z)) + 2.0) + (0.5 * math.sqrt((1.0 / t)))) - (math.sqrt(z) + t_1) else: tmp = math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (z <= 2.9e+15) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) + Float64(0.5 * sqrt(Float64(1.0 / t)))) - Float64(sqrt(z) + t_1)); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (z <= 2.9e+15)
tmp = ((sqrt((1.0 + z)) + 2.0) + (0.5 * sqrt((1.0 / t)))) - (sqrt(z) + t_1);
else
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 2.9e+15], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 2.9 \cdot 10^{+15}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} + 2\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\right) - \left(\sqrt{z} + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - t\_1\right)\\
\end{array}
\end{array}
if z < 2.9e15Initial program 96.5%
associate-+l+96.5%
associate-+l-77.7%
associate-+l-96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in y around 0 11.5%
associate-+r+11.5%
+-commutative11.5%
Simplified11.5%
Taylor expanded in t around inf 16.2%
Taylor expanded in x around 0 14.9%
associate-+r+14.9%
associate-+r+14.9%
+-commutative14.9%
Simplified14.9%
if 2.9e15 < z Initial program 86.9%
associate-+l+86.9%
associate-+l-63.7%
associate-+l-86.9%
+-commutative86.9%
+-commutative86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in t around inf 4.6%
associate--l+19.5%
Simplified19.5%
Taylor expanded in z around inf 24.2%
associate--l+33.5%
Simplified33.5%
Final simplification23.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 (+ x 1.0))))
(if (<= z 3e+15)
(-
(+ 1.0 (+ t_1 (+ (sqrt (+ 1.0 z)) (/ z (- (sqrt y) (sqrt z))))))
(sqrt x))
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (z <= 3e+15) {
tmp = (1.0 + (t_1 + (sqrt((1.0 + z)) + (z / (sqrt(y) - sqrt(z)))))) - sqrt(x);
} else {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
if (z <= 3d+15) then
tmp = (1.0d0 + (t_1 + (sqrt((1.0d0 + z)) + (z / (sqrt(y) - sqrt(z)))))) - sqrt(x)
else
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (z <= 3e+15) {
tmp = (1.0 + (t_1 + (Math.sqrt((1.0 + z)) + (z / (Math.sqrt(y) - Math.sqrt(z)))))) - Math.sqrt(x);
} else {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if z <= 3e+15: tmp = (1.0 + (t_1 + (math.sqrt((1.0 + z)) + (z / (math.sqrt(y) - math.sqrt(z)))))) - math.sqrt(x) else: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (z <= 3e+15) tmp = Float64(Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) + Float64(z / Float64(sqrt(y) - sqrt(z)))))) - sqrt(x)); else tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (z <= 3e+15)
tmp = (1.0 + (t_1 + (sqrt((1.0 + z)) + (z / (sqrt(y) - sqrt(z)))))) - sqrt(x);
else
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 3e+15], N[(N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(z / N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;z \leq 3 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(t\_1 + \left(\sqrt{1 + z} + \frac{z}{\sqrt{y} - \sqrt{z}}\right)\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 3e15Initial program 96.5%
associate-+l+96.5%
associate-+l-77.7%
associate-+l-96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in t around inf 17.0%
associate--l+21.6%
Simplified21.6%
flip-+21.3%
add-sqr-sqrt19.5%
add-sqr-sqrt19.5%
Applied egg-rr19.5%
Taylor expanded in y around 0 31.3%
if 3e15 < z Initial program 86.9%
associate-+l+86.9%
associate-+l-63.7%
associate-+l-86.9%
+-commutative86.9%
+-commutative86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in t around inf 4.6%
associate--l+19.5%
Simplified19.5%
Taylor expanded in z around inf 24.2%
associate--l+33.5%
Simplified33.5%
Final simplification32.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))))
(if (<= z 2.9e+15)
(- (+ 1.0 (+ (sqrt (+ 1.0 z)) t_1)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+ (sqrt (+ x 1.0)) (- t_1 (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 2.9e+15) {
tmp = (1.0 + (sqrt((1.0 + z)) + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = sqrt((x + 1.0)) + (t_1 - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 2.9d+15) then
tmp = (1.0d0 + (sqrt((1.0d0 + z)) + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = sqrt((x + 1.0d0)) + (t_1 - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 2.9e+15) {
tmp = (1.0 + (Math.sqrt((1.0 + z)) + t_1)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = Math.sqrt((x + 1.0)) + (t_1 - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 2.9e+15: tmp = (1.0 + (math.sqrt((1.0 + z)) + t_1)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = math.sqrt((x + 1.0)) + (t_1 - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 2.9e+15) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) + t_1)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(t_1 - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 2.9e+15)
tmp = (1.0 + (sqrt((1.0 + z)) + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = sqrt((x + 1.0)) + (t_1 - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.9e+15], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 2.9 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + z} + t\_1\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 2.9e15Initial program 96.5%
associate-+l+96.5%
associate-+l-77.7%
associate-+l-96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in t around inf 17.0%
associate--l+21.6%
Simplified21.6%
Taylor expanded in x around 0 15.1%
if 2.9e15 < z Initial program 86.9%
associate-+l+86.9%
associate-+l-63.7%
associate-+l-86.9%
+-commutative86.9%
+-commutative86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in t around inf 4.6%
associate--l+19.5%
Simplified19.5%
Taylor expanded in z around inf 24.2%
associate--l+33.5%
Simplified33.5%
Final simplification23.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 x) (sqrt y))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 5e+15)
(+ 1.0 (- (+ (sqrt (+ 1.0 z)) t_2) (+ (sqrt z) t_1)))
(+ (sqrt (+ x 1.0)) (- t_2 t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 5e+15) {
tmp = 1.0 + ((sqrt((1.0 + z)) + t_2) - (sqrt(z) + t_1));
} else {
tmp = sqrt((x + 1.0)) + (t_2 - 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(x) + sqrt(y)
t_2 = sqrt((1.0d0 + y))
if (z <= 5d+15) then
tmp = 1.0d0 + ((sqrt((1.0d0 + z)) + t_2) - (sqrt(z) + t_1))
else
tmp = sqrt((x + 1.0d0)) + (t_2 - 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(x) + Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 5e+15) {
tmp = 1.0 + ((Math.sqrt((1.0 + z)) + t_2) - (Math.sqrt(z) + t_1));
} else {
tmp = Math.sqrt((x + 1.0)) + (t_2 - t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 5e+15: tmp = 1.0 + ((math.sqrt((1.0 + z)) + t_2) - (math.sqrt(z) + t_1)) else: tmp = math.sqrt((x + 1.0)) + (t_2 - t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 5e+15) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + t_2) - Float64(sqrt(z) + t_1))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(t_2 - 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(x) + sqrt(y);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 5e+15)
tmp = 1.0 + ((sqrt((1.0 + z)) + t_2) - (sqrt(z) + t_1));
else
tmp = sqrt((x + 1.0)) + (t_2 - 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[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 5e+15], N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + t$95$2), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$2 - t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 5 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + z} + t\_2\right) - \left(\sqrt{z} + t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(t\_2 - t\_1\right)\\
\end{array}
\end{array}
if z < 5e15Initial program 96.5%
associate-+l+96.5%
associate-+l-77.7%
associate-+l-96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in t around inf 17.0%
associate--l+21.6%
Simplified21.6%
Taylor expanded in x around 0 15.1%
associate--l+26.5%
+-commutative26.5%
associate-+r+26.5%
Simplified26.5%
if 5e15 < z Initial program 86.9%
associate-+l+86.9%
associate-+l-63.7%
associate-+l-86.9%
+-commutative86.9%
+-commutative86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in t around inf 4.6%
associate--l+19.5%
Simplified19.5%
Taylor expanded in z around inf 24.2%
associate--l+33.5%
Simplified33.5%
Final simplification29.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt x) (sqrt y)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (sqrt (+ x 1.0))))
(if (<= z 0.34) (- (+ 1.0 (+ t_2 t_3)) t_1) (+ t_3 (- t_2 t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((x + 1.0));
double tmp;
if (z <= 0.34) {
tmp = (1.0 + (t_2 + t_3)) - t_1;
} else {
tmp = t_3 + (t_2 - 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) :: t_3
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
t_2 = sqrt((1.0d0 + y))
t_3 = sqrt((x + 1.0d0))
if (z <= 0.34d0) then
tmp = (1.0d0 + (t_2 + t_3)) - t_1
else
tmp = t_3 + (t_2 - 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(x) + Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + y));
double t_3 = Math.sqrt((x + 1.0));
double tmp;
if (z <= 0.34) {
tmp = (1.0 + (t_2 + t_3)) - t_1;
} else {
tmp = t_3 + (t_2 - t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) t_2 = math.sqrt((1.0 + y)) t_3 = math.sqrt((x + 1.0)) tmp = 0 if z <= 0.34: tmp = (1.0 + (t_2 + t_3)) - t_1 else: tmp = t_3 + (t_2 - t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) t_2 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (z <= 0.34) tmp = Float64(Float64(1.0 + Float64(t_2 + t_3)) - t_1); else tmp = Float64(t_3 + Float64(t_2 - 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(x) + sqrt(y);
t_2 = sqrt((1.0 + y));
t_3 = sqrt((x + 1.0));
tmp = 0.0;
if (z <= 0.34)
tmp = (1.0 + (t_2 + t_3)) - t_1;
else
tmp = t_3 + (t_2 - 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[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.34], N[(N[(1.0 + N[(t$95$2 + t$95$3), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(t$95$3 + N[(t$95$2 - t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{x + 1}\\
\mathbf{if}\;z \leq 0.34:\\
\;\;\;\;\left(1 + \left(t\_2 + t\_3\right)\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(t\_2 - t\_1\right)\\
\end{array}
\end{array}
if z < 0.340000000000000024Initial program 97.8%
associate-+l+97.8%
associate-+l-78.6%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in t around inf 16.7%
associate--l+21.1%
Simplified21.1%
Taylor expanded in y around inf 20.7%
Taylor expanded in z around 0 16.3%
if 0.340000000000000024 < z Initial program 86.3%
associate-+l+86.3%
associate-+l-63.8%
associate-+l-86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in t around inf 5.7%
associate--l+20.2%
Simplified20.2%
Taylor expanded in z around inf 23.3%
associate--l+32.5%
Simplified32.5%
Final simplification24.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + 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[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)
\end{array}
Initial program 91.9%
associate-+l+91.9%
associate-+l-71.1%
associate-+l-91.9%
+-commutative91.9%
+-commutative91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in t around inf 11.1%
associate--l+20.6%
Simplified20.6%
Taylor expanded in z around inf 15.2%
associate--l+22.0%
Simplified22.0%
Final simplification22.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 (+ x 1.0)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) - 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[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Initial program 91.9%
associate-+l+91.9%
associate-+l-71.1%
associate-+l-91.9%
+-commutative91.9%
+-commutative91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in t around inf 11.1%
associate--l+20.6%
Simplified20.6%
Taylor expanded in x around inf 13.9%
neg-mul-113.9%
Simplified13.9%
Final simplification13.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (sqrt z))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt(z);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt(z)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt(z);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt(z)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(z) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt(z);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[Sqrt[z], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{z}
\end{array}
Initial program 91.9%
associate-+l+91.9%
associate-+l-71.1%
associate-+l-91.9%
+-commutative91.9%
+-commutative91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in t around inf 11.1%
associate--l+20.6%
Simplified20.6%
Taylor expanded in y around inf 14.1%
Taylor expanded in z around inf 7.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 y))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(y) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 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[Sqrt[y], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{y}
\end{array}
Initial program 91.9%
associate-+l+91.9%
associate-+l-71.1%
associate-+l-91.9%
+-commutative91.9%
+-commutative91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in t around inf 11.1%
associate--l+20.6%
Simplified20.6%
flip-+19.3%
add-sqr-sqrt18.0%
add-sqr-sqrt15.8%
Applied egg-rr15.8%
Taylor expanded in y around inf 6.8%
(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 2024136
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (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))))