
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_2 (sqrt (+ 1.0 t)))
(t_3 (- t_2 (sqrt t)))
(t_4 (sqrt (+ 1.0 y)))
(t_5 (+ t_1 (- t_4 (sqrt y)))))
(if (<= t_5 2e-5)
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ (* 0.5 (sqrt (/ 1.0 y))) t_3))
(if (<= t_5 1.2)
(+ t_1 (+ t_3 (/ 1.0 (+ (sqrt y) t_4))))
(+
t_5
(+ (/ 1.0 (+ t_2 (sqrt t))) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double t_2 = sqrt((1.0 + t));
double t_3 = t_2 - sqrt(t);
double t_4 = sqrt((1.0 + y));
double t_5 = t_1 + (t_4 - sqrt(y));
double tmp;
if (t_5 <= 2e-5) {
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_3);
} else if (t_5 <= 1.2) {
tmp = t_1 + (t_3 + (1.0 / (sqrt(y) + t_4)));
} else {
tmp = t_5 + ((1.0 / (t_2 + sqrt(t))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
t_2 = sqrt((1.0d0 + t))
t_3 = t_2 - sqrt(t)
t_4 = sqrt((1.0d0 + y))
t_5 = t_1 + (t_4 - sqrt(y))
if (t_5 <= 2d-5) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + t_3)
else if (t_5 <= 1.2d0) then
tmp = t_1 + (t_3 + (1.0d0 / (sqrt(y) + t_4)))
else
tmp = t_5 + ((1.0d0 / (t_2 + sqrt(t))) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + t));
double t_3 = t_2 - Math.sqrt(t);
double t_4 = Math.sqrt((1.0 + y));
double t_5 = t_1 + (t_4 - Math.sqrt(y));
double tmp;
if (t_5 <= 2e-5) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + t_3);
} else if (t_5 <= 1.2) {
tmp = t_1 + (t_3 + (1.0 / (Math.sqrt(y) + t_4)));
} else {
tmp = t_5 + ((1.0 / (t_2 + Math.sqrt(t))) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))));
}
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 + t)) t_3 = t_2 - math.sqrt(t) t_4 = math.sqrt((1.0 + y)) t_5 = t_1 + (t_4 - math.sqrt(y)) tmp = 0 if t_5 <= 2e-5: tmp = (0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + t_3) elif t_5 <= 1.2: tmp = t_1 + (t_3 + (1.0 / (math.sqrt(y) + t_4))) else: tmp = t_5 + ((1.0 / (t_2 + math.sqrt(t))) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) 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 = sqrt(Float64(1.0 + t)) t_3 = Float64(t_2 - sqrt(t)) t_4 = sqrt(Float64(1.0 + y)) t_5 = Float64(t_1 + Float64(t_4 - sqrt(y))) tmp = 0.0 if (t_5 <= 2e-5) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + t_3)); elseif (t_5 <= 1.2) tmp = Float64(t_1 + Float64(t_3 + Float64(1.0 / Float64(sqrt(y) + t_4)))); else tmp = Float64(t_5 + Float64(Float64(1.0 / Float64(t_2 + sqrt(t))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
t_2 = sqrt((1.0 + t));
t_3 = t_2 - sqrt(t);
t_4 = sqrt((1.0 + y));
t_5 = t_1 + (t_4 - sqrt(y));
tmp = 0.0;
if (t_5 <= 2e-5)
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_3);
elseif (t_5 <= 1.2)
tmp = t_1 + (t_3 + (1.0 / (sqrt(y) + t_4)));
else
tmp = t_5 + ((1.0 / (t_2 + sqrt(t))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 2e-5], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 1.2], N[(t$95$1 + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$5 + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $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} - \sqrt{x}\\
t_2 := \sqrt{1 + t}\\
t_3 := t\_2 - \sqrt{t}\\
t_4 := \sqrt{1 + y}\\
t_5 := t\_1 + \left(t\_4 - \sqrt{y}\right)\\
\mathbf{if}\;t\_5 \leq 2 \cdot 10^{-5}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + t\_3\right)\\
\mathbf{elif}\;t\_5 \leq 1.2:\\
\;\;\;\;t\_1 + \left(t\_3 + \frac{1}{\sqrt{y} + t\_4}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_5 + \left(\frac{1}{t\_2 + \sqrt{t}} + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (+.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))) < 2.00000000000000016e-5Initial program 73.2%
associate-+l+73.2%
associate-+l+73.2%
+-commutative73.2%
+-commutative73.2%
associate-+l-55.3%
+-commutative55.3%
+-commutative55.3%
Simplified55.3%
Taylor expanded in z around inf 30.2%
Taylor expanded in x around inf 34.2%
Taylor expanded in y around inf 40.9%
if 2.00000000000000016e-5 < (+.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))) < 1.19999999999999996Initial program 96.7%
associate-+l+96.7%
associate-+l+96.7%
+-commutative96.7%
+-commutative96.7%
associate-+l-78.6%
+-commutative78.6%
+-commutative78.6%
Simplified78.6%
Taylor expanded in z around inf 51.0%
flip--51.1%
add-sqr-sqrt38.2%
add-sqr-sqrt51.1%
Applied egg-rr51.1%
associate--l+51.3%
+-inverses51.3%
metadata-eval51.3%
+-commutative51.3%
Simplified51.3%
if 1.19999999999999996 < (+.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))) Initial program 96.7%
associate-+l+96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
flip--96.8%
add-sqr-sqrt77.4%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
Simplified98.3%
flip--98.7%
add-sqr-sqrt83.5%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate--l+99.8%
+-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification60.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_2 (sqrt (+ 1.0 t)))
(t_3 (- t_2 (sqrt t)))
(t_4 (sqrt (+ 1.0 y)))
(t_5 (+ t_1 (- t_4 (sqrt y)))))
(if (<= t_5 2e-5)
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ (* 0.5 (sqrt (/ 1.0 y))) t_3))
(if (<= t_5 1.96)
(+ t_1 (+ t_3 (/ 1.0 (+ (sqrt y) t_4))))
(+
(+ (/ 1.0 (+ t_2 (sqrt t))) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(- (+ 1.0 t_4) (+ (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)) - sqrt(x);
double t_2 = sqrt((1.0 + t));
double t_3 = t_2 - sqrt(t);
double t_4 = sqrt((1.0 + y));
double t_5 = t_1 + (t_4 - sqrt(y));
double tmp;
if (t_5 <= 2e-5) {
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_3);
} else if (t_5 <= 1.96) {
tmp = t_1 + (t_3 + (1.0 / (sqrt(y) + t_4)));
} else {
tmp = ((1.0 / (t_2 + sqrt(t))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((1.0 + t_4) - (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) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
t_2 = sqrt((1.0d0 + t))
t_3 = t_2 - sqrt(t)
t_4 = sqrt((1.0d0 + y))
t_5 = t_1 + (t_4 - sqrt(y))
if (t_5 <= 2d-5) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + t_3)
else if (t_5 <= 1.96d0) then
tmp = t_1 + (t_3 + (1.0d0 / (sqrt(y) + t_4)))
else
tmp = ((1.0d0 / (t_2 + sqrt(t))) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + ((1.0d0 + t_4) - (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)) - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + t));
double t_3 = t_2 - Math.sqrt(t);
double t_4 = Math.sqrt((1.0 + y));
double t_5 = t_1 + (t_4 - Math.sqrt(y));
double tmp;
if (t_5 <= 2e-5) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + t_3);
} else if (t_5 <= 1.96) {
tmp = t_1 + (t_3 + (1.0 / (Math.sqrt(y) + t_4)));
} else {
tmp = ((1.0 / (t_2 + Math.sqrt(t))) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + ((1.0 + t_4) - (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)) - math.sqrt(x) t_2 = math.sqrt((1.0 + t)) t_3 = t_2 - math.sqrt(t) t_4 = math.sqrt((1.0 + y)) t_5 = t_1 + (t_4 - math.sqrt(y)) tmp = 0 if t_5 <= 2e-5: tmp = (0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + t_3) elif t_5 <= 1.96: tmp = t_1 + (t_3 + (1.0 / (math.sqrt(y) + t_4))) else: tmp = ((1.0 / (t_2 + math.sqrt(t))) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + ((1.0 + t_4) - (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 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_2 = sqrt(Float64(1.0 + t)) t_3 = Float64(t_2 - sqrt(t)) t_4 = sqrt(Float64(1.0 + y)) t_5 = Float64(t_1 + Float64(t_4 - sqrt(y))) tmp = 0.0 if (t_5 <= 2e-5) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + t_3)); elseif (t_5 <= 1.96) tmp = Float64(t_1 + Float64(t_3 + Float64(1.0 / Float64(sqrt(y) + t_4)))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(t))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + Float64(Float64(1.0 + t_4) - 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)) - sqrt(x);
t_2 = sqrt((1.0 + t));
t_3 = t_2 - sqrt(t);
t_4 = sqrt((1.0 + y));
t_5 = t_1 + (t_4 - sqrt(y));
tmp = 0.0;
if (t_5 <= 2e-5)
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_3);
elseif (t_5 <= 1.96)
tmp = t_1 + (t_3 + (1.0 / (sqrt(y) + t_4)));
else
tmp = ((1.0 / (t_2 + sqrt(t))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((1.0 + t_4) - (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[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 2e-5], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 1.96], N[(t$95$1 + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + t$95$4), $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} - \sqrt{x}\\
t_2 := \sqrt{1 + t}\\
t_3 := t\_2 - \sqrt{t}\\
t_4 := \sqrt{1 + y}\\
t_5 := t\_1 + \left(t\_4 - \sqrt{y}\right)\\
\mathbf{if}\;t\_5 \leq 2 \cdot 10^{-5}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + t\_3\right)\\
\mathbf{elif}\;t\_5 \leq 1.96:\\
\;\;\;\;t\_1 + \left(t\_3 + \frac{1}{\sqrt{y} + t\_4}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_2 + \sqrt{t}} + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(\left(1 + t\_4\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (+.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))) < 2.00000000000000016e-5Initial program 73.2%
associate-+l+73.2%
associate-+l+73.2%
+-commutative73.2%
+-commutative73.2%
associate-+l-55.3%
+-commutative55.3%
+-commutative55.3%
Simplified55.3%
Taylor expanded in z around inf 30.2%
Taylor expanded in x around inf 34.2%
Taylor expanded in y around inf 40.9%
if 2.00000000000000016e-5 < (+.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))) < 1.96Initial program 96.7%
associate-+l+96.7%
associate-+l+96.7%
+-commutative96.7%
+-commutative96.7%
associate-+l-78.6%
+-commutative78.6%
+-commutative78.6%
Simplified78.6%
Taylor expanded in z around inf 51.0%
flip--51.1%
add-sqr-sqrt38.2%
add-sqr-sqrt51.1%
Applied egg-rr51.1%
associate--l+51.3%
+-inverses51.3%
metadata-eval51.3%
+-commutative51.3%
Simplified51.3%
if 1.96 < (+.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))) Initial program 96.7%
associate-+l+96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
flip--96.8%
add-sqr-sqrt77.4%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
Simplified98.3%
flip--98.7%
add-sqr-sqrt83.5%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate--l+99.8%
+-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 98.6%
Final simplification60.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 (+ x 1.0)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (sqrt (+ 1.0 t)))
(t_4 (- t_3 (sqrt t))))
(if (<= y 1.2e-19)
(-
(+
(+ (/ 1.0 (+ t_3 (sqrt t))) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
2.0)
(+ (sqrt x) (sqrt y)))
(if (<= y 7.5e+30)
(+ (- t_1 (sqrt x)) (+ t_4 (/ 1.0 (+ (sqrt y) t_2))))
(+ (/ (+ 1.0 (- x x)) (+ (sqrt x) t_1)) (+ t_4 (- t_2 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((1.0 + t));
double t_4 = t_3 - sqrt(t);
double tmp;
if (y <= 1.2e-19) {
tmp = (((1.0 / (t_3 + sqrt(t))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + 2.0) - (sqrt(x) + sqrt(y));
} else if (y <= 7.5e+30) {
tmp = (t_1 - sqrt(x)) + (t_4 + (1.0 / (sqrt(y) + t_2)));
} else {
tmp = ((1.0 + (x - x)) / (sqrt(x) + t_1)) + (t_4 + (t_2 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((1.0d0 + y))
t_3 = sqrt((1.0d0 + t))
t_4 = t_3 - sqrt(t)
if (y <= 1.2d-19) then
tmp = (((1.0d0 / (t_3 + sqrt(t))) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + 2.0d0) - (sqrt(x) + sqrt(y))
else if (y <= 7.5d+30) then
tmp = (t_1 - sqrt(x)) + (t_4 + (1.0d0 / (sqrt(y) + t_2)))
else
tmp = ((1.0d0 + (x - x)) / (sqrt(x) + t_1)) + (t_4 + (t_2 - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((1.0 + y));
double t_3 = Math.sqrt((1.0 + t));
double t_4 = t_3 - Math.sqrt(t);
double tmp;
if (y <= 1.2e-19) {
tmp = (((1.0 / (t_3 + Math.sqrt(t))) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + 2.0) - (Math.sqrt(x) + Math.sqrt(y));
} else if (y <= 7.5e+30) {
tmp = (t_1 - Math.sqrt(x)) + (t_4 + (1.0 / (Math.sqrt(y) + t_2)));
} else {
tmp = ((1.0 + (x - x)) / (Math.sqrt(x) + t_1)) + (t_4 + (t_2 - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((1.0 + y)) t_3 = math.sqrt((1.0 + t)) t_4 = t_3 - math.sqrt(t) tmp = 0 if y <= 1.2e-19: tmp = (((1.0 / (t_3 + math.sqrt(t))) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + 2.0) - (math.sqrt(x) + math.sqrt(y)) elif y <= 7.5e+30: tmp = (t_1 - math.sqrt(x)) + (t_4 + (1.0 / (math.sqrt(y) + t_2))) else: tmp = ((1.0 + (x - x)) / (math.sqrt(x) + t_1)) + (t_4 + (t_2 - 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 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(1.0 + t)) t_4 = Float64(t_3 - sqrt(t)) tmp = 0.0 if (y <= 1.2e-19) tmp = Float64(Float64(Float64(Float64(1.0 / Float64(t_3 + sqrt(t))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + 2.0) - Float64(sqrt(x) + sqrt(y))); elseif (y <= 7.5e+30) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(t_4 + Float64(1.0 / Float64(sqrt(y) + t_2)))); else tmp = Float64(Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + t_1)) + Float64(t_4 + Float64(t_2 - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((1.0 + y));
t_3 = sqrt((1.0 + t));
t_4 = t_3 - sqrt(t);
tmp = 0.0;
if (y <= 1.2e-19)
tmp = (((1.0 / (t_3 + sqrt(t))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + 2.0) - (sqrt(x) + sqrt(y));
elseif (y <= 7.5e+30)
tmp = (t_1 - sqrt(x)) + (t_4 + (1.0 / (sqrt(y) + t_2)));
else
tmp = ((1.0 + (x - x)) / (sqrt(x) + t_1)) + (t_4 + (t_2 - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.2e-19], N[(N[(N[(N[(1.0 / N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+30], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + t}\\
t_4 := t\_3 - \sqrt{t}\\
\mathbf{if}\;y \leq 1.2 \cdot 10^{-19}:\\
\;\;\;\;\left(\left(\frac{1}{t\_3 + \sqrt{t}} + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + 2\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+30}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(t\_4 + \frac{1}{\sqrt{y} + t\_2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t\_1} + \left(t\_4 + \left(t\_2 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if y < 1.20000000000000011e-19Initial program 97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
flip--97.4%
add-sqr-sqrt78.8%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
flip--98.4%
add-sqr-sqrt81.9%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate--l+99.0%
+-inverses99.0%
metadata-eval99.0%
Simplified99.0%
Taylor expanded in x around 0 50.8%
Taylor expanded in y around 0 50.8%
if 1.20000000000000011e-19 < y < 7.49999999999999973e30Initial program 86.8%
associate-+l+86.8%
associate-+l+86.8%
+-commutative86.8%
+-commutative86.8%
associate-+l-76.3%
+-commutative76.3%
+-commutative76.3%
Simplified76.3%
Taylor expanded in z around inf 55.1%
flip--57.2%
add-sqr-sqrt56.0%
add-sqr-sqrt57.4%
Applied egg-rr57.4%
associate--l+59.8%
+-inverses59.8%
metadata-eval59.8%
+-commutative59.8%
Simplified59.8%
if 7.49999999999999973e30 < y Initial program 86.1%
associate-+l+86.1%
associate-+l+86.1%
+-commutative86.1%
+-commutative86.1%
associate-+l-67.5%
+-commutative67.5%
+-commutative67.5%
Simplified67.5%
Taylor expanded in z around inf 40.8%
flip--40.8%
add-sqr-sqrt35.9%
+-commutative35.9%
add-sqr-sqrt40.8%
+-commutative40.8%
Applied egg-rr40.8%
associate--l+42.6%
Simplified42.6%
Final simplification47.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))))
(if (<= y 1.2e-19)
(-
(+
(+ (/ 1.0 (+ t_1 (sqrt t))) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
2.0)
(+ (sqrt x) (sqrt y)))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (- t_1 (sqrt t)) (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t));
double tmp;
if (y <= 1.2e-19) {
tmp = (((1.0 / (t_1 + sqrt(t))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + 2.0) - (sqrt(x) + sqrt(y));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(t)) + (1.0 / (sqrt(y) + sqrt((1.0 + 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 + t))
if (y <= 1.2d-19) then
tmp = (((1.0d0 / (t_1 + sqrt(t))) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + 2.0d0) - (sqrt(x) + sqrt(y))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((t_1 - sqrt(t)) + (1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t));
double tmp;
if (y <= 1.2e-19) {
tmp = (((1.0 / (t_1 + Math.sqrt(t))) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + 2.0) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((t_1 - Math.sqrt(t)) + (1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) tmp = 0 if y <= 1.2e-19: tmp = (((1.0 / (t_1 + math.sqrt(t))) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + 2.0) - (math.sqrt(x) + math.sqrt(y)) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((t_1 - math.sqrt(t)) + (1.0 / (math.sqrt(y) + math.sqrt((1.0 + y))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (y <= 1.2e-19) tmp = Float64(Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(t))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + 2.0) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(t_1 - sqrt(t)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t));
tmp = 0.0;
if (y <= 1.2e-19)
tmp = (((1.0 / (t_1 + sqrt(t))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + 2.0) - (sqrt(x) + sqrt(y));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(t)) + (1.0 / (sqrt(y) + sqrt((1.0 + 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 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.2e-19], N[(N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $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[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t}\\
\mathbf{if}\;y \leq 1.2 \cdot 10^{-19}:\\
\;\;\;\;\left(\left(\frac{1}{t\_1 + \sqrt{t}} + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + 2\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(t\_1 - \sqrt{t}\right) + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right)\\
\end{array}
\end{array}
if y < 1.20000000000000011e-19Initial program 97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
flip--97.4%
add-sqr-sqrt78.8%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
flip--98.4%
add-sqr-sqrt81.9%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate--l+99.0%
+-inverses99.0%
metadata-eval99.0%
Simplified99.0%
Taylor expanded in x around 0 50.8%
Taylor expanded in y around 0 50.8%
if 1.20000000000000011e-19 < y Initial program 86.1%
associate-+l+86.1%
associate-+l+86.1%
+-commutative86.1%
+-commutative86.1%
associate-+l-68.5%
+-commutative68.5%
+-commutative68.5%
Simplified68.5%
Taylor expanded in z around inf 42.3%
flip--42.5%
add-sqr-sqrt24.0%
add-sqr-sqrt42.5%
Applied egg-rr42.5%
associate--l+46.0%
+-inverses46.0%
metadata-eval46.0%
+-commutative46.0%
Simplified46.0%
Final simplification48.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 2.3e+29)
(-
(+ 1.0 (+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))
(+ (sqrt x) (sqrt y)))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt y) t_1)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 2.3e+29) {
tmp = (1.0 + (t_1 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))))) - (sqrt(x) + sqrt(y));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt(y) + t_1)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 2.3d+29) then
tmp = (1.0d0 + (t_1 + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))) - (sqrt(x) + sqrt(y))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt(y) + t_1)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 2.3e+29) {
tmp = (1.0 + (t_1 + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt(y) + t_1)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 2.3e+29: tmp = (1.0 + (t_1 + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt(y) + t_1))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 2.3e+29) tmp = Float64(Float64(1.0 + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(y) + t_1)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 2.3e+29)
tmp = (1.0 + (t_1 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))))) - (sqrt(x) + sqrt(y));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt(y) + t_1)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.3e+29], N[(N[(1.0 + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $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.3 \cdot 10^{+29}:\\
\;\;\;\;\left(1 + \left(t\_1 + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{y} + t\_1}\right)\\
\end{array}
\end{array}
if z < 2.3000000000000001e29Initial program 94.0%
associate-+l+94.0%
+-commutative94.0%
+-commutative94.0%
+-commutative94.0%
Simplified94.0%
flip--94.5%
add-sqr-sqrt93.5%
add-sqr-sqrt95.7%
Applied egg-rr95.7%
associate--l+97.0%
+-inverses97.0%
metadata-eval97.0%
Simplified97.0%
flip--97.2%
add-sqr-sqrt76.7%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
associate--l+98.2%
+-inverses98.2%
metadata-eval98.2%
Simplified98.2%
Taylor expanded in x around 0 38.4%
Taylor expanded in t around inf 12.8%
+-commutative12.8%
Simplified12.8%
if 2.3000000000000001e29 < z Initial program 87.4%
associate-+l+87.4%
associate-+l+87.4%
+-commutative87.4%
+-commutative87.4%
associate-+l-87.4%
+-commutative87.4%
+-commutative87.4%
Simplified87.4%
Taylor expanded in z around inf 87.4%
flip--87.7%
add-sqr-sqrt70.3%
add-sqr-sqrt87.7%
Applied egg-rr87.7%
associate--l+91.8%
+-inverses91.8%
metadata-eval91.8%
+-commutative91.8%
Simplified91.8%
Final simplification45.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (sqrt (+ x 1.0))))
(if (<= y 1.05e-19)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))
(if (<= y 16500000.0)
(+ t_2 (- (+ t_1 (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y))))
(+
(- t_2 (sqrt x))
(+ (* 0.5 (sqrt (/ 1.0 y))) (- (sqrt (+ 1.0 t)) (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((x + 1.0));
double tmp;
if (y <= 1.05e-19) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
} else if (y <= 16500000.0) {
tmp = t_2 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (t_2 - sqrt(x)) + ((0.5 * sqrt((1.0 / y))) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((x + 1.0d0))
if (y <= 1.05d-19) then
tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))))
else if (y <= 16500000.0d0) then
tmp = t_2 + ((t_1 + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
else
tmp = (t_2 - sqrt(x)) + ((0.5d0 * sqrt((1.0d0 / y))) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 1.05e-19) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)))));
} else if (y <= 16500000.0) {
tmp = t_2 + ((t_1 + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (t_2 - Math.sqrt(x)) + ((0.5 * Math.sqrt((1.0 / y))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((x + 1.0)) tmp = 0 if y <= 1.05e-19: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))))) elif y <= 16500000.0: tmp = t_2 + ((t_1 + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (t_2 - math.sqrt(x)) + ((0.5 * math.sqrt((1.0 / y))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 1.05e-19) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))))); elseif (y <= 16500000.0) tmp = Float64(t_2 + Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 1.05e-19)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
elseif (y <= 16500000.0)
tmp = t_2 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
else
tmp = (t_2 - sqrt(x)) + ((0.5 * sqrt((1.0 / y))) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.05e-19], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 16500000.0], N[(t$95$2 + N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 1.05 \cdot 10^{-19}:\\
\;\;\;\;1 + \left(t\_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{elif}\;y \leq 16500000:\\
\;\;\;\;t\_2 + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 - \sqrt{x}\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if y < 1.0499999999999999e-19Initial program 97.3%
+-commutative97.3%
associate-+r+97.3%
associate-+r-97.3%
associate-+l-97.3%
associate-+r-97.3%
Simplified78.6%
Taylor expanded in t around inf 16.3%
Taylor expanded in x around 0 13.8%
associate--l+21.3%
associate--l+32.2%
+-commutative32.2%
Simplified32.2%
if 1.0499999999999999e-19 < y < 1.65e7Initial program 93.0%
+-commutative93.0%
associate-+r+93.0%
associate-+r-93.0%
associate-+l-93.0%
associate-+r-92.6%
Simplified63.8%
Taylor expanded in t around inf 4.8%
Taylor expanded in z around inf 30.3%
associate--l+30.3%
Simplified30.3%
if 1.65e7 < y Initial program 85.6%
associate-+l+85.6%
associate-+l+85.6%
+-commutative85.6%
+-commutative85.6%
associate-+l-67.2%
+-commutative67.2%
+-commutative67.2%
Simplified67.2%
Taylor expanded in z around inf 40.6%
Taylor expanded in y around inf 44.6%
Final simplification38.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 460000000.0)
(-
(+ 1.0 (+ (sqrt (+ 1.0 y)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))
(+ (sqrt x) (sqrt y)))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (* 0.5 (sqrt (/ 1.0 y))) (- (sqrt (+ 1.0 t)) (sqrt t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 460000000.0) {
tmp = (1.0 + (sqrt((1.0 + y)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))))) - (sqrt(x) + sqrt(y));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((0.5 * sqrt((1.0 / y))) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 460000000.0d0) then
tmp = (1.0d0 + (sqrt((1.0d0 + y)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))) - (sqrt(x) + sqrt(y))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((0.5d0 * sqrt((1.0d0 / y))) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 460000000.0) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((0.5 * Math.sqrt((1.0 / y))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 460000000.0: tmp = (1.0 + (math.sqrt((1.0 + y)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((0.5 * math.sqrt((1.0 / y))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 460000000.0) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 460000000.0)
tmp = (1.0 + (sqrt((1.0 + y)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))))) - (sqrt(x) + sqrt(y));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((0.5 * sqrt((1.0 / y))) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 460000000.0], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 460000000:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if y < 4.6e8Initial program 97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
flip--97.0%
add-sqr-sqrt77.7%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
associate--l+98.0%
+-inverses98.0%
metadata-eval98.0%
Simplified98.0%
flip--98.2%
add-sqr-sqrt80.8%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in x around 0 50.0%
Taylor expanded in t around inf 27.3%
+-commutative27.3%
Simplified27.3%
if 4.6e8 < y Initial program 85.6%
associate-+l+85.6%
associate-+l+85.6%
+-commutative85.6%
+-commutative85.6%
associate-+l-67.2%
+-commutative67.2%
+-commutative67.2%
Simplified67.2%
Taylor expanded in z around inf 40.6%
Taylor expanded in y around inf 44.6%
Final simplification36.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1100000000.0)
(+
(- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y)))
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (* 0.5 (sqrt (/ 1.0 y))) (- (sqrt (+ 1.0 t)) (sqrt t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1100000000.0) {
tmp = ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((0.5 * sqrt((1.0 / y))) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1100000000.0d0) then
tmp = ((1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((0.5d0 * sqrt((1.0d0 / y))) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1100000000.0) {
tmp = ((1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y))) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((0.5 * Math.sqrt((1.0 / y))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1100000000.0: tmp = ((1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y))) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((0.5 * math.sqrt((1.0 / y))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1100000000.0) tmp = Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1100000000.0)
tmp = ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((0.5 * sqrt((1.0 / y))) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1100000000.0], N[(N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1100000000:\\
\;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if y < 1.1e9Initial program 97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
flip--97.0%
add-sqr-sqrt77.7%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
associate--l+98.0%
+-inverses98.0%
metadata-eval98.0%
Simplified98.0%
flip--98.2%
add-sqr-sqrt80.8%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in x around 0 50.0%
Taylor expanded in t around inf 27.3%
if 1.1e9 < y Initial program 85.6%
associate-+l+85.6%
associate-+l+85.6%
+-commutative85.6%
+-commutative85.6%
associate-+l-67.2%
+-commutative67.2%
+-commutative67.2%
Simplified67.2%
Taylor expanded in z around inf 40.6%
Taylor expanded in y around inf 44.6%
Final simplification36.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 y))))
(if (<= z 49000000.0)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))
(+
(sqrt (+ x 1.0))
(- (+ t_1 (* 0.5 (sqrt (/ 1.0 z)))) (+ (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 <= 49000000.0) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
} else {
tmp = sqrt((x + 1.0)) + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (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 <= 49000000.0d0) then
tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))))
else
tmp = sqrt((x + 1.0d0)) + ((t_1 + (0.5d0 * sqrt((1.0d0 / z)))) - (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 <= 49000000.0) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)))));
} else {
tmp = Math.sqrt((x + 1.0)) + ((t_1 + (0.5 * Math.sqrt((1.0 / z)))) - (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 <= 49000000.0: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))))) else: tmp = math.sqrt((x + 1.0)) + ((t_1 + (0.5 * math.sqrt((1.0 / z)))) - (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 <= 49000000.0) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - 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 <= 49000000.0)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
else
tmp = sqrt((x + 1.0)) + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (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, 49000000.0], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $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{1 + y}\\
\mathbf{if}\;z \leq 49000000:\\
\;\;\;\;1 + \left(t\_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 4.9e7Initial program 96.7%
+-commutative96.7%
associate-+r+96.7%
associate-+r-73.7%
associate-+l-62.7%
associate-+r-49.3%
Simplified49.3%
Taylor expanded in t around inf 13.9%
Taylor expanded in x around 0 11.6%
associate--l+19.8%
associate--l+19.8%
+-commutative19.8%
Simplified19.8%
if 4.9e7 < z Initial program 85.0%
+-commutative85.0%
associate-+r+85.0%
associate-+r-67.2%
associate-+l-54.9%
associate-+r-53.9%
Simplified32.3%
Taylor expanded in t around inf 5.2%
Taylor expanded in z around inf 23.2%
associate--l+33.2%
Simplified33.2%
Final simplification26.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 y))))
(if (<= z 4.8e+15)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (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 <= 4.8e+15) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (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 <= 4.8d+15) then
tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (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 <= 4.8e+15) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (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 <= 4.8e+15: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (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 <= 4.8e+15) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - 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 <= 4.8e+15)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (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, 4.8e+15], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $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 4.8 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(t\_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 4.8e15Initial program 95.3%
+-commutative95.3%
associate-+r+95.3%
associate-+r-72.9%
associate-+l-62.1%
associate-+r-48.4%
Simplified48.5%
Taylor expanded in t around inf 13.9%
Taylor expanded in x around 0 11.7%
associate--l+20.0%
associate--l+20.0%
+-commutative20.0%
Simplified20.0%
if 4.8e15 < z Initial program 86.1%
+-commutative86.1%
associate-+r+86.1%
associate-+r-67.7%
associate-+l-55.2%
associate-+r-55.2%
Simplified32.3%
Taylor expanded in t around inf 4.6%
Taylor expanded in z around inf 23.1%
associate--l+33.2%
Simplified33.2%
Final simplification25.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 21.0)
(+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(+
(* 0.5 (sqrt (/ 1.0 x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (- (sqrt (+ 1.0 t)) (sqrt t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 21.0) {
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 21.0d0) then
tmp = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = (0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 21.0) {
tmp = Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 21.0: tmp = math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 21.0) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 21.0)
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 21.0], 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], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 21:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if x < 21Initial program 96.4%
+-commutative96.4%
associate-+r+96.4%
associate-+r-57.1%
associate-+l-54.8%
associate-+r-50.3%
Simplified30.6%
Taylor expanded in t around inf 14.5%
Taylor expanded in z around inf 22.4%
associate--l+35.6%
Simplified35.6%
if 21 < x Initial program 85.5%
associate-+l+85.5%
associate-+l+85.5%
+-commutative85.5%
+-commutative85.5%
associate-+l-67.9%
+-commutative67.9%
+-commutative67.9%
Simplified67.9%
Taylor expanded in z around inf 41.7%
Taylor expanded in x around inf 43.7%
Taylor expanded in y around inf 23.8%
Final simplification29.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= x 21.0)
(+ (sqrt (+ x 1.0)) (- t_1 (+ (sqrt x) (sqrt y))))
(+ (* 0.5 (sqrt (/ 1.0 x))) (- t_1 (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (x <= 21.0) {
tmp = sqrt((x + 1.0)) + (t_1 - (sqrt(x) + sqrt(y)));
} else {
tmp = (0.5 * sqrt((1.0 / x))) + (t_1 - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (x <= 21.0d0) then
tmp = sqrt((x + 1.0d0)) + (t_1 - (sqrt(x) + sqrt(y)))
else
tmp = (0.5d0 * sqrt((1.0d0 / x))) + (t_1 - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (x <= 21.0) {
tmp = Math.sqrt((x + 1.0)) + (t_1 - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (0.5 * Math.sqrt((1.0 / x))) + (t_1 - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if x <= 21.0: tmp = math.sqrt((x + 1.0)) + (t_1 - (math.sqrt(x) + math.sqrt(y))) else: tmp = (0.5 * math.sqrt((1.0 / x))) + (t_1 - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (x <= 21.0) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(t_1 - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_1 - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (x <= 21.0)
tmp = sqrt((x + 1.0)) + (t_1 - (sqrt(x) + sqrt(y)));
else
tmp = (0.5 * sqrt((1.0 / x))) + (t_1 - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 21.0], 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], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;x \leq 21:\\
\;\;\;\;\sqrt{x + 1} + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_1 - \sqrt{y}\right)\\
\end{array}
\end{array}
if x < 21Initial program 96.4%
+-commutative96.4%
associate-+r+96.4%
associate-+r-57.1%
associate-+l-54.8%
associate-+r-50.3%
Simplified30.6%
Taylor expanded in t around inf 14.5%
Taylor expanded in z around inf 22.4%
associate--l+35.6%
Simplified35.6%
if 21 < x Initial program 85.5%
associate-+l+85.5%
associate-+l+85.5%
+-commutative85.5%
+-commutative85.5%
associate-+l-67.9%
+-commutative67.9%
+-commutative67.9%
Simplified67.9%
Taylor expanded in z around inf 41.7%
Taylor expanded in x around inf 43.7%
Taylor expanded in t around inf 21.4%
Final simplification28.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= x 4.5e-15)
(+ t_1 (pow (* (cbrt -1.0) (pow y 0.16666666666666666)) 3.0))
(+ (* 0.5 (sqrt (/ 1.0 x))) (- t_1 (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (x <= 4.5e-15) {
tmp = t_1 + pow((cbrt(-1.0) * pow(y, 0.16666666666666666)), 3.0);
} else {
tmp = (0.5 * sqrt((1.0 / x))) + (t_1 - sqrt(y));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (x <= 4.5e-15) {
tmp = t_1 + Math.pow((Math.cbrt(-1.0) * Math.pow(y, 0.16666666666666666)), 3.0);
} else {
tmp = (0.5 * Math.sqrt((1.0 / x))) + (t_1 - Math.sqrt(y));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (x <= 4.5e-15) tmp = Float64(t_1 + (Float64(cbrt(-1.0) * (y ^ 0.16666666666666666)) ^ 3.0)); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_1 - sqrt(y))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.5e-15], N[(t$95$1 + N[Power[N[(N[Power[-1.0, 1/3], $MachinePrecision] * N[Power[y, 0.16666666666666666], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{-15}:\\
\;\;\;\;t\_1 + {\left(\sqrt[3]{-1} \cdot {y}^{0.16666666666666666}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_1 - \sqrt{y}\right)\\
\end{array}
\end{array}
if x < 4.4999999999999998e-15Initial program 96.3%
+-commutative96.3%
associate-+r+96.3%
associate-+r-57.6%
associate-+l-55.5%
associate-+r-51.0%
Simplified30.7%
Taylor expanded in y around inf 10.2%
neg-mul-110.2%
Simplified10.2%
add-cube-cbrt10.3%
pow310.4%
Applied egg-rr10.4%
Taylor expanded in y around 0 12.5%
*-commutative12.5%
*-lft-identity12.5%
Simplified12.5%
if 4.4999999999999998e-15 < x Initial program 86.3%
associate-+l+86.3%
associate-+l+86.3%
+-commutative86.3%
+-commutative86.3%
associate-+l-68.6%
+-commutative68.6%
+-commutative68.6%
Simplified68.6%
Taylor expanded in z around inf 42.8%
Taylor expanded in x around inf 41.9%
Taylor expanded in t around inf 20.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= x 4.5e-15)
(+ t_1 (- 0.0 (pow (pow y 1.5) 0.3333333333333333)))
(+ (* 0.5 (sqrt (/ 1.0 x))) (- t_1 (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (x <= 4.5e-15) {
tmp = t_1 + (0.0 - pow(pow(y, 1.5), 0.3333333333333333));
} else {
tmp = (0.5 * sqrt((1.0 / x))) + (t_1 - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (x <= 4.5d-15) then
tmp = t_1 + (0.0d0 - ((y ** 1.5d0) ** 0.3333333333333333d0))
else
tmp = (0.5d0 * sqrt((1.0d0 / x))) + (t_1 - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (x <= 4.5e-15) {
tmp = t_1 + (0.0 - Math.pow(Math.pow(y, 1.5), 0.3333333333333333));
} else {
tmp = (0.5 * Math.sqrt((1.0 / x))) + (t_1 - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if x <= 4.5e-15: tmp = t_1 + (0.0 - math.pow(math.pow(y, 1.5), 0.3333333333333333)) else: tmp = (0.5 * math.sqrt((1.0 / x))) + (t_1 - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (x <= 4.5e-15) tmp = Float64(t_1 + Float64(0.0 - ((y ^ 1.5) ^ 0.3333333333333333))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_1 - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (x <= 4.5e-15)
tmp = t_1 + (0.0 - ((y ^ 1.5) ^ 0.3333333333333333));
else
tmp = (0.5 * sqrt((1.0 / x))) + (t_1 - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.5e-15], N[(t$95$1 + N[(0.0 - N[Power[N[Power[y, 1.5], $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{-15}:\\
\;\;\;\;t\_1 + \left(0 - {\left({y}^{1.5}\right)}^{0.3333333333333333}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_1 - \sqrt{y}\right)\\
\end{array}
\end{array}
if x < 4.4999999999999998e-15Initial program 96.3%
+-commutative96.3%
associate-+r+96.3%
associate-+r-57.6%
associate-+l-55.5%
associate-+r-51.0%
Simplified30.7%
Taylor expanded in y around inf 10.2%
neg-mul-110.2%
Simplified10.2%
add-cbrt-cube10.0%
pow1/311.5%
pow311.5%
pow1/211.5%
pow-pow11.5%
metadata-eval11.5%
Applied egg-rr11.5%
if 4.4999999999999998e-15 < x Initial program 86.3%
associate-+l+86.3%
associate-+l+86.3%
+-commutative86.3%
+-commutative86.3%
associate-+l-68.6%
+-commutative68.6%
+-commutative68.6%
Simplified68.6%
Taylor expanded in z around inf 42.8%
Taylor expanded in x around inf 41.9%
Taylor expanded in t around inf 20.9%
Final simplification16.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (sqrt (+ 1.0 y)) (- 0.0 (pow (pow y 1.5) 0.3333333333333333))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + y)) + (0.0 - pow(pow(y, 1.5), 0.3333333333333333));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((1.0d0 + y)) + (0.0d0 - ((y ** 1.5d0) ** 0.3333333333333333d0))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((1.0 + y)) + (0.0 - Math.pow(Math.pow(y, 1.5), 0.3333333333333333));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + y)) + (0.0 - math.pow(math.pow(y, 1.5), 0.3333333333333333))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + y)) + Float64(0.0 - ((y ^ 1.5) ^ 0.3333333333333333))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + y)) + (0.0 - ((y ^ 1.5) ^ 0.3333333333333333));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(0.0 - N[Power[N[Power[y, 1.5], $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + y} + \left(0 - {\left({y}^{1.5}\right)}^{0.3333333333333333}\right)
\end{array}
Initial program 91.2%
+-commutative91.2%
associate-+r+91.2%
associate-+r-70.6%
associate-+l-59.0%
associate-+r-51.4%
Simplified41.2%
Taylor expanded in y around inf 14.0%
neg-mul-114.0%
Simplified14.0%
add-cbrt-cube13.7%
pow1/315.2%
pow315.2%
pow1/215.2%
pow-pow15.2%
metadata-eval15.2%
Applied egg-rr15.2%
Final simplification15.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 / (sqrt(y) + sqrt((1.0 + y)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 / (math.sqrt(y) + math.sqrt((1.0 + y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 / (sqrt(y) + sqrt((1.0 + y)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{y} + \sqrt{1 + y}}
\end{array}
Initial program 91.2%
+-commutative91.2%
associate-+r+91.2%
associate-+r-70.6%
associate-+l-59.0%
associate-+r-51.4%
Simplified41.2%
Taylor expanded in y around inf 14.0%
neg-mul-114.0%
Simplified14.0%
sub-neg14.0%
flip--14.0%
add-sqr-sqrt14.5%
add-sqr-sqrt14.0%
Applied egg-rr14.0%
associate--l+17.2%
+-inverses17.2%
metadata-eval17.2%
Simplified17.2%
Final simplification17.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 0.015) (- 1.0 (sqrt y)) (* 0.5 (sqrt (/ 1.0 y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.015) {
tmp = 1.0 - sqrt(y);
} else {
tmp = 0.5 * sqrt((1.0 / y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 0.015d0) then
tmp = 1.0d0 - sqrt(y)
else
tmp = 0.5d0 * sqrt((1.0d0 / y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.015) {
tmp = 1.0 - Math.sqrt(y);
} else {
tmp = 0.5 * Math.sqrt((1.0 / y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.015: tmp = 1.0 - math.sqrt(y) else: tmp = 0.5 * math.sqrt((1.0 / y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.015) tmp = Float64(1.0 - sqrt(y)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 0.015)
tmp = 1.0 - sqrt(y);
else
tmp = 0.5 * sqrt((1.0 / y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 0.015], N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.015:\\
\;\;\;\;1 - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 0.014999999999999999Initial program 97.0%
+-commutative97.0%
associate-+r+97.0%
associate-+r-97.0%
associate-+l-97.0%
associate-+r-97.0%
Simplified77.1%
Taylor expanded in y around inf 24.7%
neg-mul-124.7%
Simplified24.7%
Taylor expanded in y around 0 24.7%
if 0.014999999999999999 < y Initial program 85.8%
+-commutative85.8%
associate-+r+85.8%
associate-+r-45.8%
associate-+l-23.3%
associate-+r-8.6%
Simplified7.5%
Taylor expanded in y around inf 4.0%
neg-mul-14.0%
Simplified4.0%
Taylor expanded in y around inf 9.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (- (* y 0.5) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((y * 0.5) - sqrt(y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 + ((y * 0.5d0) - sqrt(y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + ((y * 0.5) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((y * 0.5) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(y * 0.5) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((y * 0.5) - sqrt(y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(y \cdot 0.5 - \sqrt{y}\right)
\end{array}
Initial program 91.2%
+-commutative91.2%
associate-+r+91.2%
associate-+r-70.6%
associate-+l-59.0%
associate-+r-51.4%
Simplified41.2%
Taylor expanded in y around inf 14.0%
neg-mul-114.0%
Simplified14.0%
Taylor expanded in y around 0 14.6%
associate--l+14.6%
*-commutative14.6%
Simplified14.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (sqrt y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(y)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - sqrt(y);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{y}
\end{array}
Initial program 91.2%
+-commutative91.2%
associate-+r+91.2%
associate-+r-70.6%
associate-+l-59.0%
associate-+r-51.4%
Simplified41.2%
Taylor expanded in y around inf 14.0%
neg-mul-114.0%
Simplified14.0%
Taylor expanded in y around 0 12.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 91.2%
associate-+l+91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
Simplified91.2%
flip--91.5%
add-sqr-sqrt75.6%
add-sqr-sqrt92.2%
Applied egg-rr92.2%
associate--l+93.9%
+-inverses93.9%
metadata-eval93.9%
Simplified93.9%
flip--94.1%
add-sqr-sqrt76.3%
add-sqr-sqrt94.4%
Applied egg-rr94.4%
associate--l+96.1%
+-inverses96.1%
metadata-eval96.1%
Simplified96.1%
Taylor expanded in x around 0 39.1%
Taylor expanded in x around inf 1.6%
mul-1-neg1.6%
Simplified1.6%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024170
(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))))