
(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 x)) (sqrt x)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- t_2 (sqrt z)))
(t_4 (sqrt (+ y 1.0)))
(t_5 (+ t_3 (+ (- t_4 (sqrt y)) t_1))))
(if (<= t_5 0.0002)
(+
(* -0.125 (sqrt (/ 1.0 (pow x 3.0))))
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (sqrt (/ 1.0 x)))))
(if (<= t_5 2.2)
(+ (/ 1.0 (+ t_2 (sqrt z))) (+ t_1 (/ 1.0 (+ (sqrt y) t_4))))
(+
(+ 1.0 (- t_4 (+ (sqrt y) (sqrt x))))
(+ t_3 (/ 1.0 (+ (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 + x)) - sqrt(x);
double t_2 = sqrt((1.0 + z));
double t_3 = t_2 - sqrt(z);
double t_4 = sqrt((y + 1.0));
double t_5 = t_3 + ((t_4 - sqrt(y)) + t_1);
double tmp;
if (t_5 <= 0.0002) {
tmp = (-0.125 * sqrt((1.0 / pow(x, 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
} else if (t_5 <= 2.2) {
tmp = (1.0 / (t_2 + sqrt(z))) + (t_1 + (1.0 / (sqrt(y) + t_4)));
} else {
tmp = (1.0 + (t_4 - (sqrt(y) + sqrt(x)))) + (t_3 + (1.0 / (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) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + x)) - sqrt(x)
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
t_4 = sqrt((y + 1.0d0))
t_5 = t_3 + ((t_4 - sqrt(y)) + t_1)
if (t_5 <= 0.0002d0) then
tmp = ((-0.125d0) * sqrt((1.0d0 / (x ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * sqrt((1.0d0 / x))))
else if (t_5 <= 2.2d0) then
tmp = (1.0d0 / (t_2 + sqrt(z))) + (t_1 + (1.0d0 / (sqrt(y) + t_4)))
else
tmp = (1.0d0 + (t_4 - (sqrt(y) + sqrt(x)))) + (t_3 + (1.0d0 / (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 + x)) - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + z));
double t_3 = t_2 - Math.sqrt(z);
double t_4 = Math.sqrt((y + 1.0));
double t_5 = t_3 + ((t_4 - Math.sqrt(y)) + t_1);
double tmp;
if (t_5 <= 0.0002) {
tmp = (-0.125 * Math.sqrt((1.0 / Math.pow(x, 3.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * Math.sqrt((1.0 / x))));
} else if (t_5 <= 2.2) {
tmp = (1.0 / (t_2 + Math.sqrt(z))) + (t_1 + (1.0 / (Math.sqrt(y) + t_4)));
} else {
tmp = (1.0 + (t_4 - (Math.sqrt(y) + Math.sqrt(x)))) + (t_3 + (1.0 / (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 + x)) - math.sqrt(x) t_2 = math.sqrt((1.0 + z)) t_3 = t_2 - math.sqrt(z) t_4 = math.sqrt((y + 1.0)) t_5 = t_3 + ((t_4 - math.sqrt(y)) + t_1) tmp = 0 if t_5 <= 0.0002: tmp = (-0.125 * math.sqrt((1.0 / math.pow(x, 3.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (0.5 * math.sqrt((1.0 / x)))) elif t_5 <= 2.2: tmp = (1.0 / (t_2 + math.sqrt(z))) + (t_1 + (1.0 / (math.sqrt(y) + t_4))) else: tmp = (1.0 + (t_4 - (math.sqrt(y) + math.sqrt(x)))) + (t_3 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(t_2 - sqrt(z)) t_4 = sqrt(Float64(y + 1.0)) t_5 = Float64(t_3 + Float64(Float64(t_4 - sqrt(y)) + t_1)) tmp = 0.0 if (t_5 <= 0.0002) tmp = Float64(Float64(-0.125 * sqrt(Float64(1.0 / (x ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * sqrt(Float64(1.0 / x))))); elseif (t_5 <= 2.2) tmp = Float64(Float64(1.0 / Float64(t_2 + sqrt(z))) + Float64(t_1 + Float64(1.0 / Float64(sqrt(y) + t_4)))); else tmp = Float64(Float64(1.0 + Float64(t_4 - Float64(sqrt(y) + sqrt(x)))) + Float64(t_3 + Float64(1.0 / 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 + x)) - sqrt(x);
t_2 = sqrt((1.0 + z));
t_3 = t_2 - sqrt(z);
t_4 = sqrt((y + 1.0));
t_5 = t_3 + ((t_4 - sqrt(y)) + t_1);
tmp = 0.0;
if (t_5 <= 0.0002)
tmp = (-0.125 * sqrt((1.0 / (x ^ 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
elseif (t_5 <= 2.2)
tmp = (1.0 / (t_2 + sqrt(z))) + (t_1 + (1.0 / (sqrt(y) + t_4)));
else
tmp = (1.0 + (t_4 - (sqrt(y) + sqrt(x)))) + (t_3 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 + N[(N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 0.0002], N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2.2], N[(N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$4 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x} - \sqrt{x}\\
t_2 := \sqrt{1 + z}\\
t_3 := t\_2 - \sqrt{z}\\
t_4 := \sqrt{y + 1}\\
t_5 := t\_3 + \left(\left(t\_4 - \sqrt{y}\right) + t\_1\right)\\
\mathbf{if}\;t\_5 \leq 0.0002:\\
\;\;\;\;-0.125 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\\
\mathbf{elif}\;t\_5 \leq 2.2:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{z}} + \left(t\_1 + \frac{1}{\sqrt{y} + t\_4}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(t\_4 - \left(\sqrt{y} + \sqrt{x}\right)\right)\right) + \left(t\_3 + \frac{1}{\sqrt{1 + t} + \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))) < 2.0000000000000001e-4Initial program 60.1%
associate-+l+60.1%
sub-neg60.1%
sub-neg60.1%
+-commutative60.1%
+-commutative60.1%
+-commutative60.1%
Simplified60.1%
Taylor expanded in y around inf 60.1%
Taylor expanded in t around inf 4.0%
Taylor expanded in z around inf 4.0%
Taylor expanded in x around inf 21.7%
if 2.0000000000000001e-4 < (+.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.2000000000000002Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
flip--97.8%
div-inv97.8%
add-sqr-sqrt78.2%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
associate-*r/97.8%
*-rgt-identity97.8%
associate--l+98.1%
+-inverses98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in t around inf 57.2%
flip--97.7%
div-inv97.7%
add-sqr-sqrt74.2%
add-sqr-sqrt97.8%
Applied egg-rr57.3%
associate-*r/97.8%
*-rgt-identity97.8%
associate--l+98.0%
+-inverses98.0%
metadata-eval98.0%
Simplified57.3%
if 2.2000000000000002 < (+.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 99.8%
associate-+l+99.8%
sub-neg99.8%
sub-neg99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 95.9%
associate--l+95.9%
Simplified95.9%
flip--95.9%
div-inv95.9%
add-sqr-sqrt67.1%
add-sqr-sqrt95.9%
Applied egg-rr95.9%
associate-*r/95.9%
*-rgt-identity95.9%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified96.0%
Final simplification57.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_4 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_3 0.0005)
(+
(+
(* -0.125 (sqrt (/ 1.0 (pow y 3.0))))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_2))))
(+ (- t_1 (sqrt z)) t_4))
(+ (+ t_4 (/ 1.0 (+ t_1 (sqrt z)))) (+ t_3 (- t_2 (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 + z));
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((y + 1.0)) - sqrt(y);
double t_4 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_3 <= 0.0005) {
tmp = ((-0.125 * sqrt((1.0 / pow(y, 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2)))) + ((t_1 - sqrt(z)) + t_4);
} else {
tmp = (t_4 + (1.0 / (t_1 + sqrt(z)))) + (t_3 + (t_2 - 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) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((y + 1.0d0)) - sqrt(y)
t_4 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_3 <= 0.0005d0) then
tmp = (((-0.125d0) * sqrt((1.0d0 / (y ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_2)))) + ((t_1 - sqrt(z)) + t_4)
else
tmp = (t_4 + (1.0d0 / (t_1 + sqrt(z)))) + (t_3 + (t_2 - 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 + z));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_4 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_3 <= 0.0005) {
tmp = ((-0.125 * Math.sqrt((1.0 / Math.pow(y, 3.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_2)))) + ((t_1 - Math.sqrt(z)) + t_4);
} else {
tmp = (t_4 + (1.0 / (t_1 + Math.sqrt(z)))) + (t_3 + (t_2 - 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 + z)) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((y + 1.0)) - math.sqrt(y) t_4 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_3 <= 0.0005: tmp = ((-0.125 * math.sqrt((1.0 / math.pow(y, 3.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_2)))) + ((t_1 - math.sqrt(z)) + t_4) else: tmp = (t_4 + (1.0 / (t_1 + math.sqrt(z)))) + (t_3 + (t_2 - 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 + z)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_4 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_3 <= 0.0005) tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / (y ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_2)))) + Float64(Float64(t_1 - sqrt(z)) + t_4)); else tmp = Float64(Float64(t_4 + Float64(1.0 / Float64(t_1 + sqrt(z)))) + Float64(t_3 + Float64(t_2 - 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 + z));
t_2 = sqrt((1.0 + x));
t_3 = sqrt((y + 1.0)) - sqrt(y);
t_4 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_3 <= 0.0005)
tmp = ((-0.125 * sqrt((1.0 / (y ^ 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2)))) + ((t_1 - sqrt(z)) + t_4);
else
tmp = (t_4 + (1.0 / (t_1 + sqrt(z)))) + (t_3 + (t_2 - 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 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0005], N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $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$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$4 + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(t$95$2 - N[Sqrt[x], $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}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{y + 1} - \sqrt{y}\\
t_4 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_3 \leq 0.0005:\\
\;\;\;\;\left(-0.125 \cdot \sqrt{\frac{1}{{y}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_2}\right)\right) + \left(\left(t\_1 - \sqrt{z}\right) + t\_4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_4 + \frac{1}{t\_1 + \sqrt{z}}\right) + \left(t\_3 + \left(t\_2 - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.0000000000000001e-4Initial program 86.6%
associate-+l+86.6%
sub-neg86.6%
sub-neg86.6%
+-commutative86.6%
+-commutative86.6%
+-commutative86.6%
Simplified86.6%
flip--86.8%
div-inv86.8%
add-sqr-sqrt44.2%
add-sqr-sqrt86.8%
Applied egg-rr86.8%
associate-*r/86.8%
*-rgt-identity86.8%
associate--l+89.0%
+-inverses89.0%
metadata-eval89.0%
Simplified89.0%
flip--89.3%
add-sqr-sqrt69.2%
add-sqr-sqrt89.3%
Applied egg-rr89.3%
Taylor expanded in y around inf 92.4%
if 5.0000000000000001e-4 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 98.5%
associate-+l+98.5%
sub-neg98.5%
sub-neg98.5%
+-commutative98.5%
+-commutative98.5%
+-commutative98.5%
Simplified98.5%
flip--98.5%
div-inv98.5%
add-sqr-sqrt75.0%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Final simplification95.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 x)) (sqrt x))))
(if (<= t_1 0.0002)
(+
(* -0.125 (sqrt (/ 1.0 (pow x 3.0))))
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (sqrt (/ 1.0 x)))))
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(+ (- (sqrt (+ y 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 + x)) - sqrt(x);
double tmp;
if (t_1 <= 0.0002) {
tmp = (-0.125 * sqrt((1.0 / pow(x, 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
} else {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((sqrt((y + 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 + x)) - sqrt(x)
if (t_1 <= 0.0002d0) then
tmp = ((-0.125d0) * sqrt((1.0d0 / (x ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * sqrt((1.0d0 / x))))
else
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + ((sqrt((y + 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 + x)) - Math.sqrt(x);
double tmp;
if (t_1 <= 0.0002) {
tmp = (-0.125 * Math.sqrt((1.0 / Math.pow(x, 3.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * Math.sqrt((1.0 / x))));
} else {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + ((Math.sqrt((y + 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 + x)) - math.sqrt(x) tmp = 0 if t_1 <= 0.0002: tmp = (-0.125 * math.sqrt((1.0 / math.pow(x, 3.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (0.5 * math.sqrt((1.0 / x)))) else: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) tmp = 0.0 if (t_1 <= 0.0002) tmp = Float64(Float64(-0.125 * sqrt(Float64(1.0 / (x ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * sqrt(Float64(1.0 / x))))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x)) - sqrt(x);
tmp = 0.0;
if (t_1 <= 0.0002)
tmp = (-0.125 * sqrt((1.0 / (x ^ 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
else
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((sqrt((y + 1.0)) - sqrt(y)) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0002], N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $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[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[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{1 + x} - \sqrt{x}\\
\mathbf{if}\;t\_1 \leq 0.0002:\\
\;\;\;\;-0.125 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + t\_1\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2.0000000000000001e-4Initial program 87.2%
associate-+l+87.2%
sub-neg87.2%
sub-neg87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 45.0%
Taylor expanded in t around inf 20.2%
Taylor expanded in z around inf 4.2%
Taylor expanded in x around inf 11.2%
if 2.0000000000000001e-4 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 98.6%
associate-+l+98.6%
sub-neg98.6%
sub-neg98.6%
+-commutative98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
flip--98.6%
div-inv98.6%
add-sqr-sqrt75.4%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
associate--l+99.0%
+-inverses99.0%
metadata-eval99.0%
Simplified99.0%
Final simplification56.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 (<= x 4.0)
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x)))))
(+
(* -0.125 (sqrt (/ 1.0 (pow x 3.0))))
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (sqrt (/ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.0) {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x))));
} else {
tmp = (-0.125 * sqrt((1.0 / pow(x, 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 4.0d0) then
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x))))
else
tmp = ((-0.125d0) * sqrt((1.0d0 / (x ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * sqrt((1.0d0 / x))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.0) {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x))));
} else {
tmp = (-0.125 * Math.sqrt((1.0 / Math.pow(x, 3.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * Math.sqrt((1.0 / x))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 4.0: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x)))) else: tmp = (-0.125 * math.sqrt((1.0 / math.pow(x, 3.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (0.5 * math.sqrt((1.0 / x)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 4.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x))))); else tmp = Float64(Float64(-0.125 * sqrt(Float64(1.0 / (x ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * sqrt(Float64(1.0 / x))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 4.0)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x))));
else
tmp = (-0.125 * sqrt((1.0 / (x ^ 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 4.0], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\\
\end{array}
\end{array}
if x < 4Initial program 98.6%
associate-+l+98.6%
sub-neg98.6%
sub-neg98.6%
+-commutative98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in x around 0 66.3%
associate--l+95.7%
Simplified95.7%
if 4 < x Initial program 87.4%
associate-+l+87.4%
sub-neg87.4%
sub-neg87.4%
+-commutative87.4%
+-commutative87.4%
+-commutative87.4%
Simplified87.4%
Taylor expanded in y around inf 45.1%
Taylor expanded in t around inf 20.7%
Taylor expanded in z around inf 4.3%
Taylor expanded in x around inf 11.1%
Final simplification54.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 t)) (sqrt t)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (sqrt (+ 1.0 z))))
(if (<= y 2e-57)
(+ (+ (- t_3 (sqrt z)) t_1) (- 2.0 (+ (sqrt y) (sqrt x))))
(if (<= y 2.1e+32)
(+
(/ 1.0 (+ t_3 (sqrt z)))
(+ (- t_2 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0))))))
(+
(+ (/ 1.0 (+ (sqrt x) t_2)) (/ 1.0 (+ 1.0 (sqrt y))))
(+ t_1 (* -0.5 (sqrt (/ 1.0 z)))))))))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 + x));
double t_3 = sqrt((1.0 + z));
double tmp;
if (y <= 2e-57) {
tmp = ((t_3 - sqrt(z)) + t_1) + (2.0 - (sqrt(y) + sqrt(x)));
} else if (y <= 2.1e+32) {
tmp = (1.0 / (t_3 + sqrt(z))) + ((t_2 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0)))));
} else {
tmp = ((1.0 / (sqrt(x) + t_2)) + (1.0 / (1.0 + sqrt(y)))) + (t_1 + (-0.5 * sqrt((1.0 / z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((1.0d0 + z))
if (y <= 2d-57) then
tmp = ((t_3 - sqrt(z)) + t_1) + (2.0d0 - (sqrt(y) + sqrt(x)))
else if (y <= 2.1d+32) then
tmp = (1.0d0 / (t_3 + sqrt(z))) + ((t_2 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0)))))
else
tmp = ((1.0d0 / (sqrt(x) + t_2)) + (1.0d0 / (1.0d0 + sqrt(y)))) + (t_1 + ((-0.5d0) * sqrt((1.0d0 / z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 2e-57) {
tmp = ((t_3 - Math.sqrt(z)) + t_1) + (2.0 - (Math.sqrt(y) + Math.sqrt(x)));
} else if (y <= 2.1e+32) {
tmp = (1.0 / (t_3 + Math.sqrt(z))) + ((t_2 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0)))));
} else {
tmp = ((1.0 / (Math.sqrt(x) + t_2)) + (1.0 / (1.0 + Math.sqrt(y)))) + (t_1 + (-0.5 * Math.sqrt((1.0 / z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((1.0 + z)) tmp = 0 if y <= 2e-57: tmp = ((t_3 - math.sqrt(z)) + t_1) + (2.0 - (math.sqrt(y) + math.sqrt(x))) elif y <= 2.1e+32: tmp = (1.0 / (t_3 + math.sqrt(z))) + ((t_2 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0))))) else: tmp = ((1.0 / (math.sqrt(x) + t_2)) + (1.0 / (1.0 + math.sqrt(y)))) + (t_1 + (-0.5 * math.sqrt((1.0 / z)))) 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 + x)) t_3 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 2e-57) tmp = Float64(Float64(Float64(t_3 - sqrt(z)) + t_1) + Float64(2.0 - Float64(sqrt(y) + sqrt(x)))); elseif (y <= 2.1e+32) tmp = Float64(Float64(1.0 / Float64(t_3 + sqrt(z))) + Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0)))))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(1.0 / Float64(1.0 + sqrt(y)))) + Float64(t_1 + Float64(-0.5 * sqrt(Float64(1.0 / z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
t_2 = sqrt((1.0 + x));
t_3 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 2e-57)
tmp = ((t_3 - sqrt(z)) + t_1) + (2.0 - (sqrt(y) + sqrt(x)));
elseif (y <= 2.1e+32)
tmp = (1.0 / (t_3 + sqrt(z))) + ((t_2 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0)))));
else
tmp = ((1.0 / (sqrt(x) + t_2)) + (1.0 / (1.0 + sqrt(y)))) + (t_1 + (-0.5 * sqrt((1.0 / z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := 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 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2e-57], N[(N[(N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(2.0 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e+32], N[(N[(1.0 / N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(-0.5 * N[Sqrt[N[(1.0 / 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{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 2 \cdot 10^{-57}:\\
\;\;\;\;\left(\left(t\_3 - \sqrt{z}\right) + t\_1\right) + \left(2 - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+32}:\\
\;\;\;\;\frac{1}{t\_3 + \sqrt{z}} + \left(\left(t\_2 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + t\_2} + \frac{1}{1 + \sqrt{y}}\right) + \left(t\_1 + -0.5 \cdot \sqrt{\frac{1}{z}}\right)\\
\end{array}
\end{array}
if y < 1.99999999999999991e-57Initial program 98.7%
associate-+l+98.7%
sub-neg98.7%
sub-neg98.7%
+-commutative98.7%
+-commutative98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in x around 0 54.5%
associate--l+54.5%
Simplified54.5%
Taylor expanded in y around 0 54.5%
+-commutative54.5%
Simplified54.5%
if 1.99999999999999991e-57 < y < 2.1000000000000001e32Initial program 95.3%
associate-+l+95.3%
sub-neg95.3%
sub-neg95.3%
+-commutative95.3%
+-commutative95.3%
+-commutative95.3%
Simplified95.3%
flip--96.1%
div-inv96.1%
add-sqr-sqrt87.9%
add-sqr-sqrt96.2%
Applied egg-rr96.2%
associate-*r/96.2%
*-rgt-identity96.2%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in t around inf 56.8%
flip--95.3%
div-inv95.3%
add-sqr-sqrt64.9%
add-sqr-sqrt95.3%
Applied egg-rr56.8%
associate-*r/95.3%
*-rgt-identity95.3%
associate--l+95.3%
+-inverses95.3%
metadata-eval95.3%
Simplified56.8%
if 2.1000000000000001e32 < y Initial program 86.4%
associate-+l+86.4%
sub-neg86.4%
sub-neg86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--86.4%
div-inv86.4%
add-sqr-sqrt43.1%
add-sqr-sqrt86.4%
Applied egg-rr86.4%
associate-*r/86.4%
*-rgt-identity86.4%
associate--l+88.2%
+-inverses88.2%
metadata-eval88.2%
Simplified88.2%
flip--88.5%
add-sqr-sqrt68.7%
add-sqr-sqrt88.6%
Applied egg-rr88.6%
Taylor expanded in y around 0 90.1%
Taylor expanded in z around -inf 43.4%
Final simplification50.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 x))) (t_2 (sqrt (+ 1.0 z))) (t_3 (- t_2 (sqrt z))))
(if (<= y 6e-56)
(+ (+ t_3 (- (sqrt (+ 1.0 t)) (sqrt t))) (- 2.0 (+ (sqrt y) (sqrt x))))
(if (<= y 1.9e+32)
(+
(/ 1.0 (+ t_2 (sqrt z)))
(+ (- t_1 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0))))))
(+ t_3 (+ (/ 1.0 (+ (sqrt x) t_1)) (/ 1.0 (+ 1.0 (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 + x));
double t_2 = sqrt((1.0 + z));
double t_3 = t_2 - sqrt(z);
double tmp;
if (y <= 6e-56) {
tmp = (t_3 + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(y) + sqrt(x)));
} else if (y <= 1.9e+32) {
tmp = (1.0 / (t_2 + sqrt(z))) + ((t_1 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0)))));
} else {
tmp = t_3 + ((1.0 / (sqrt(x) + t_1)) + (1.0 / (1.0 + 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((1.0d0 + x))
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
if (y <= 6d-56) then
tmp = (t_3 + (sqrt((1.0d0 + t)) - sqrt(t))) + (2.0d0 - (sqrt(y) + sqrt(x)))
else if (y <= 1.9d+32) then
tmp = (1.0d0 / (t_2 + sqrt(z))) + ((t_1 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0)))))
else
tmp = t_3 + ((1.0d0 / (sqrt(x) + t_1)) + (1.0d0 / (1.0d0 + 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 + x));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = t_2 - Math.sqrt(z);
double tmp;
if (y <= 6e-56) {
tmp = (t_3 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (2.0 - (Math.sqrt(y) + Math.sqrt(x)));
} else if (y <= 1.9e+32) {
tmp = (1.0 / (t_2 + Math.sqrt(z))) + ((t_1 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0)))));
} else {
tmp = t_3 + ((1.0 / (Math.sqrt(x) + t_1)) + (1.0 / (1.0 + 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 + x)) t_2 = math.sqrt((1.0 + z)) t_3 = t_2 - math.sqrt(z) tmp = 0 if y <= 6e-56: tmp = (t_3 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (2.0 - (math.sqrt(y) + math.sqrt(x))) elif y <= 1.9e+32: tmp = (1.0 / (t_2 + math.sqrt(z))) + ((t_1 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0))))) else: tmp = t_3 + ((1.0 / (math.sqrt(x) + t_1)) + (1.0 / (1.0 + 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 + x)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(t_2 - sqrt(z)) tmp = 0.0 if (y <= 6e-56) tmp = Float64(Float64(t_3 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(2.0 - Float64(sqrt(y) + sqrt(x)))); elseif (y <= 1.9e+32) tmp = Float64(Float64(1.0 / Float64(t_2 + sqrt(z))) + Float64(Float64(t_1 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0)))))); else tmp = Float64(t_3 + Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(1.0 / Float64(1.0 + 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 + x));
t_2 = sqrt((1.0 + z));
t_3 = t_2 - sqrt(z);
tmp = 0.0;
if (y <= 6e-56)
tmp = (t_3 + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(y) + sqrt(x)));
elseif (y <= 1.9e+32)
tmp = (1.0 / (t_2 + sqrt(z))) + ((t_1 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0)))));
else
tmp = t_3 + ((1.0 / (sqrt(x) + t_1)) + (1.0 / (1.0 + 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 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6e-56], N[(N[(t$95$3 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+32], N[(N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z}\\
t_3 := t\_2 - \sqrt{z}\\
\mathbf{if}\;y \leq 6 \cdot 10^{-56}:\\
\;\;\;\;\left(t\_3 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(2 - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+32}:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{z}} + \left(\left(t\_1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(\frac{1}{\sqrt{x} + t\_1} + \frac{1}{1 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if y < 5.99999999999999979e-56Initial program 98.7%
associate-+l+98.7%
sub-neg98.7%
sub-neg98.7%
+-commutative98.7%
+-commutative98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in x around 0 54.5%
associate--l+54.5%
Simplified54.5%
Taylor expanded in y around 0 54.5%
+-commutative54.5%
Simplified54.5%
if 5.99999999999999979e-56 < y < 1.9000000000000002e32Initial program 95.3%
associate-+l+95.3%
sub-neg95.3%
sub-neg95.3%
+-commutative95.3%
+-commutative95.3%
+-commutative95.3%
Simplified95.3%
flip--96.1%
div-inv96.1%
add-sqr-sqrt87.9%
add-sqr-sqrt96.2%
Applied egg-rr96.2%
associate-*r/96.2%
*-rgt-identity96.2%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in t around inf 56.8%
flip--95.3%
div-inv95.3%
add-sqr-sqrt64.9%
add-sqr-sqrt95.3%
Applied egg-rr56.8%
associate-*r/95.3%
*-rgt-identity95.3%
associate--l+95.3%
+-inverses95.3%
metadata-eval95.3%
Simplified56.8%
if 1.9000000000000002e32 < y Initial program 86.4%
associate-+l+86.4%
sub-neg86.4%
sub-neg86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--86.4%
div-inv86.4%
add-sqr-sqrt43.1%
add-sqr-sqrt86.4%
Applied egg-rr86.4%
associate-*r/86.4%
*-rgt-identity86.4%
associate--l+88.2%
+-inverses88.2%
metadata-eval88.2%
Simplified88.2%
flip--88.5%
add-sqr-sqrt68.7%
add-sqr-sqrt88.6%
Applied egg-rr88.6%
Taylor expanded in y around 0 90.1%
Taylor expanded in t around inf 30.2%
+-commutative30.2%
associate-+r-48.5%
Simplified48.5%
Final simplification52.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 8e-33)
(+ (+ t_2 (- (sqrt (+ 1.0 t)) (sqrt t))) (- 2.0 (+ (sqrt y) (sqrt x))))
(if (<= y 2e+32)
(+ t_2 (+ (- t_1 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0))))))
(+ t_2 (+ (/ 1.0 (+ (sqrt x) t_1)) (/ 1.0 (+ 1.0 (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 + x));
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (y <= 8e-33) {
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(y) + sqrt(x)));
} else if (y <= 2e+32) {
tmp = t_2 + ((t_1 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0)))));
} else {
tmp = t_2 + ((1.0 / (sqrt(x) + t_1)) + (1.0 / (1.0 + 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((1.0d0 + x))
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
if (y <= 8d-33) then
tmp = (t_2 + (sqrt((1.0d0 + t)) - sqrt(t))) + (2.0d0 - (sqrt(y) + sqrt(x)))
else if (y <= 2d+32) then
tmp = t_2 + ((t_1 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0)))))
else
tmp = t_2 + ((1.0d0 / (sqrt(x) + t_1)) + (1.0d0 / (1.0d0 + 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 + x));
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (y <= 8e-33) {
tmp = (t_2 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (2.0 - (Math.sqrt(y) + Math.sqrt(x)));
} else if (y <= 2e+32) {
tmp = t_2 + ((t_1 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0)))));
} else {
tmp = t_2 + ((1.0 / (Math.sqrt(x) + t_1)) + (1.0 / (1.0 + 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 + x)) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if y <= 8e-33: tmp = (t_2 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (2.0 - (math.sqrt(y) + math.sqrt(x))) elif y <= 2e+32: tmp = t_2 + ((t_1 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0))))) else: tmp = t_2 + ((1.0 / (math.sqrt(x) + t_1)) + (1.0 / (1.0 + 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 + x)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (y <= 8e-33) tmp = Float64(Float64(t_2 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(2.0 - Float64(sqrt(y) + sqrt(x)))); elseif (y <= 2e+32) tmp = Float64(t_2 + Float64(Float64(t_1 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0)))))); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(1.0 / Float64(1.0 + 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 + x));
t_2 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (y <= 8e-33)
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(y) + sqrt(x)));
elseif (y <= 2e+32)
tmp = t_2 + ((t_1 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0)))));
else
tmp = t_2 + ((1.0 / (sqrt(x) + t_1)) + (1.0 / (1.0 + 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 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 8e-33], N[(N[(t$95$2 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+32], N[(t$95$2 + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;y \leq 8 \cdot 10^{-33}:\\
\;\;\;\;\left(t\_2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(2 - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+32}:\\
\;\;\;\;t\_2 + \left(\left(t\_1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(\frac{1}{\sqrt{x} + t\_1} + \frac{1}{1 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if y < 8.0000000000000004e-33Initial program 98.5%
associate-+l+98.5%
sub-neg98.5%
sub-neg98.5%
+-commutative98.5%
+-commutative98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in x around 0 54.1%
associate--l+54.1%
Simplified54.1%
Taylor expanded in y around 0 54.1%
+-commutative54.1%
Simplified54.1%
if 8.0000000000000004e-33 < y < 2.00000000000000011e32Initial program 94.8%
associate-+l+94.8%
sub-neg94.8%
sub-neg94.8%
+-commutative94.8%
+-commutative94.8%
+-commutative94.8%
Simplified94.8%
flip--96.1%
div-inv96.1%
add-sqr-sqrt83.0%
add-sqr-sqrt96.3%
Applied egg-rr96.3%
associate-*r/96.3%
*-rgt-identity96.3%
associate--l+99.7%
+-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in t around inf 47.1%
if 2.00000000000000011e32 < y Initial program 86.4%
associate-+l+86.4%
sub-neg86.4%
sub-neg86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--86.4%
div-inv86.4%
add-sqr-sqrt43.1%
add-sqr-sqrt86.4%
Applied egg-rr86.4%
associate-*r/86.4%
*-rgt-identity86.4%
associate--l+88.2%
+-inverses88.2%
metadata-eval88.2%
Simplified88.2%
flip--88.5%
add-sqr-sqrt68.7%
add-sqr-sqrt88.6%
Applied egg-rr88.6%
Taylor expanded in y around 0 90.1%
Taylor expanded in t around inf 30.2%
+-commutative30.2%
associate-+r-48.5%
Simplified48.5%
Final simplification51.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= (- t_1 (sqrt x)) 0.0002)
(+
(* -0.125 (sqrt (/ 1.0 (pow x 3.0))))
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (sqrt (/ 1.0 x)))))
(- (+ t_1 (/ 1.0 (+ (sqrt y) (sqrt (+ y 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 + x));
double tmp;
if ((t_1 - sqrt(x)) <= 0.0002) {
tmp = (-0.125 * sqrt((1.0 / pow(x, 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
} else {
tmp = (t_1 + (1.0 / (sqrt(y) + sqrt((y + 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) :: tmp
t_1 = sqrt((1.0d0 + x))
if ((t_1 - sqrt(x)) <= 0.0002d0) then
tmp = ((-0.125d0) * sqrt((1.0d0 / (x ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * sqrt((1.0d0 / x))))
else
tmp = (t_1 + (1.0d0 / (sqrt(y) + sqrt((y + 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 + x));
double tmp;
if ((t_1 - Math.sqrt(x)) <= 0.0002) {
tmp = (-0.125 * Math.sqrt((1.0 / Math.pow(x, 3.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * Math.sqrt((1.0 / x))));
} else {
tmp = (t_1 + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 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 + x)) tmp = 0 if (t_1 - math.sqrt(x)) <= 0.0002: tmp = (-0.125 * math.sqrt((1.0 / math.pow(x, 3.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (0.5 * math.sqrt((1.0 / x)))) else: tmp = (t_1 + (1.0 / (math.sqrt(y) + math.sqrt((y + 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 + x)) tmp = 0.0 if (Float64(t_1 - sqrt(x)) <= 0.0002) tmp = Float64(Float64(-0.125 * sqrt(Float64(1.0 / (x ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * sqrt(Float64(1.0 / x))))); else tmp = Float64(Float64(t_1 + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 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 + x));
tmp = 0.0;
if ((t_1 - sqrt(x)) <= 0.0002)
tmp = (-0.125 * sqrt((1.0 / (x ^ 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
else
tmp = (t_1 + (1.0 / (sqrt(y) + sqrt((y + 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 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.0002], N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;t\_1 - \sqrt{x} \leq 0.0002:\\
\;\;\;\;-0.125 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right) - \sqrt{x}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2.0000000000000001e-4Initial program 87.2%
associate-+l+87.2%
sub-neg87.2%
sub-neg87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 45.0%
Taylor expanded in t around inf 20.2%
Taylor expanded in z around inf 4.2%
Taylor expanded in x around inf 11.2%
if 2.0000000000000001e-4 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 98.6%
associate-+l+98.6%
sub-neg98.6%
sub-neg98.6%
+-commutative98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
flip--98.6%
div-inv98.6%
add-sqr-sqrt81.2%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
associate--l+99.1%
+-inverses99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in t around inf 58.6%
Taylor expanded in z around inf 38.9%
Final simplification25.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 9.2e-32)
(+ (+ t_2 (- (sqrt (+ 1.0 t)) (sqrt t))) (- 2.0 (+ (sqrt y) (sqrt x))))
(if (<= y 2.3e+31)
(- (+ t_1 (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0))))) (sqrt x))
(+ t_2 (+ (/ 1.0 (+ (sqrt x) t_1)) (/ 1.0 (+ 1.0 (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 + x));
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (y <= 9.2e-32) {
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(y) + sqrt(x)));
} else if (y <= 2.3e+31) {
tmp = (t_1 + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) - sqrt(x);
} else {
tmp = t_2 + ((1.0 / (sqrt(x) + t_1)) + (1.0 / (1.0 + 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((1.0d0 + x))
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
if (y <= 9.2d-32) then
tmp = (t_2 + (sqrt((1.0d0 + t)) - sqrt(t))) + (2.0d0 - (sqrt(y) + sqrt(x)))
else if (y <= 2.3d+31) then
tmp = (t_1 + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0))))) - sqrt(x)
else
tmp = t_2 + ((1.0d0 / (sqrt(x) + t_1)) + (1.0d0 / (1.0d0 + 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 + x));
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (y <= 9.2e-32) {
tmp = (t_2 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (2.0 - (Math.sqrt(y) + Math.sqrt(x)));
} else if (y <= 2.3e+31) {
tmp = (t_1 + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0))))) - Math.sqrt(x);
} else {
tmp = t_2 + ((1.0 / (Math.sqrt(x) + t_1)) + (1.0 / (1.0 + 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 + x)) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if y <= 9.2e-32: tmp = (t_2 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (2.0 - (math.sqrt(y) + math.sqrt(x))) elif y <= 2.3e+31: tmp = (t_1 + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0))))) - math.sqrt(x) else: tmp = t_2 + ((1.0 / (math.sqrt(x) + t_1)) + (1.0 / (1.0 + 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 + x)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (y <= 9.2e-32) tmp = Float64(Float64(t_2 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(2.0 - Float64(sqrt(y) + sqrt(x)))); elseif (y <= 2.3e+31) tmp = Float64(Float64(t_1 + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0))))) - sqrt(x)); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(1.0 / Float64(1.0 + 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 + x));
t_2 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (y <= 9.2e-32)
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(y) + sqrt(x)));
elseif (y <= 2.3e+31)
tmp = (t_1 + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) - sqrt(x);
else
tmp = t_2 + ((1.0 / (sqrt(x) + t_1)) + (1.0 / (1.0 + 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 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 9.2e-32], N[(N[(t$95$2 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e+31], N[(N[(t$95$1 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;y \leq 9.2 \cdot 10^{-32}:\\
\;\;\;\;\left(t\_2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(2 - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+31}:\\
\;\;\;\;\left(t\_1 + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(\frac{1}{\sqrt{x} + t\_1} + \frac{1}{1 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if y < 9.2000000000000002e-32Initial program 98.5%
associate-+l+98.5%
sub-neg98.5%
sub-neg98.5%
+-commutative98.5%
+-commutative98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in x around 0 54.5%
associate--l+54.5%
Simplified54.5%
Taylor expanded in y around 0 54.5%
+-commutative54.5%
Simplified54.5%
if 9.2000000000000002e-32 < y < 2.3e31Initial program 94.6%
associate-+l+94.6%
sub-neg94.6%
sub-neg94.6%
+-commutative94.6%
+-commutative94.6%
+-commutative94.6%
Simplified94.6%
flip--95.9%
div-inv95.9%
add-sqr-sqrt82.1%
add-sqr-sqrt96.1%
Applied egg-rr96.1%
associate-*r/96.1%
*-rgt-identity96.1%
associate--l+99.7%
+-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in t around inf 48.5%
Taylor expanded in z around inf 20.8%
if 2.3e31 < y Initial program 86.4%
associate-+l+86.4%
sub-neg86.4%
sub-neg86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--86.4%
div-inv86.4%
add-sqr-sqrt43.1%
add-sqr-sqrt86.4%
Applied egg-rr86.4%
associate-*r/86.4%
*-rgt-identity86.4%
associate--l+88.2%
+-inverses88.2%
metadata-eval88.2%
Simplified88.2%
flip--88.5%
add-sqr-sqrt68.7%
add-sqr-sqrt88.6%
Applied egg-rr88.6%
Taylor expanded in y around 0 90.1%
Taylor expanded in t around inf 30.2%
+-commutative30.2%
associate-+r-48.5%
Simplified48.5%
Final simplification49.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= t 3200000.0)
(+
2.0
(-
(+ (sqrt (+ 1.0 t)) (sqrt (+ y 1.0)))
(+ (sqrt t) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ 1.0 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3200000.0) {
tmp = 2.0 + ((sqrt((1.0 + t)) + sqrt((y + 1.0))) - (sqrt(t) + (sqrt(x) + (sqrt(y) + sqrt(z)))));
} else {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 3200000.0d0) then
tmp = 2.0d0 + ((sqrt((1.0d0 + t)) + sqrt((y + 1.0d0))) - (sqrt(t) + (sqrt(x) + (sqrt(y) + sqrt(z)))))
else
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (1.0d0 + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3200000.0) {
tmp = 2.0 + ((Math.sqrt((1.0 + t)) + Math.sqrt((y + 1.0))) - (Math.sqrt(t) + (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)))));
} else {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (1.0 + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 3200000.0: tmp = 2.0 + ((math.sqrt((1.0 + t)) + math.sqrt((y + 1.0))) - (math.sqrt(t) + (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))))) else: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (1.0 + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 3200000.0) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + t)) + sqrt(Float64(y + 1.0))) - Float64(sqrt(t) + Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))))); else tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(1.0 + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= 3200000.0)
tmp = 2.0 + ((sqrt((1.0 + t)) + sqrt((y + 1.0))) - (sqrt(t) + (sqrt(x) + (sqrt(y) + sqrt(z)))));
else
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, 3200000.0], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3200000:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + t} + \sqrt{y + 1}\right) - \left(\sqrt{t} + \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{1 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if t < 3.2e6Initial program 98.8%
associate-+l+98.8%
sub-neg98.8%
sub-neg98.8%
+-commutative98.8%
+-commutative98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in x around 0 43.2%
associate--l+50.4%
Simplified50.4%
Taylor expanded in z around 0 13.7%
associate--l+22.6%
Simplified22.6%
if 3.2e6 < t Initial program 87.3%
associate-+l+87.3%
sub-neg87.3%
sub-neg87.3%
+-commutative87.3%
+-commutative87.3%
+-commutative87.3%
Simplified87.3%
flip--87.5%
div-inv87.5%
add-sqr-sqrt72.0%
add-sqr-sqrt87.5%
Applied egg-rr87.5%
associate-*r/87.5%
*-rgt-identity87.5%
associate--l+89.4%
+-inverses89.4%
metadata-eval89.4%
Simplified89.4%
flip--89.4%
add-sqr-sqrt73.5%
add-sqr-sqrt89.5%
Applied egg-rr89.5%
Taylor expanded in y around 0 89.3%
Taylor expanded in t around inf 49.4%
+-commutative49.4%
associate-+r-87.6%
Simplified87.6%
Final simplification54.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 x))))
(if (<= (- t_1 (sqrt x)) 1e-7)
(* 0.5 (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 x))))
(- (+ t_1 (/ 1.0 (+ (sqrt y) (sqrt (+ y 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 + x));
double tmp;
if ((t_1 - sqrt(x)) <= 1e-7) {
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
} else {
tmp = (t_1 + (1.0 / (sqrt(y) + sqrt((y + 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) :: tmp
t_1 = sqrt((1.0d0 + x))
if ((t_1 - sqrt(x)) <= 1d-7) then
tmp = 0.5d0 * (sqrt((1.0d0 / y)) + sqrt((1.0d0 / x)))
else
tmp = (t_1 + (1.0d0 / (sqrt(y) + sqrt((y + 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 + x));
double tmp;
if ((t_1 - Math.sqrt(x)) <= 1e-7) {
tmp = 0.5 * (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / x)));
} else {
tmp = (t_1 + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 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 + x)) tmp = 0 if (t_1 - math.sqrt(x)) <= 1e-7: tmp = 0.5 * (math.sqrt((1.0 / y)) + math.sqrt((1.0 / x))) else: tmp = (t_1 + (1.0 / (math.sqrt(y) + math.sqrt((y + 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 + x)) tmp = 0.0 if (Float64(t_1 - sqrt(x)) <= 1e-7) tmp = Float64(0.5 * Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / x)))); else tmp = Float64(Float64(t_1 + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 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 + x));
tmp = 0.0;
if ((t_1 - sqrt(x)) <= 1e-7)
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
else
tmp = (t_1 + (1.0 / (sqrt(y) + sqrt((y + 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 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(0.5 * N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;t\_1 - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right) - \sqrt{x}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 87.6%
associate-+l+87.6%
sub-neg87.6%
sub-neg87.6%
+-commutative87.6%
+-commutative87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in y around inf 45.3%
Taylor expanded in t around inf 20.2%
Taylor expanded in z around inf 4.0%
Taylor expanded in x around inf 11.0%
distribute-lft-out11.0%
Simplified11.0%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 98.2%
associate-+l+98.2%
sub-neg98.2%
sub-neg98.2%
+-commutative98.2%
+-commutative98.2%
+-commutative98.2%
Simplified98.2%
flip--98.2%
div-inv98.2%
add-sqr-sqrt80.7%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
*-rgt-identity98.2%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in t around inf 58.1%
Taylor expanded in z around inf 38.7%
Final simplification25.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= (- t_1 (sqrt x)) 0.005)
(* 0.5 (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 x))))
(+ t_1 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if ((t_1 - sqrt(x)) <= 0.005) {
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
} else {
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if ((t_1 - sqrt(x)) <= 0.005d0) then
tmp = 0.5d0 * (sqrt((1.0d0 / y)) + sqrt((1.0d0 / x)))
else
tmp = t_1 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if ((t_1 - Math.sqrt(x)) <= 0.005) {
tmp = 0.5 * (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / x)));
} else {
tmp = t_1 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if (t_1 - math.sqrt(x)) <= 0.005: tmp = 0.5 * (math.sqrt((1.0 / y)) + math.sqrt((1.0 / x))) else: tmp = t_1 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(t_1 - sqrt(x)) <= 0.005) tmp = Float64(0.5 * Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / x)))); else tmp = Float64(t_1 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if ((t_1 - sqrt(x)) <= 0.005)
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
else
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.005], N[(0.5 * N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;t\_1 - \sqrt{x} \leq 0.005:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0050000000000000001Initial program 87.2%
associate-+l+87.2%
sub-neg87.2%
sub-neg87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 45.0%
Taylor expanded in t around inf 20.2%
Taylor expanded in z around inf 4.2%
Taylor expanded in x around inf 11.2%
distribute-lft-out11.2%
Simplified11.2%
if 0.0050000000000000001 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 98.6%
associate-+l+98.6%
sub-neg98.6%
sub-neg98.6%
+-commutative98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in t around inf 21.2%
associate--l+40.2%
Simplified40.2%
Taylor expanded in z around inf 24.5%
associate--l+38.3%
+-commutative38.3%
Simplified38.3%
Final simplification25.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 (<= x 3.95)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x)))))
(+
(* -0.125 (sqrt (/ 1.0 (pow x 3.0))))
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (sqrt (/ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.95) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x))));
} else {
tmp = (-0.125 * sqrt((1.0 / pow(x, 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 3.95d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x))))
else
tmp = ((-0.125d0) * sqrt((1.0d0 / (x ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * sqrt((1.0d0 / x))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.95) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x))));
} else {
tmp = (-0.125 * Math.sqrt((1.0 / Math.pow(x, 3.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * Math.sqrt((1.0 / x))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 3.95: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x)))) else: tmp = (-0.125 * math.sqrt((1.0 / math.pow(x, 3.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (0.5 * math.sqrt((1.0 / x)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 3.95) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x))))); else tmp = Float64(Float64(-0.125 * sqrt(Float64(1.0 / (x ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * sqrt(Float64(1.0 / x))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 3.95)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x))));
else
tmp = (-0.125 * sqrt((1.0 / (x ^ 3.0)))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 3.95], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.95:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\\
\end{array}
\end{array}
if x < 3.9500000000000002Initial program 98.6%
associate-+l+98.6%
sub-neg98.6%
sub-neg98.6%
+-commutative98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in x around 0 66.3%
associate--l+95.7%
Simplified95.7%
Taylor expanded in t around inf 57.0%
if 3.9500000000000002 < x Initial program 87.4%
associate-+l+87.4%
sub-neg87.4%
sub-neg87.4%
+-commutative87.4%
+-commutative87.4%
+-commutative87.4%
Simplified87.4%
Taylor expanded in y around inf 45.1%
Taylor expanded in t around inf 20.7%
Taylor expanded in z around inf 4.3%
Taylor expanded in x around inf 11.1%
Final simplification34.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0))))
(if (<= z 1.4e+16)
(+ 1.0 (- (+ (sqrt (+ 1.0 z)) t_1) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(- (+ (sqrt (+ 1.0 x)) (/ 1.0 (+ (sqrt y) t_1))) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double tmp;
if (z <= 1.4e+16) {
tmp = 1.0 + ((sqrt((1.0 + z)) + t_1) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = (sqrt((1.0 + x)) + (1.0 / (sqrt(y) + t_1))) - 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) :: tmp
t_1 = sqrt((y + 1.0d0))
if (z <= 1.4d+16) then
tmp = 1.0d0 + ((sqrt((1.0d0 + z)) + t_1) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = (sqrt((1.0d0 + x)) + (1.0d0 / (sqrt(y) + t_1))) - 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((y + 1.0));
double tmp;
if (z <= 1.4e+16) {
tmp = 1.0 + ((Math.sqrt((1.0 + z)) + t_1) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = (Math.sqrt((1.0 + x)) + (1.0 / (Math.sqrt(y) + t_1))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 1.4e+16: tmp = 1.0 + ((math.sqrt((1.0 + z)) + t_1) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = (math.sqrt((1.0 + x)) + (1.0 / (math.sqrt(y) + t_1))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 1.4e+16) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + t_1) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(Float64(sqrt(Float64(1.0 + x)) + Float64(1.0 / Float64(sqrt(y) + t_1))) - 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((y + 1.0));
tmp = 0.0;
if (z <= 1.4e+16)
tmp = 1.0 + ((sqrt((1.0 + z)) + t_1) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = (sqrt((1.0 + x)) + (1.0 / (sqrt(y) + t_1))) - 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[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.4e+16], N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
\mathbf{if}\;z \leq 1.4 \cdot 10^{+16}:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + z} + t\_1\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + x} + \frac{1}{\sqrt{y} + t\_1}\right) - \sqrt{x}\\
\end{array}
\end{array}
if z < 1.4e16Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in t around inf 24.1%
associate--l+27.2%
Simplified27.2%
Taylor expanded in x around 0 29.2%
if 1.4e16 < z Initial program 89.2%
associate-+l+89.2%
sub-neg89.2%
sub-neg89.2%
+-commutative89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
flip--89.2%
div-inv89.2%
add-sqr-sqrt71.9%
add-sqr-sqrt89.2%
Applied egg-rr89.2%
associate-*r/89.2%
*-rgt-identity89.2%
associate--l+90.7%
+-inverses90.7%
metadata-eval90.7%
Simplified90.7%
Taylor expanded in t around inf 45.3%
Taylor expanded in z around inf 31.6%
Final simplification30.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 38.0) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (+ 1.0 (- (* 0.5 x) (sqrt x)))) (* 0.5 (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 38.0) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + ((0.5 * x) - sqrt(x)));
} else {
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 38.0d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 + ((0.5d0 * x) - sqrt(x)))
else
tmp = 0.5d0 * (sqrt((1.0d0 / y)) + sqrt((1.0d0 / x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 38.0) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 + ((0.5 * x) - Math.sqrt(x)));
} else {
tmp = 0.5 * (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 38.0: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 + ((0.5 * x) - math.sqrt(x))) else: tmp = 0.5 * (math.sqrt((1.0 / y)) + math.sqrt((1.0 / x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 38.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 + Float64(Float64(0.5 * x) - sqrt(x)))); else tmp = Float64(0.5 * Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 38.0)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + ((0.5 * x) - sqrt(x)));
else
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 38.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(0.5 * x), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 38:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(1 + \left(0.5 \cdot x - \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{x}}\right)\\
\end{array}
\end{array}
if x < 38Initial program 98.6%
associate-+l+98.6%
sub-neg98.6%
sub-neg98.6%
+-commutative98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in y around inf 43.0%
Taylor expanded in t around inf 27.5%
Taylor expanded in x around 0 27.1%
associate--l+27.1%
distribute-lft-out27.1%
Simplified27.1%
Taylor expanded in x around inf 34.1%
*-commutative34.1%
Simplified34.1%
if 38 < x Initial program 87.3%
associate-+l+87.3%
sub-neg87.3%
sub-neg87.3%
+-commutative87.3%
+-commutative87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in y around inf 45.4%
Taylor expanded in t around inf 20.8%
Taylor expanded in z around inf 4.3%
Taylor expanded in x around inf 11.2%
distribute-lft-out11.2%
Simplified11.2%
Final simplification22.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 17000000.0) (- (hypot 1.0 (sqrt x)) (sqrt x)) (* 0.5 (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 17000000.0) {
tmp = hypot(1.0, sqrt(x)) - sqrt(x);
} else {
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 17000000.0) {
tmp = Math.hypot(1.0, Math.sqrt(x)) - Math.sqrt(x);
} else {
tmp = 0.5 * (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 17000000.0: tmp = math.hypot(1.0, math.sqrt(x)) - math.sqrt(x) else: tmp = 0.5 * (math.sqrt((1.0 / y)) + math.sqrt((1.0 / x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 17000000.0) tmp = Float64(hypot(1.0, sqrt(x)) - sqrt(x)); else tmp = Float64(0.5 * Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 17000000.0)
tmp = hypot(1.0, sqrt(x)) - sqrt(x);
else
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 17000000.0], N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[x], $MachinePrecision] ^ 2], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 17000000:\\
\;\;\;\;\mathsf{hypot}\left(1, \sqrt{x}\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{x}}\right)\\
\end{array}
\end{array}
if x < 1.7e7Initial program 98.5%
associate-+l+98.5%
sub-neg98.5%
sub-neg98.5%
+-commutative98.5%
+-commutative98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in t around inf 21.0%
associate--l+40.0%
Simplified40.0%
Taylor expanded in x around inf 26.9%
neg-mul-126.9%
Simplified26.9%
add-sqr-sqrt26.9%
hypot-1-def26.9%
Applied egg-rr26.9%
if 1.7e7 < x Initial program 87.2%
associate-+l+87.2%
sub-neg87.2%
sub-neg87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 45.4%
Taylor expanded in t around inf 20.3%
Taylor expanded in z around inf 4.2%
Taylor expanded in x around inf 11.2%
distribute-lft-out11.2%
Simplified11.2%
Final simplification19.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 (<= x 17000000.0) (- (sqrt (+ 1.0 x)) (sqrt x)) (* 0.5 (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 17000000.0) {
tmp = sqrt((1.0 + x)) - sqrt(x);
} else {
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 17000000.0d0) then
tmp = sqrt((1.0d0 + x)) - sqrt(x)
else
tmp = 0.5d0 * (sqrt((1.0d0 / y)) + sqrt((1.0d0 / x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 17000000.0) {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
} else {
tmp = 0.5 * (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 17000000.0: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) else: tmp = 0.5 * (math.sqrt((1.0 / y)) + math.sqrt((1.0 / x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 17000000.0) tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); else tmp = Float64(0.5 * Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 17000000.0)
tmp = sqrt((1.0 + x)) - sqrt(x);
else
tmp = 0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 17000000.0], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 17000000:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{x}}\right)\\
\end{array}
\end{array}
if x < 1.7e7Initial program 98.5%
associate-+l+98.5%
sub-neg98.5%
sub-neg98.5%
+-commutative98.5%
+-commutative98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in t around inf 21.0%
associate--l+40.0%
Simplified40.0%
Taylor expanded in x around inf 26.9%
neg-mul-126.9%
Simplified26.9%
unsub-neg26.9%
+-commutative26.9%
Applied egg-rr26.9%
if 1.7e7 < x Initial program 87.2%
associate-+l+87.2%
sub-neg87.2%
sub-neg87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 45.4%
Taylor expanded in t around inf 20.3%
Taylor expanded in z around inf 4.2%
Taylor expanded in x around inf 11.2%
distribute-lft-out11.2%
Simplified11.2%
Final simplification19.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ 1.0 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + x)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((1.0d0 + x)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + x)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + x} - \sqrt{x}
\end{array}
Initial program 93.1%
associate-+l+93.1%
sub-neg93.1%
sub-neg93.1%
+-commutative93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in t around inf 13.1%
associate--l+23.6%
Simplified23.6%
Taylor expanded in x around inf 15.6%
neg-mul-115.6%
Simplified15.6%
unsub-neg15.6%
+-commutative15.6%
Applied egg-rr15.6%
Final simplification15.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 (* x (+ 0.5 (* x (- (* x 0.0625) 0.125))))) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - 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 = (1.0d0 + (x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0))))) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.0625) - 0.125))))) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - 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[(1.0 + N[(x * N[(0.5 + N[(x * N[(N[(x * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right)\right) - \sqrt{x}
\end{array}
Initial program 93.1%
associate-+l+93.1%
sub-neg93.1%
sub-neg93.1%
+-commutative93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in t around inf 13.1%
associate--l+23.6%
Simplified23.6%
Taylor expanded in x around inf 15.6%
neg-mul-115.6%
Simplified15.6%
Taylor expanded in x around 0 15.6%
Final simplification15.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 (* 0.5 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 + (0.5 * x)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (1.0d0 + (0.5d0 * x)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (1.0 + (0.5 * x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 + (0.5 * x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 + Float64(0.5 * x)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 + (0.5 * x)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(1.0 + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(1 + 0.5 \cdot x\right) - \sqrt{x}
\end{array}
Initial program 93.1%
associate-+l+93.1%
sub-neg93.1%
sub-neg93.1%
+-commutative93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in t around inf 13.1%
associate--l+23.6%
Simplified23.6%
Taylor expanded in x around inf 15.6%
neg-mul-115.6%
Simplified15.6%
Taylor expanded in x around 0 16.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 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 = 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 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 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[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Initial program 93.1%
associate-+l+93.1%
sub-neg93.1%
sub-neg93.1%
+-commutative93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in t around inf 13.1%
associate--l+23.6%
Simplified23.6%
Taylor expanded in x around inf 15.6%
neg-mul-115.6%
Simplified15.6%
Taylor expanded in x around 0 14.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt 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 93.1%
associate-+l+93.1%
sub-neg93.1%
sub-neg93.1%
+-commutative93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in t around inf 13.1%
associate--l+23.6%
Simplified23.6%
Taylor expanded in x around inf 15.6%
neg-mul-115.6%
Simplified15.6%
Taylor expanded in x around 0 14.1%
Taylor expanded in x around inf 1.6%
neg-mul-11.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))))