
(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 24 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 (+ y 1.0)) (sqrt y))) (t_2 (sqrt (+ 1.0 t))))
(if (<= t_1 0.9999999)
(+
(+
(+ t_1 (sqrt (pow (+ (sqrt (+ 1.0 x)) (sqrt x)) -2.0)))
(* 0.5 (sqrt (/ 1.0 z))))
(- t_2 (sqrt t)))
(+
(+ (- (- 2.0 (sqrt x)) (sqrt y)) (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))))
(/ 1.0 (+ t_2 (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + t));
double tmp;
if (t_1 <= 0.9999999) {
tmp = ((t_1 + sqrt(pow((sqrt((1.0 + x)) + sqrt(x)), -2.0))) + (0.5 * sqrt((1.0 / z)))) + (t_2 - sqrt(t));
} else {
tmp = (((2.0 - sqrt(x)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) + (1.0 / (t_2 + sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + t))
if (t_1 <= 0.9999999d0) then
tmp = ((t_1 + sqrt(((sqrt((1.0d0 + x)) + sqrt(x)) ** (-2.0d0)))) + (0.5d0 * sqrt((1.0d0 / z)))) + (t_2 - sqrt(t))
else
tmp = (((2.0d0 - sqrt(x)) - sqrt(y)) + (1.0d0 / (sqrt(z) + sqrt((1.0d0 + z))))) + (1.0d0 / (t_2 + sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + t));
double tmp;
if (t_1 <= 0.9999999) {
tmp = ((t_1 + Math.sqrt(Math.pow((Math.sqrt((1.0 + x)) + Math.sqrt(x)), -2.0))) + (0.5 * Math.sqrt((1.0 / z)))) + (t_2 - Math.sqrt(t));
} else {
tmp = (((2.0 - Math.sqrt(x)) - Math.sqrt(y)) + (1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z))))) + (1.0 / (t_2 + Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + t)) tmp = 0 if t_1 <= 0.9999999: tmp = ((t_1 + math.sqrt(math.pow((math.sqrt((1.0 + x)) + math.sqrt(x)), -2.0))) + (0.5 * math.sqrt((1.0 / z)))) + (t_2 - math.sqrt(t)) else: tmp = (((2.0 - math.sqrt(x)) - math.sqrt(y)) + (1.0 / (math.sqrt(z) + math.sqrt((1.0 + z))))) + (1.0 / (t_2 + math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_1 <= 0.9999999) tmp = Float64(Float64(Float64(t_1 + sqrt((Float64(sqrt(Float64(1.0 + x)) + sqrt(x)) ^ -2.0))) + Float64(0.5 * sqrt(Float64(1.0 / z)))) + Float64(t_2 - sqrt(t))); else tmp = Float64(Float64(Float64(Float64(2.0 - sqrt(x)) - sqrt(y)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z))))) + Float64(1.0 / Float64(t_2 + sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + t));
tmp = 0.0;
if (t_1 <= 0.9999999)
tmp = ((t_1 + sqrt(((sqrt((1.0 + x)) + sqrt(x)) ^ -2.0))) + (0.5 * sqrt((1.0 / z)))) + (t_2 - sqrt(t));
else
tmp = (((2.0 - sqrt(x)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) + (1.0 / (t_2 + sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 0.9999999], N[(N[(N[(t$95$1 + N[Sqrt[N[Power[N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + t}\\
\mathbf{if}\;t\_1 \leq 0.9999999:\\
\;\;\;\;\left(\left(t\_1 + \sqrt{{\left(\sqrt{1 + x} + \sqrt{x}\right)}^{-2}}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\right) + \left(t\_2 - \sqrt{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right) + \frac{1}{\sqrt{z} + \sqrt{1 + z}}\right) + \frac{1}{t\_2 + \sqrt{t}}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 0.999999900000000053Initial program 87.2%
flip--87.3%
add-sqr-sqrt65.8%
+-commutative65.8%
add-sqr-sqrt87.3%
+-commutative87.3%
Applied egg-rr87.3%
associate--l+90.8%
+-inverses90.8%
metadata-eval90.8%
Simplified90.8%
add-sqr-sqrt90.8%
sqrt-unprod90.8%
inv-pow90.8%
inv-pow90.8%
pow-prod-up90.8%
metadata-eval90.8%
Applied egg-rr90.8%
Taylor expanded in z around inf 49.9%
if 0.999999900000000053 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.5%
Taylor expanded in x around 0 47.6%
flip--47.9%
add-sqr-sqrt36.3%
add-sqr-sqrt47.9%
Applied egg-rr47.9%
+-commutative47.9%
associate--l+48.1%
+-inverses48.1%
metadata-eval48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in y around 0 48.1%
associate--r+48.1%
Simplified48.1%
flip--48.1%
add-sqr-sqrt35.4%
+-commutative35.4%
add-sqr-sqrt48.4%
+-commutative48.4%
Applied egg-rr48.4%
associate--l+48.5%
+-inverses48.5%
metadata-eval48.5%
+-commutative48.5%
Simplified48.5%
Final simplification49.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 (+ y 1.0)) (sqrt y))) (t_2 (sqrt (+ 1.0 x))))
(if (<= (+ t_1 (- t_2 (sqrt x))) 0.999999995)
(/ 1.0 (+ t_2 (sqrt x)))
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) (+ t_1 (- 1.0 (sqrt x))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + x));
double tmp;
if ((t_1 + (t_2 - sqrt(x))) <= 0.999999995) {
tmp = 1.0 / (t_2 + sqrt(x));
} else {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (t_1 + (1.0 - sqrt(x))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + x))
if ((t_1 + (t_2 - sqrt(x))) <= 0.999999995d0) then
tmp = 1.0d0 / (t_2 + sqrt(x))
else
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (t_1 + (1.0d0 - sqrt(x))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if ((t_1 + (t_2 - Math.sqrt(x))) <= 0.999999995) {
tmp = 1.0 / (t_2 + Math.sqrt(x));
} else {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (t_1 + (1.0 - Math.sqrt(x))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + x)) tmp = 0 if (t_1 + (t_2 - math.sqrt(x))) <= 0.999999995: tmp = 1.0 / (t_2 + math.sqrt(x)) else: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (t_1 + (1.0 - math.sqrt(x)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(t_1 + Float64(t_2 - sqrt(x))) <= 0.999999995) tmp = Float64(1.0 / Float64(t_2 + sqrt(x))); else tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(t_1 + Float64(1.0 - sqrt(x))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if ((t_1 + (t_2 - sqrt(x))) <= 0.999999995)
tmp = 1.0 / (t_2 + sqrt(x));
else
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (t_1 + (1.0 - sqrt(x))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 + N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.999999995], N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;t\_1 + \left(t\_2 - \sqrt{x}\right) \leq 0.999999995:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(t\_1 + \left(1 - \sqrt{x}\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 0.99999999500000003Initial program 80.5%
+-commutative80.5%
associate-+r+80.5%
associate-+r-75.9%
associate-+l-31.1%
associate-+r-9.9%
Simplified9.1%
Taylor expanded in t around inf 3.2%
associate--l+6.2%
+-commutative6.2%
+-commutative6.2%
+-commutative6.2%
associate-+l+6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 5.1%
mul-1-neg5.1%
Simplified5.1%
flip-+5.1%
sqr-neg5.1%
add-sqr-sqrt5.5%
add-sqr-sqrt5.1%
div-sub5.1%
Applied egg-rr5.1%
div-sub5.1%
associate--l+12.4%
+-inverses12.4%
metadata-eval12.4%
+-commutative12.4%
Simplified12.4%
if 0.99999999500000003 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) Initial program 96.9%
Taylor expanded in x around 0 60.6%
flip--36.9%
add-sqr-sqrt27.3%
+-commutative27.3%
add-sqr-sqrt37.2%
+-commutative37.2%
Applied egg-rr61.0%
associate--l+37.3%
+-inverses37.3%
metadata-eval37.3%
+-commutative37.3%
Simplified61.2%
Final simplification47.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ y 1.0)) (sqrt y))) (t_2 (sqrt (+ 1.0 t))))
(if (<= t_1 0.9999999)
(+
(- t_2 (sqrt t))
(+
(* 0.5 (sqrt (/ 1.0 z)))
(+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))
(+
(+ (- (- 2.0 (sqrt x)) (sqrt y)) (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))))
(/ 1.0 (+ t_2 (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + t));
double tmp;
if (t_1 <= 0.9999999) {
tmp = (t_2 - sqrt(t)) + ((0.5 * sqrt((1.0 / z))) + (t_1 + (1.0 / (sqrt((1.0 + x)) + sqrt(x)))));
} else {
tmp = (((2.0 - sqrt(x)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) + (1.0 / (t_2 + sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + t))
if (t_1 <= 0.9999999d0) then
tmp = (t_2 - sqrt(t)) + ((0.5d0 * sqrt((1.0d0 / z))) + (t_1 + (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x)))))
else
tmp = (((2.0d0 - sqrt(x)) - sqrt(y)) + (1.0d0 / (sqrt(z) + sqrt((1.0d0 + z))))) + (1.0d0 / (t_2 + sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + t));
double tmp;
if (t_1 <= 0.9999999) {
tmp = (t_2 - Math.sqrt(t)) + ((0.5 * Math.sqrt((1.0 / z))) + (t_1 + (1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x)))));
} else {
tmp = (((2.0 - Math.sqrt(x)) - Math.sqrt(y)) + (1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z))))) + (1.0 / (t_2 + Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + t)) tmp = 0 if t_1 <= 0.9999999: tmp = (t_2 - math.sqrt(t)) + ((0.5 * math.sqrt((1.0 / z))) + (t_1 + (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))))) else: tmp = (((2.0 - math.sqrt(x)) - math.sqrt(y)) + (1.0 / (math.sqrt(z) + math.sqrt((1.0 + z))))) + (1.0 / (t_2 + math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_1 <= 0.9999999) tmp = Float64(Float64(t_2 - sqrt(t)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x)))))); else tmp = Float64(Float64(Float64(Float64(2.0 - sqrt(x)) - sqrt(y)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z))))) + Float64(1.0 / Float64(t_2 + sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + t));
tmp = 0.0;
if (t_1 <= 0.9999999)
tmp = (t_2 - sqrt(t)) + ((0.5 * sqrt((1.0 / z))) + (t_1 + (1.0 / (sqrt((1.0 + x)) + sqrt(x)))));
else
tmp = (((2.0 - sqrt(x)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) + (1.0 / (t_2 + sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 0.9999999], N[(N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + t}\\
\mathbf{if}\;t\_1 \leq 0.9999999:\\
\;\;\;\;\left(t\_2 - \sqrt{t}\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_1 + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right) + \frac{1}{\sqrt{z} + \sqrt{1 + z}}\right) + \frac{1}{t\_2 + \sqrt{t}}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 0.999999900000000053Initial program 87.2%
flip--87.3%
add-sqr-sqrt65.8%
+-commutative65.8%
add-sqr-sqrt87.3%
+-commutative87.3%
Applied egg-rr87.3%
associate--l+90.8%
+-inverses90.8%
metadata-eval90.8%
Simplified90.8%
Taylor expanded in z around inf 49.9%
if 0.999999900000000053 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.5%
Taylor expanded in x around 0 47.6%
flip--47.9%
add-sqr-sqrt36.3%
add-sqr-sqrt47.9%
Applied egg-rr47.9%
+-commutative47.9%
associate--l+48.1%
+-inverses48.1%
metadata-eval48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in y around 0 48.1%
associate--r+48.1%
Simplified48.1%
flip--48.1%
add-sqr-sqrt35.4%
+-commutative35.4%
add-sqr-sqrt48.4%
+-commutative48.4%
Applied egg-rr48.4%
associate--l+48.5%
+-inverses48.5%
metadata-eval48.5%
+-commutative48.5%
Simplified48.5%
Final simplification49.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))))
(if (<= y 3e-14)
(+
(+ (- (- 2.0 (sqrt x)) (sqrt y)) (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))))
(/ 1.0 (+ t_1 (sqrt t))))
(if (<= y 3.6e+53)
(+
(- t_1 (sqrt t))
(+
(* 0.5 (sqrt (/ 1.0 z)))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- 1.0 (sqrt x)))))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t));
double tmp;
if (y <= 3e-14) {
tmp = (((2.0 - sqrt(x)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) + (1.0 / (t_1 + sqrt(t)));
} else if (y <= 3.6e+53) {
tmp = (t_1 - sqrt(t)) + ((0.5 * sqrt((1.0 / z))) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + t))
if (y <= 3d-14) then
tmp = (((2.0d0 - sqrt(x)) - sqrt(y)) + (1.0d0 / (sqrt(z) + sqrt((1.0d0 + z))))) + (1.0d0 / (t_1 + sqrt(t)))
else if (y <= 3.6d+53) then
tmp = (t_1 - sqrt(t)) + ((0.5d0 * sqrt((1.0d0 / z))) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 - sqrt(x))))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t));
double tmp;
if (y <= 3e-14) {
tmp = (((2.0 - Math.sqrt(x)) - Math.sqrt(y)) + (1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z))))) + (1.0 / (t_1 + Math.sqrt(t)));
} else if (y <= 3.6e+53) {
tmp = (t_1 - Math.sqrt(t)) + ((0.5 * Math.sqrt((1.0 / z))) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 - Math.sqrt(x))));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) tmp = 0 if y <= 3e-14: tmp = (((2.0 - math.sqrt(x)) - math.sqrt(y)) + (1.0 / (math.sqrt(z) + math.sqrt((1.0 + z))))) + (1.0 / (t_1 + math.sqrt(t))) elif y <= 3.6e+53: tmp = (t_1 - math.sqrt(t)) + ((0.5 * math.sqrt((1.0 / z))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 - math.sqrt(x)))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (y <= 3e-14) tmp = Float64(Float64(Float64(Float64(2.0 - sqrt(x)) - sqrt(y)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z))))) + Float64(1.0 / Float64(t_1 + sqrt(t)))); elseif (y <= 3.6e+53) tmp = Float64(Float64(t_1 - sqrt(t)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 - sqrt(x))))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t));
tmp = 0.0;
if (y <= 3e-14)
tmp = (((2.0 - sqrt(x)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) + (1.0 / (t_1 + sqrt(t)));
elseif (y <= 3.6e+53)
tmp = (t_1 - sqrt(t)) + ((0.5 * sqrt((1.0 / z))) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3e-14], N[(N[(N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6e+53], N[(N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t}\\
\mathbf{if}\;y \leq 3 \cdot 10^{-14}:\\
\;\;\;\;\left(\left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right) + \frac{1}{\sqrt{z} + \sqrt{1 + z}}\right) + \frac{1}{t\_1 + \sqrt{t}}\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+53}:\\
\;\;\;\;\left(t\_1 - \sqrt{t}\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.9999999999999998e-14Initial program 96.5%
Taylor expanded in x around 0 47.6%
flip--47.9%
add-sqr-sqrt36.3%
add-sqr-sqrt47.9%
Applied egg-rr47.9%
+-commutative47.9%
associate--l+48.1%
+-inverses48.1%
metadata-eval48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in y around 0 48.1%
associate--r+48.1%
Simplified48.1%
flip--48.1%
add-sqr-sqrt35.4%
+-commutative35.4%
add-sqr-sqrt48.4%
+-commutative48.4%
Applied egg-rr48.4%
associate--l+48.5%
+-inverses48.5%
metadata-eval48.5%
+-commutative48.5%
Simplified48.5%
if 2.9999999999999998e-14 < y < 3.6e53Initial program 73.2%
Taylor expanded in x around 0 37.6%
Taylor expanded in z around inf 26.2%
if 3.6e53 < y Initial program 89.3%
+-commutative89.3%
associate-+r+89.3%
associate-+r-52.1%
associate-+l-20.3%
associate-+r-3.2%
Simplified3.2%
Taylor expanded in t around inf 3.2%
associate--l+19.4%
+-commutative19.4%
+-commutative19.4%
+-commutative19.4%
associate-+l+19.4%
+-commutative19.4%
Simplified19.4%
Taylor expanded in x around inf 18.5%
mul-1-neg18.5%
Simplified18.5%
flip-+18.5%
sqr-neg18.5%
add-sqr-sqrt18.7%
add-sqr-sqrt18.5%
div-sub18.5%
Applied egg-rr18.5%
div-sub18.5%
associate--l+23.3%
+-inverses23.3%
metadata-eval23.3%
+-commutative23.3%
Simplified23.3%
Final simplification37.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 t))))
(if (<= y 3e-14)
(+
(/ 1.0 (+ t_1 (sqrt t)))
(+ (- (- 2.0 (sqrt x)) (sqrt y)) (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 1.4e+53)
(+
(- t_1 (sqrt t))
(+
(* 0.5 (sqrt (/ 1.0 z)))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- 1.0 (sqrt x)))))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t));
double tmp;
if (y <= 3e-14) {
tmp = (1.0 / (t_1 + sqrt(t))) + (((2.0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z)));
} else if (y <= 1.4e+53) {
tmp = (t_1 - sqrt(t)) + ((0.5 * sqrt((1.0 / z))) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + t))
if (y <= 3d-14) then
tmp = (1.0d0 / (t_1 + sqrt(t))) + (((2.0d0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0d0 + z)) - sqrt(z)))
else if (y <= 1.4d+53) then
tmp = (t_1 - sqrt(t)) + ((0.5d0 * sqrt((1.0d0 / z))) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 - sqrt(x))))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t));
double tmp;
if (y <= 3e-14) {
tmp = (1.0 / (t_1 + Math.sqrt(t))) + (((2.0 - Math.sqrt(x)) - Math.sqrt(y)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else if (y <= 1.4e+53) {
tmp = (t_1 - Math.sqrt(t)) + ((0.5 * Math.sqrt((1.0 / z))) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 - Math.sqrt(x))));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) tmp = 0 if y <= 3e-14: tmp = (1.0 / (t_1 + math.sqrt(t))) + (((2.0 - math.sqrt(x)) - math.sqrt(y)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) elif y <= 1.4e+53: tmp = (t_1 - math.sqrt(t)) + ((0.5 * math.sqrt((1.0 / z))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 - math.sqrt(x)))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (y <= 3e-14) tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(t))) + Float64(Float64(Float64(2.0 - sqrt(x)) - sqrt(y)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); elseif (y <= 1.4e+53) tmp = Float64(Float64(t_1 - sqrt(t)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 - sqrt(x))))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t));
tmp = 0.0;
if (y <= 3e-14)
tmp = (1.0 / (t_1 + sqrt(t))) + (((2.0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z)));
elseif (y <= 1.4e+53)
tmp = (t_1 - sqrt(t)) + ((0.5 * sqrt((1.0 / z))) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3e-14], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+53], N[(N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t}\\
\mathbf{if}\;y \leq 3 \cdot 10^{-14}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{t}} + \left(\left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+53}:\\
\;\;\;\;\left(t\_1 - \sqrt{t}\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.9999999999999998e-14Initial program 96.5%
Taylor expanded in x around 0 47.6%
flip--47.9%
add-sqr-sqrt36.3%
add-sqr-sqrt47.9%
Applied egg-rr47.9%
+-commutative47.9%
associate--l+48.1%
+-inverses48.1%
metadata-eval48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in y around 0 48.1%
associate--r+48.1%
Simplified48.1%
if 2.9999999999999998e-14 < y < 1.4e53Initial program 73.2%
Taylor expanded in x around 0 37.6%
Taylor expanded in z around inf 26.2%
if 1.4e53 < y Initial program 89.3%
+-commutative89.3%
associate-+r+89.3%
associate-+r-52.1%
associate-+l-20.3%
associate-+r-3.2%
Simplified3.2%
Taylor expanded in t around inf 3.2%
associate--l+19.4%
+-commutative19.4%
+-commutative19.4%
+-commutative19.4%
associate-+l+19.4%
+-commutative19.4%
Simplified19.4%
Taylor expanded in x around inf 18.5%
mul-1-neg18.5%
Simplified18.5%
flip-+18.5%
sqr-neg18.5%
add-sqr-sqrt18.7%
add-sqr-sqrt18.5%
div-sub18.5%
Applied egg-rr18.5%
div-sub18.5%
associate--l+23.3%
+-inverses23.3%
metadata-eval23.3%
+-commutative23.3%
Simplified23.3%
Final simplification37.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))))
(if (<= y 1.4e-14)
(+
(/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))
(+ (- (- 2.0 (sqrt x)) (sqrt y)) (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 3.7e+14)
(+
t_1
(-
(+ (* 0.5 (sqrt (/ 1.0 z))) (sqrt (+ y 1.0)))
(+ (sqrt y) (sqrt x))))
(/ 1.0 (+ 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((1.0 + x));
double tmp;
if (y <= 1.4e-14) {
tmp = (1.0 / (sqrt((1.0 + t)) + sqrt(t))) + (((2.0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z)));
} else if (y <= 3.7e+14) {
tmp = t_1 + (((0.5 * sqrt((1.0 / z))) + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x)));
} else {
tmp = 1.0 / (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((1.0d0 + x))
if (y <= 1.4d-14) then
tmp = (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))) + (((2.0d0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0d0 + z)) - sqrt(z)))
else if (y <= 3.7d+14) then
tmp = t_1 + (((0.5d0 * sqrt((1.0d0 / z))) + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x)))
else
tmp = 1.0d0 / (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((1.0 + x));
double tmp;
if (y <= 1.4e-14) {
tmp = (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))) + (((2.0 - Math.sqrt(x)) - Math.sqrt(y)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else if (y <= 3.7e+14) {
tmp = t_1 + (((0.5 * Math.sqrt((1.0 / z))) + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = 1.0 / (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((1.0 + x)) tmp = 0 if y <= 1.4e-14: tmp = (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))) + (((2.0 - math.sqrt(x)) - math.sqrt(y)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) elif y <= 3.7e+14: tmp = t_1 + (((0.5 * math.sqrt((1.0 / z))) + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x))) else: tmp = 1.0 / (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(1.0 + x)) tmp = 0.0 if (y <= 1.4e-14) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) + Float64(Float64(Float64(2.0 - sqrt(x)) - sqrt(y)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); elseif (y <= 3.7e+14) tmp = Float64(t_1 + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(1.0 / Float64(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((1.0 + x));
tmp = 0.0;
if (y <= 1.4e-14)
tmp = (1.0 / (sqrt((1.0 + t)) + sqrt(t))) + (((2.0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z)));
elseif (y <= 3.7e+14)
tmp = t_1 + (((0.5 * sqrt((1.0 / z))) + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x)));
else
tmp = 1.0 / (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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.4e-14], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.7e+14], N[(t$95$1 + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $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}\;y \leq 1.4 \cdot 10^{-14}:\\
\;\;\;\;\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \left(\left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+14}:\\
\;\;\;\;t\_1 + \left(\left(0.5 \cdot \sqrt{\frac{1}{z}} + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.4e-14Initial program 96.5%
Taylor expanded in x around 0 47.6%
flip--47.9%
add-sqr-sqrt36.3%
add-sqr-sqrt47.9%
Applied egg-rr47.9%
+-commutative47.9%
associate--l+48.1%
+-inverses48.1%
metadata-eval48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in y around 0 48.1%
associate--r+48.1%
Simplified48.1%
if 1.4e-14 < y < 3.7e14Initial program 86.0%
+-commutative86.0%
associate-+r+86.0%
associate-+r-86.0%
associate-+l-86.0%
associate-+r-86.0%
Simplified41.1%
Taylor expanded in t around inf 3.1%
associate--l+14.6%
+-commutative14.6%
+-commutative14.6%
+-commutative14.6%
associate-+l+14.6%
+-commutative14.6%
Simplified14.6%
Taylor expanded in z around inf 13.6%
if 3.7e14 < y Initial program 87.3%
+-commutative87.3%
associate-+r+87.3%
associate-+r-51.6%
associate-+l-21.5%
associate-+r-4.9%
Simplified4.4%
Taylor expanded in t around inf 3.2%
associate--l+19.1%
+-commutative19.1%
+-commutative19.1%
+-commutative19.1%
associate-+l+19.1%
+-commutative19.1%
Simplified19.1%
Taylor expanded in x around inf 18.6%
mul-1-neg18.6%
Simplified18.6%
flip-+18.6%
sqr-neg18.6%
add-sqr-sqrt18.9%
add-sqr-sqrt18.6%
div-sub18.6%
Applied egg-rr18.6%
div-sub18.6%
associate--l+23.2%
+-inverses23.2%
metadata-eval23.2%
+-commutative23.2%
Simplified23.2%
Final simplification36.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 (<= y 3e-14)
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+ (- (- 2.0 (sqrt x)) (sqrt y)) (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 2.02e+15)
(+
t_1
(-
(+ (* 0.5 (sqrt (/ 1.0 z))) (sqrt (+ y 1.0)))
(+ (sqrt y) (sqrt x))))
(/ 1.0 (+ 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((1.0 + x));
double tmp;
if (y <= 3e-14) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (((2.0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z)));
} else if (y <= 2.02e+15) {
tmp = t_1 + (((0.5 * sqrt((1.0 / z))) + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x)));
} else {
tmp = 1.0 / (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((1.0d0 + x))
if (y <= 3d-14) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + (((2.0d0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0d0 + z)) - sqrt(z)))
else if (y <= 2.02d+15) then
tmp = t_1 + (((0.5d0 * sqrt((1.0d0 / z))) + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x)))
else
tmp = 1.0d0 / (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((1.0 + x));
double tmp;
if (y <= 3e-14) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((2.0 - Math.sqrt(x)) - Math.sqrt(y)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else if (y <= 2.02e+15) {
tmp = t_1 + (((0.5 * Math.sqrt((1.0 / z))) + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = 1.0 / (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((1.0 + x)) tmp = 0 if y <= 3e-14: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (((2.0 - math.sqrt(x)) - math.sqrt(y)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) elif y <= 2.02e+15: tmp = t_1 + (((0.5 * math.sqrt((1.0 / z))) + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x))) else: tmp = 1.0 / (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(1.0 + x)) tmp = 0.0 if (y <= 3e-14) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(2.0 - sqrt(x)) - sqrt(y)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); elseif (y <= 2.02e+15) tmp = Float64(t_1 + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(1.0 / Float64(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((1.0 + x));
tmp = 0.0;
if (y <= 3e-14)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (((2.0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z)));
elseif (y <= 2.02e+15)
tmp = t_1 + (((0.5 * sqrt((1.0 / z))) + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x)));
else
tmp = 1.0 / (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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3e-14], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.02e+15], N[(t$95$1 + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $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}\;y \leq 3 \cdot 10^{-14}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 2.02 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\left(0.5 \cdot \sqrt{\frac{1}{z}} + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.9999999999999998e-14Initial program 96.5%
Taylor expanded in x around 0 47.6%
Taylor expanded in y around 0 47.6%
associate--r+48.1%
Simplified47.6%
if 2.9999999999999998e-14 < y < 2.02e15Initial program 86.0%
+-commutative86.0%
associate-+r+86.0%
associate-+r-86.0%
associate-+l-86.0%
associate-+r-86.0%
Simplified41.1%
Taylor expanded in t around inf 3.1%
associate--l+14.6%
+-commutative14.6%
+-commutative14.6%
+-commutative14.6%
associate-+l+14.6%
+-commutative14.6%
Simplified14.6%
Taylor expanded in z around inf 13.6%
if 2.02e15 < y Initial program 87.3%
+-commutative87.3%
associate-+r+87.3%
associate-+r-51.6%
associate-+l-21.5%
associate-+r-4.9%
Simplified4.4%
Taylor expanded in t around inf 3.2%
associate--l+19.1%
+-commutative19.1%
+-commutative19.1%
+-commutative19.1%
associate-+l+19.1%
+-commutative19.1%
Simplified19.1%
Taylor expanded in x around inf 18.6%
mul-1-neg18.6%
Simplified18.6%
flip-+18.6%
sqr-neg18.6%
add-sqr-sqrt18.9%
add-sqr-sqrt18.6%
div-sub18.6%
Applied egg-rr18.6%
div-sub18.6%
associate--l+23.2%
+-inverses23.2%
metadata-eval23.2%
+-commutative23.2%
Simplified23.2%
Final simplification36.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 (<= y 3e-14)
(+
(+ (- (- 2.0 (sqrt x)) (sqrt y)) (- (sqrt (+ 1.0 z)) (sqrt z)))
(* 0.5 (sqrt (/ 1.0 t))))
(if (<= y 1.05e+14)
(+
t_1
(-
(+ (* 0.5 (sqrt (/ 1.0 z))) (sqrt (+ y 1.0)))
(+ (sqrt y) (sqrt x))))
(/ 1.0 (+ 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((1.0 + x));
double tmp;
if (y <= 3e-14) {
tmp = (((2.0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z))) + (0.5 * sqrt((1.0 / t)));
} else if (y <= 1.05e+14) {
tmp = t_1 + (((0.5 * sqrt((1.0 / z))) + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x)));
} else {
tmp = 1.0 / (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((1.0d0 + x))
if (y <= 3d-14) then
tmp = (((2.0d0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0d0 + z)) - sqrt(z))) + (0.5d0 * sqrt((1.0d0 / t)))
else if (y <= 1.05d+14) then
tmp = t_1 + (((0.5d0 * sqrt((1.0d0 / z))) + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x)))
else
tmp = 1.0d0 / (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((1.0 + x));
double tmp;
if (y <= 3e-14) {
tmp = (((2.0 - Math.sqrt(x)) - Math.sqrt(y)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z))) + (0.5 * Math.sqrt((1.0 / t)));
} else if (y <= 1.05e+14) {
tmp = t_1 + (((0.5 * Math.sqrt((1.0 / z))) + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = 1.0 / (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((1.0 + x)) tmp = 0 if y <= 3e-14: tmp = (((2.0 - math.sqrt(x)) - math.sqrt(y)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) + (0.5 * math.sqrt((1.0 / t))) elif y <= 1.05e+14: tmp = t_1 + (((0.5 * math.sqrt((1.0 / z))) + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x))) else: tmp = 1.0 / (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(1.0 + x)) tmp = 0.0 if (y <= 3e-14) tmp = Float64(Float64(Float64(Float64(2.0 - sqrt(x)) - sqrt(y)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) + Float64(0.5 * sqrt(Float64(1.0 / t)))); elseif (y <= 1.05e+14) tmp = Float64(t_1 + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(1.0 / Float64(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((1.0 + x));
tmp = 0.0;
if (y <= 3e-14)
tmp = (((2.0 - sqrt(x)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z))) + (0.5 * sqrt((1.0 / t)));
elseif (y <= 1.05e+14)
tmp = t_1 + (((0.5 * sqrt((1.0 / z))) + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x)));
else
tmp = 1.0 / (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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3e-14], N[(N[(N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e+14], N[(t$95$1 + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $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}\;y \leq 3 \cdot 10^{-14}:\\
\;\;\;\;\left(\left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+14}:\\
\;\;\;\;t\_1 + \left(\left(0.5 \cdot \sqrt{\frac{1}{z}} + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.9999999999999998e-14Initial program 96.5%
Taylor expanded in x around 0 47.6%
flip--47.9%
add-sqr-sqrt36.3%
add-sqr-sqrt47.9%
Applied egg-rr47.9%
+-commutative47.9%
associate--l+48.1%
+-inverses48.1%
metadata-eval48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in y around 0 48.1%
associate--r+48.1%
Simplified48.1%
Taylor expanded in t around inf 30.4%
if 2.9999999999999998e-14 < y < 1.05e14Initial program 86.0%
+-commutative86.0%
associate-+r+86.0%
associate-+r-86.0%
associate-+l-86.0%
associate-+r-86.0%
Simplified41.1%
Taylor expanded in t around inf 3.1%
associate--l+14.6%
+-commutative14.6%
+-commutative14.6%
+-commutative14.6%
associate-+l+14.6%
+-commutative14.6%
Simplified14.6%
Taylor expanded in z around inf 13.6%
if 1.05e14 < y Initial program 87.3%
+-commutative87.3%
associate-+r+87.3%
associate-+r-51.6%
associate-+l-21.5%
associate-+r-4.9%
Simplified4.4%
Taylor expanded in t around inf 3.2%
associate--l+19.1%
+-commutative19.1%
+-commutative19.1%
+-commutative19.1%
associate-+l+19.1%
+-commutative19.1%
Simplified19.1%
Taylor expanded in x around inf 18.6%
mul-1-neg18.6%
Simplified18.6%
flip-+18.6%
sqr-neg18.6%
add-sqr-sqrt18.9%
add-sqr-sqrt18.6%
div-sub18.6%
Applied egg-rr18.6%
div-sub18.6%
associate--l+23.2%
+-inverses23.2%
metadata-eval23.2%
+-commutative23.2%
Simplified23.2%
Final simplification27.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 (+ y 1.0))) (t_2 (+ (sqrt y) (sqrt z))))
(if (<= z 6.6e-17)
(+ (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))) (- (- 3.0 (sqrt x)) t_2))
(if (<= z 14500000.0)
(+ 1.0 (+ (sqrt (+ 1.0 z)) (- t_1 (+ (sqrt x) t_2))))
(/ (fma z (+ 1.0 (- t_1 (+ (sqrt y) (sqrt x)))) (* 0.5 (sqrt z))) z)))))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 t_2 = sqrt(y) + sqrt(z);
double tmp;
if (z <= 6.6e-17) {
tmp = (1.0 / (sqrt((1.0 + t)) + sqrt(t))) + ((3.0 - sqrt(x)) - t_2);
} else if (z <= 14500000.0) {
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (sqrt(x) + t_2)));
} else {
tmp = fma(z, (1.0 + (t_1 - (sqrt(y) + sqrt(x)))), (0.5 * sqrt(z))) / z;
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = Float64(sqrt(y) + sqrt(z)) tmp = 0.0 if (z <= 6.6e-17) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) + Float64(Float64(3.0 - sqrt(x)) - t_2)); elseif (z <= 14500000.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) + Float64(t_1 - Float64(sqrt(x) + t_2)))); else tmp = Float64(fma(z, Float64(1.0 + Float64(t_1 - Float64(sqrt(y) + sqrt(x)))), Float64(0.5 * sqrt(z))) / z); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 6.6e-17], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 14500000.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(1.0 + N[(t$95$1 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{y} + \sqrt{z}\\
\mathbf{if}\;z \leq 6.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \left(\left(3 - \sqrt{x}\right) - t\_2\right)\\
\mathbf{elif}\;z \leq 14500000:\\
\;\;\;\;1 + \left(\sqrt{1 + z} + \left(t\_1 - \left(\sqrt{x} + t\_2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, 1 + \left(t\_1 - \left(\sqrt{y} + \sqrt{x}\right)\right), 0.5 \cdot \sqrt{z}\right)}{z}\\
\end{array}
\end{array}
if z < 6.60000000000000001e-17Initial program 97.9%
Taylor expanded in x around 0 39.7%
flip--39.7%
add-sqr-sqrt28.3%
add-sqr-sqrt39.7%
Applied egg-rr39.7%
+-commutative39.7%
associate--l+39.7%
+-inverses39.7%
metadata-eval39.7%
+-commutative39.7%
Simplified39.7%
Taylor expanded in y around 0 22.9%
associate--r+22.9%
Simplified22.9%
Taylor expanded in z around 0 22.9%
associate--r+22.9%
+-commutative22.9%
Simplified22.9%
if 6.60000000000000001e-17 < z < 1.45e7Initial program 94.4%
+-commutative94.4%
associate-+r+94.2%
associate-+r-80.8%
associate-+l-73.8%
associate-+r-62.1%
Simplified62.1%
Taylor expanded in t around inf 18.0%
associate--l+20.9%
+-commutative20.9%
+-commutative20.9%
+-commutative20.9%
associate-+l+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in x around 0 16.9%
+-commutative16.9%
associate-+r-19.5%
associate-+r+19.5%
+-commutative19.5%
associate-+r-22.2%
+-commutative22.2%
associate-+r+22.2%
Simplified22.2%
if 1.45e7 < z Initial program 86.3%
+-commutative86.3%
associate-+r+86.3%
associate-+r-68.7%
associate-+l-51.9%
associate-+r-51.3%
Simplified26.7%
Taylor expanded in t around inf 5.3%
associate--l+22.1%
+-commutative22.1%
+-commutative22.1%
+-commutative22.1%
associate-+l+22.1%
+-commutative22.1%
Simplified22.1%
Taylor expanded in x around 0 4.3%
+-commutative4.3%
associate-+r-30.9%
associate-+r+30.9%
+-commutative30.9%
associate-+r-20.9%
+-commutative20.9%
associate-+r+20.9%
Simplified20.9%
Taylor expanded in z around inf 21.1%
Taylor expanded in z around 0 23.8%
+-commutative23.8%
fma-define23.8%
associate--l+37.8%
Simplified37.8%
Final simplification29.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 (+ y 1.0))) (t_2 (+ (sqrt y) (sqrt z))))
(if (<= z 5.8e-17)
(+ (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))) (- (- 3.0 (sqrt x)) t_2))
(if (<= z 22000000.0)
(+ 1.0 (+ (sqrt (+ 1.0 z)) (- t_1 (+ (sqrt x) t_2))))
(+ 1.0 (- (- (+ (* 0.5 (sqrt (/ 1.0 z))) t_1) (sqrt x)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt(y) + sqrt(z);
double tmp;
if (z <= 5.8e-17) {
tmp = (1.0 / (sqrt((1.0 + t)) + sqrt(t))) + ((3.0 - sqrt(x)) - t_2);
} else if (z <= 22000000.0) {
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (sqrt(x) + t_2)));
} else {
tmp = 1.0 + ((((0.5 * sqrt((1.0 / z))) + t_1) - sqrt(x)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt(y) + sqrt(z)
if (z <= 5.8d-17) then
tmp = (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))) + ((3.0d0 - sqrt(x)) - t_2)
else if (z <= 22000000.0d0) then
tmp = 1.0d0 + (sqrt((1.0d0 + z)) + (t_1 - (sqrt(x) + t_2)))
else
tmp = 1.0d0 + ((((0.5d0 * sqrt((1.0d0 / z))) + t_1) - sqrt(x)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0));
double t_2 = Math.sqrt(y) + Math.sqrt(z);
double tmp;
if (z <= 5.8e-17) {
tmp = (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))) + ((3.0 - Math.sqrt(x)) - t_2);
} else if (z <= 22000000.0) {
tmp = 1.0 + (Math.sqrt((1.0 + z)) + (t_1 - (Math.sqrt(x) + t_2)));
} else {
tmp = 1.0 + ((((0.5 * Math.sqrt((1.0 / z))) + t_1) - Math.sqrt(x)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = math.sqrt(y) + math.sqrt(z) tmp = 0 if z <= 5.8e-17: tmp = (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))) + ((3.0 - math.sqrt(x)) - t_2) elif z <= 22000000.0: tmp = 1.0 + (math.sqrt((1.0 + z)) + (t_1 - (math.sqrt(x) + t_2))) else: tmp = 1.0 + ((((0.5 * math.sqrt((1.0 / z))) + t_1) - math.sqrt(x)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = Float64(sqrt(y) + sqrt(z)) tmp = 0.0 if (z <= 5.8e-17) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) + Float64(Float64(3.0 - sqrt(x)) - t_2)); elseif (z <= 22000000.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) + Float64(t_1 - Float64(sqrt(x) + t_2)))); else tmp = Float64(1.0 + Float64(Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + t_1) - sqrt(x)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
t_2 = sqrt(y) + sqrt(z);
tmp = 0.0;
if (z <= 5.8e-17)
tmp = (1.0 / (sqrt((1.0 + t)) + sqrt(t))) + ((3.0 - sqrt(x)) - t_2);
elseif (z <= 22000000.0)
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (sqrt(x) + t_2)));
else
tmp = 1.0 + ((((0.5 * sqrt((1.0 / z))) + t_1) - sqrt(x)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 5.8e-17], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 22000000.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{y} + \sqrt{z}\\
\mathbf{if}\;z \leq 5.8 \cdot 10^{-17}:\\
\;\;\;\;\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \left(\left(3 - \sqrt{x}\right) - t\_2\right)\\
\mathbf{elif}\;z \leq 22000000:\\
\;\;\;\;1 + \left(\sqrt{1 + z} + \left(t\_1 - \left(\sqrt{x} + t\_2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(\left(0.5 \cdot \sqrt{\frac{1}{z}} + t\_1\right) - \sqrt{x}\right) - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 5.8000000000000006e-17Initial program 97.9%
Taylor expanded in x around 0 39.7%
flip--39.7%
add-sqr-sqrt28.3%
add-sqr-sqrt39.7%
Applied egg-rr39.7%
+-commutative39.7%
associate--l+39.7%
+-inverses39.7%
metadata-eval39.7%
+-commutative39.7%
Simplified39.7%
Taylor expanded in y around 0 22.9%
associate--r+22.9%
Simplified22.9%
Taylor expanded in z around 0 22.9%
associate--r+22.9%
+-commutative22.9%
Simplified22.9%
if 5.8000000000000006e-17 < z < 2.2e7Initial program 94.4%
+-commutative94.4%
associate-+r+94.2%
associate-+r-80.8%
associate-+l-73.8%
associate-+r-62.1%
Simplified62.1%
Taylor expanded in t around inf 18.0%
associate--l+20.9%
+-commutative20.9%
+-commutative20.9%
+-commutative20.9%
associate-+l+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in x around 0 16.9%
+-commutative16.9%
associate-+r-19.5%
associate-+r+19.5%
+-commutative19.5%
associate-+r-22.2%
+-commutative22.2%
associate-+r+22.2%
Simplified22.2%
if 2.2e7 < z Initial program 86.3%
+-commutative86.3%
associate-+r+86.3%
associate-+r-68.7%
associate-+l-51.9%
associate-+r-51.3%
Simplified26.7%
Taylor expanded in t around inf 5.3%
associate--l+22.1%
+-commutative22.1%
+-commutative22.1%
+-commutative22.1%
associate-+l+22.1%
+-commutative22.1%
Simplified22.1%
Taylor expanded in x around 0 4.3%
+-commutative4.3%
associate-+r-30.9%
associate-+r+30.9%
+-commutative30.9%
associate-+r-20.9%
+-commutative20.9%
associate-+r+20.9%
Simplified20.9%
Taylor expanded in z around inf 37.5%
associate--r+37.5%
Simplified37.5%
Final simplification29.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 4.2e-28)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (+ (sqrt x) (sqrt z)))))
(if (<= y 5e+18)
(+
1.0
(- (- (+ (* 0.5 (sqrt (/ 1.0 z))) (sqrt (+ y 1.0))) (sqrt x)) (sqrt y)))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.2e-28) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
} else if (y <= 5e+18) {
tmp = 1.0 + ((((0.5 * sqrt((1.0 / z))) + sqrt((y + 1.0))) - sqrt(x)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 4.2d-28) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))))
else if (y <= 5d+18) then
tmp = 1.0d0 + ((((0.5d0 * sqrt((1.0d0 / z))) + sqrt((y + 1.0d0))) - sqrt(x)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.2e-28) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z))));
} else if (y <= 5e+18) {
tmp = 1.0 + ((((0.5 * Math.sqrt((1.0 / z))) + Math.sqrt((y + 1.0))) - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 4.2e-28: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z)))) elif y <= 5e+18: tmp = 1.0 + ((((0.5 * math.sqrt((1.0 / z))) + math.sqrt((y + 1.0))) - math.sqrt(x)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 4.2e-28) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z))))); elseif (y <= 5e+18) tmp = Float64(1.0 + Float64(Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + sqrt(Float64(y + 1.0))) - sqrt(x)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 4.2e-28)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
elseif (y <= 5e+18)
tmp = 1.0 + ((((0.5 * sqrt((1.0 / z))) + sqrt((y + 1.0))) - sqrt(x)) - sqrt(y));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 4.2e-28], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+18], N[(1.0 + N[(N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.2 \cdot 10^{-28}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+18}:\\
\;\;\;\;1 + \left(\left(\left(0.5 \cdot \sqrt{\frac{1}{z}} + \sqrt{y + 1}\right) - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 4.20000000000000013e-28Initial program 96.6%
+-commutative96.6%
associate-+r+96.6%
associate-+r-96.6%
associate-+l-96.6%
associate-+r-96.6%
Simplified77.5%
Taylor expanded in t around inf 23.8%
associate--l+27.6%
+-commutative27.6%
+-commutative27.6%
+-commutative27.6%
associate-+l+27.6%
+-commutative27.6%
Simplified27.6%
Taylor expanded in x around 0 18.6%
+-commutative18.6%
associate-+r-24.1%
associate-+r+24.1%
+-commutative24.1%
associate-+r-24.1%
+-commutative24.1%
associate-+r+24.1%
Simplified24.1%
Taylor expanded in y around 0 18.6%
associate--l+34.0%
+-commutative34.0%
associate-+l+34.0%
+-commutative34.0%
Simplified34.0%
if 4.20000000000000013e-28 < y < 5e18Initial program 89.4%
+-commutative89.4%
associate-+r+89.3%
associate-+r-89.4%
associate-+l-89.4%
associate-+r-89.7%
Simplified62.7%
Taylor expanded in t around inf 12.8%
associate--l+19.2%
+-commutative19.2%
+-commutative19.2%
+-commutative19.2%
associate-+l+19.2%
+-commutative19.2%
Simplified19.2%
Taylor expanded in x around 0 12.0%
+-commutative12.0%
associate-+r-21.5%
associate-+r+21.5%
+-commutative21.5%
associate-+r-21.5%
+-commutative21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in z around inf 20.6%
associate--r+20.6%
Simplified20.6%
if 5e18 < y Initial program 87.4%
+-commutative87.4%
associate-+r+87.4%
associate-+r-51.4%
associate-+l-21.1%
associate-+r-4.4%
Simplified3.9%
Taylor expanded in t around inf 3.2%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in x around inf 18.8%
mul-1-neg18.8%
Simplified18.8%
flip-+18.8%
sqr-neg18.8%
add-sqr-sqrt19.1%
add-sqr-sqrt18.8%
div-sub18.8%
Applied egg-rr18.8%
div-sub18.8%
associate--l+23.4%
+-inverses23.4%
metadata-eval23.4%
+-commutative23.4%
Simplified23.4%
Final simplification28.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 4.2e-28)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (+ (sqrt x) (sqrt z)))))
(if (<= y 5e+18)
(-
(+ 1.0 (+ (sqrt (+ y 1.0)) (* 0.5 (pow z -0.5))))
(+ (sqrt y) (sqrt x)))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.2e-28) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
} else if (y <= 5e+18) {
tmp = (1.0 + (sqrt((y + 1.0)) + (0.5 * pow(z, -0.5)))) - (sqrt(y) + sqrt(x));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 4.2d-28) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))))
else if (y <= 5d+18) then
tmp = (1.0d0 + (sqrt((y + 1.0d0)) + (0.5d0 * (z ** (-0.5d0))))) - (sqrt(y) + sqrt(x))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.2e-28) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z))));
} else if (y <= 5e+18) {
tmp = (1.0 + (Math.sqrt((y + 1.0)) + (0.5 * Math.pow(z, -0.5)))) - (Math.sqrt(y) + Math.sqrt(x));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 4.2e-28: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z)))) elif y <= 5e+18: tmp = (1.0 + (math.sqrt((y + 1.0)) + (0.5 * math.pow(z, -0.5)))) - (math.sqrt(y) + math.sqrt(x)) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 4.2e-28) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z))))); elseif (y <= 5e+18) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) + Float64(0.5 * (z ^ -0.5)))) - Float64(sqrt(y) + sqrt(x))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 4.2e-28)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
elseif (y <= 5e+18)
tmp = (1.0 + (sqrt((y + 1.0)) + (0.5 * (z ^ -0.5)))) - (sqrt(y) + sqrt(x));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 4.2e-28], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+18], N[(N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Power[z, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.2 \cdot 10^{-28}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+18}:\\
\;\;\;\;\left(1 + \left(\sqrt{y + 1} + 0.5 \cdot {z}^{-0.5}\right)\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 4.20000000000000013e-28Initial program 96.6%
+-commutative96.6%
associate-+r+96.6%
associate-+r-96.6%
associate-+l-96.6%
associate-+r-96.6%
Simplified77.5%
Taylor expanded in t around inf 23.8%
associate--l+27.6%
+-commutative27.6%
+-commutative27.6%
+-commutative27.6%
associate-+l+27.6%
+-commutative27.6%
Simplified27.6%
Taylor expanded in x around 0 18.6%
+-commutative18.6%
associate-+r-24.1%
associate-+r+24.1%
+-commutative24.1%
associate-+r-24.1%
+-commutative24.1%
associate-+r+24.1%
Simplified24.1%
Taylor expanded in y around 0 18.6%
associate--l+34.0%
+-commutative34.0%
associate-+l+34.0%
+-commutative34.0%
Simplified34.0%
if 4.20000000000000013e-28 < y < 5e18Initial program 89.4%
+-commutative89.4%
associate-+r+89.3%
associate-+r-89.4%
associate-+l-89.4%
associate-+r-89.7%
Simplified62.7%
Taylor expanded in t around inf 12.8%
associate--l+19.2%
+-commutative19.2%
+-commutative19.2%
+-commutative19.2%
associate-+l+19.2%
+-commutative19.2%
Simplified19.2%
Taylor expanded in x around 0 12.0%
+-commutative12.0%
associate-+r-21.5%
associate-+r+21.5%
+-commutative21.5%
associate-+r-21.5%
+-commutative21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in z around inf 20.8%
*-un-lft-identity20.8%
inv-pow20.8%
sqrt-pow120.8%
metadata-eval20.8%
Applied egg-rr20.8%
*-lft-identity20.8%
Simplified20.8%
if 5e18 < y Initial program 87.4%
+-commutative87.4%
associate-+r+87.4%
associate-+r-51.4%
associate-+l-21.1%
associate-+r-4.4%
Simplified3.9%
Taylor expanded in t around inf 3.2%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in x around inf 18.8%
mul-1-neg18.8%
Simplified18.8%
flip-+18.8%
sqr-neg18.8%
add-sqr-sqrt19.1%
add-sqr-sqrt18.8%
div-sub18.8%
Applied egg-rr18.8%
div-sub18.8%
associate--l+23.4%
+-inverses23.4%
metadata-eval23.4%
+-commutative23.4%
Simplified23.4%
Final simplification28.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))))
(if (<= y 5.1e-26)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (+ (sqrt x) (sqrt z)))))
(if (<= y 5e+18)
(- (+ t_1 (sqrt (+ y 1.0))) (+ (sqrt y) (sqrt x)))
(/ 1.0 (+ 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((1.0 + x));
double tmp;
if (y <= 5.1e-26) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
} else if (y <= 5e+18) {
tmp = (t_1 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
} else {
tmp = 1.0 / (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((1.0d0 + x))
if (y <= 5.1d-26) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))))
else if (y <= 5d+18) then
tmp = (t_1 + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x))
else
tmp = 1.0d0 / (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((1.0 + x));
double tmp;
if (y <= 5.1e-26) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z))));
} else if (y <= 5e+18) {
tmp = (t_1 + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x));
} else {
tmp = 1.0 / (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((1.0 + x)) tmp = 0 if y <= 5.1e-26: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z)))) elif y <= 5e+18: tmp = (t_1 + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x)) else: tmp = 1.0 / (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(1.0 + x)) tmp = 0.0 if (y <= 5.1e-26) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z))))); elseif (y <= 5e+18) tmp = Float64(Float64(t_1 + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x))); else tmp = Float64(1.0 / Float64(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((1.0 + x));
tmp = 0.0;
if (y <= 5.1e-26)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
elseif (y <= 5e+18)
tmp = (t_1 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
else
tmp = 1.0 / (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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 5.1e-26], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+18], N[(N[(t$95$1 + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $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}\;y \leq 5.1 \cdot 10^{-26}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+18}:\\
\;\;\;\;\left(t\_1 + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5.09999999999999991e-26Initial program 96.4%
+-commutative96.4%
associate-+r+96.4%
associate-+r-96.4%
associate-+l-96.4%
associate-+r-96.4%
Simplified77.0%
Taylor expanded in t around inf 23.6%
associate--l+27.5%
+-commutative27.5%
+-commutative27.5%
+-commutative27.5%
associate-+l+27.5%
+-commutative27.5%
Simplified27.5%
Taylor expanded in x around 0 18.5%
+-commutative18.5%
associate-+r-24.1%
associate-+r+24.1%
+-commutative24.1%
associate-+r-24.1%
+-commutative24.1%
associate-+r+24.1%
Simplified24.1%
Taylor expanded in y around 0 18.5%
associate--l+34.2%
+-commutative34.2%
associate-+l+34.2%
+-commutative34.2%
Simplified34.2%
if 5.09999999999999991e-26 < y < 5e18Initial program 91.4%
+-commutative91.4%
associate-+r+91.2%
associate-+r-91.4%
associate-+l-91.4%
associate-+r-91.8%
Simplified67.6%
Taylor expanded in t around inf 13.9%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in z around inf 19.3%
if 5e18 < y Initial program 87.4%
+-commutative87.4%
associate-+r+87.4%
associate-+r-51.4%
associate-+l-21.1%
associate-+r-4.4%
Simplified3.9%
Taylor expanded in t around inf 3.2%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in x around inf 18.8%
mul-1-neg18.8%
Simplified18.8%
flip-+18.8%
sqr-neg18.8%
add-sqr-sqrt19.1%
add-sqr-sqrt18.8%
div-sub18.8%
Applied egg-rr18.8%
div-sub18.8%
associate--l+23.4%
+-inverses23.4%
metadata-eval23.4%
+-commutative23.4%
Simplified23.4%
Final simplification29.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 5.5e-26)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (+ (sqrt x) (sqrt z)))))
(if (<= y 5e+18)
(+ t_1 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x))))
(/ 1.0 (+ 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((1.0 + x));
double tmp;
if (y <= 5.5e-26) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
} else if (y <= 5e+18) {
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
} else {
tmp = 1.0 / (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((1.0d0 + x))
if (y <= 5.5d-26) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))))
else if (y <= 5d+18) then
tmp = t_1 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
else
tmp = 1.0d0 / (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((1.0 + x));
double tmp;
if (y <= 5.5e-26) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z))));
} else if (y <= 5e+18) {
tmp = t_1 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = 1.0 / (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((1.0 + x)) tmp = 0 if y <= 5.5e-26: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z)))) elif y <= 5e+18: tmp = t_1 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = 1.0 / (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(1.0 + x)) tmp = 0.0 if (y <= 5.5e-26) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z))))); elseif (y <= 5e+18) tmp = Float64(t_1 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(1.0 / Float64(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((1.0 + x));
tmp = 0.0;
if (y <= 5.5e-26)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
elseif (y <= 5e+18)
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
else
tmp = 1.0 / (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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 5.5e-26], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+18], 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], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $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}\;y \leq 5.5 \cdot 10^{-26}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+18}:\\
\;\;\;\;t\_1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5.5000000000000005e-26Initial program 96.4%
+-commutative96.4%
associate-+r+96.4%
associate-+r-96.4%
associate-+l-96.4%
associate-+r-96.4%
Simplified77.0%
Taylor expanded in t around inf 23.6%
associate--l+27.5%
+-commutative27.5%
+-commutative27.5%
+-commutative27.5%
associate-+l+27.5%
+-commutative27.5%
Simplified27.5%
Taylor expanded in x around 0 18.5%
+-commutative18.5%
associate-+r-24.1%
associate-+r+24.1%
+-commutative24.1%
associate-+r-24.1%
+-commutative24.1%
associate-+r+24.1%
Simplified24.1%
Taylor expanded in y around 0 18.5%
associate--l+34.2%
+-commutative34.2%
associate-+l+34.2%
+-commutative34.2%
Simplified34.2%
if 5.5000000000000005e-26 < y < 5e18Initial program 91.4%
+-commutative91.4%
associate-+r+91.2%
associate-+r-91.4%
associate-+l-91.4%
associate-+r-91.8%
Simplified67.6%
Taylor expanded in t around inf 13.9%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in z around inf 19.1%
if 5e18 < y Initial program 87.4%
+-commutative87.4%
associate-+r+87.4%
associate-+r-51.4%
associate-+l-21.1%
associate-+r-4.4%
Simplified3.9%
Taylor expanded in t around inf 3.2%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in x around inf 18.8%
mul-1-neg18.8%
Simplified18.8%
flip-+18.8%
sqr-neg18.8%
add-sqr-sqrt19.1%
add-sqr-sqrt18.8%
div-sub18.8%
Applied egg-rr18.8%
div-sub18.8%
associate--l+23.4%
+-inverses23.4%
metadata-eval23.4%
+-commutative23.4%
Simplified23.4%
Final simplification29.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 5.5e-26)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (+ (sqrt x) (sqrt z)))))
(if (<= y 2e+19)
(- (+ 1.0 (sqrt (+ y 1.0))) (+ (sqrt y) (sqrt x)))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.5e-26) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
} else if (y <= 2e+19) {
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 5.5d-26) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))))
else if (y <= 2d+19) then
tmp = (1.0d0 + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.5e-26) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z))));
} else if (y <= 2e+19) {
tmp = (1.0 + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5.5e-26: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z)))) elif y <= 2e+19: tmp = (1.0 + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x)) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5.5e-26) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z))))); elseif (y <= 2e+19) tmp = Float64(Float64(1.0 + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 5.5e-26)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
elseif (y <= 2e+19)
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 5.5e-26], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+19], N[(N[(1.0 + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-26}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+19}:\\
\;\;\;\;\left(1 + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5.5000000000000005e-26Initial program 96.4%
+-commutative96.4%
associate-+r+96.4%
associate-+r-96.4%
associate-+l-96.4%
associate-+r-96.4%
Simplified77.0%
Taylor expanded in t around inf 23.6%
associate--l+27.5%
+-commutative27.5%
+-commutative27.5%
+-commutative27.5%
associate-+l+27.5%
+-commutative27.5%
Simplified27.5%
Taylor expanded in x around 0 18.5%
+-commutative18.5%
associate-+r-24.1%
associate-+r+24.1%
+-commutative24.1%
associate-+r-24.1%
+-commutative24.1%
associate-+r+24.1%
Simplified24.1%
Taylor expanded in y around 0 18.5%
associate--l+34.2%
+-commutative34.2%
associate-+l+34.2%
+-commutative34.2%
Simplified34.2%
if 5.5000000000000005e-26 < y < 2e19Initial program 91.4%
+-commutative91.4%
associate-+r+91.2%
associate-+r-91.4%
associate-+l-91.4%
associate-+r-91.8%
Simplified67.6%
Taylor expanded in t around inf 13.9%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in x around 0 13.0%
+-commutative13.0%
associate-+r-21.8%
associate-+r+21.8%
+-commutative21.8%
associate-+r-21.8%
+-commutative21.8%
associate-+r+21.8%
Simplified21.8%
Taylor expanded in z around inf 18.2%
if 2e19 < y Initial program 87.4%
+-commutative87.4%
associate-+r+87.4%
associate-+r-51.4%
associate-+l-21.1%
associate-+r-4.4%
Simplified3.9%
Taylor expanded in t around inf 3.2%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in x around inf 18.8%
mul-1-neg18.8%
Simplified18.8%
flip-+18.8%
sqr-neg18.8%
add-sqr-sqrt19.1%
add-sqr-sqrt18.8%
div-sub18.8%
Applied egg-rr18.8%
div-sub18.8%
associate--l+23.4%
+-inverses23.4%
metadata-eval23.4%
+-commutative23.4%
Simplified23.4%
Final simplification28.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 5e+18) (- (+ 1.0 (sqrt (+ y 1.0))) (+ (sqrt y) (sqrt x))) (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5e+18) {
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 5d+18) then
tmp = (1.0d0 + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5e+18) {
tmp = (1.0 + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5e+18: tmp = (1.0 + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x)) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5e+18) tmp = Float64(Float64(1.0 + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 5e+18)
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 5e+18], N[(N[(1.0 + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{+18}:\\
\;\;\;\;\left(1 + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5e18Initial program 96.1%
+-commutative96.1%
associate-+r+96.1%
associate-+r-96.1%
associate-+l-96.1%
associate-+r-96.2%
Simplified76.5%
Taylor expanded in t around inf 23.0%
associate--l+27.0%
+-commutative27.0%
+-commutative27.0%
+-commutative27.0%
associate-+l+27.0%
+-commutative27.0%
Simplified27.0%
Taylor expanded in x around 0 18.2%
+-commutative18.2%
associate-+r-24.0%
associate-+r+24.0%
+-commutative24.0%
associate-+r-24.0%
+-commutative24.0%
associate-+r+24.0%
Simplified24.0%
Taylor expanded in z around inf 20.4%
if 5e18 < y Initial program 87.4%
+-commutative87.4%
associate-+r+87.4%
associate-+r-51.4%
associate-+l-21.1%
associate-+r-4.4%
Simplified3.9%
Taylor expanded in t around inf 3.2%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in x around inf 18.8%
mul-1-neg18.8%
Simplified18.8%
flip-+18.8%
sqr-neg18.8%
add-sqr-sqrt19.1%
add-sqr-sqrt18.8%
div-sub18.8%
Applied egg-rr18.8%
div-sub18.8%
associate--l+23.4%
+-inverses23.4%
metadata-eval23.4%
+-commutative23.4%
Simplified23.4%
Final simplification21.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 5e+18) (+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x)))) (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5e+18) {
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 5d+18) then
tmp = 1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5e+18) {
tmp = 1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5e+18: tmp = 1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5e+18) tmp = Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 5e+18)
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 5e+18], N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{+18}:\\
\;\;\;\;1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5e18Initial program 96.1%
+-commutative96.1%
associate-+r+96.1%
associate-+r-96.1%
associate-+l-96.1%
associate-+r-96.2%
Simplified76.5%
Taylor expanded in t around inf 23.0%
associate--l+27.0%
+-commutative27.0%
+-commutative27.0%
+-commutative27.0%
associate-+l+27.0%
+-commutative27.0%
Simplified27.0%
Taylor expanded in x around 0 18.2%
+-commutative18.2%
associate-+r-24.0%
associate-+r+24.0%
+-commutative24.0%
associate-+r-24.0%
+-commutative24.0%
associate-+r+24.0%
Simplified24.0%
Taylor expanded in z around inf 20.4%
if 5e18 < y Initial program 87.4%
+-commutative87.4%
associate-+r+87.4%
associate-+r-51.4%
associate-+l-21.1%
associate-+r-4.4%
Simplified3.9%
Taylor expanded in t around inf 3.2%
associate--l+19.3%
+-commutative19.3%
+-commutative19.3%
+-commutative19.3%
associate-+l+19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in x around inf 18.8%
mul-1-neg18.8%
Simplified18.8%
flip-+18.8%
sqr-neg18.8%
add-sqr-sqrt19.1%
add-sqr-sqrt18.8%
div-sub18.8%
Applied egg-rr18.8%
div-sub18.8%
associate--l+23.4%
+-inverses23.4%
metadata-eval23.4%
+-commutative23.4%
Simplified23.4%
Final simplification21.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 50000000.0) (- (sqrt (+ 1.0 x)) (sqrt x)) (* 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 <= 50000000.0) {
tmp = sqrt((1.0 + x)) - sqrt(x);
} else {
tmp = 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 <= 50000000.0d0) then
tmp = sqrt((1.0d0 + x)) - sqrt(x)
else
tmp = 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 <= 50000000.0) {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
} else {
tmp = 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 <= 50000000.0: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) else: tmp = 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 <= 50000000.0) tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); else tmp = 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 <= 50000000.0)
tmp = sqrt((1.0 + x)) - sqrt(x);
else
tmp = 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, 50000000.0], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 50000000:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 5e7Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-64.9%
associate-+l-62.9%
associate-+r-59.8%
Simplified36.1%
Taylor expanded in t around inf 22.8%
associate--l+41.3%
+-commutative41.3%
+-commutative41.3%
+-commutative41.3%
associate-+l+41.3%
+-commutative41.3%
Simplified41.3%
Taylor expanded in x around inf 26.3%
mul-1-neg26.3%
Simplified26.3%
unsub-neg26.3%
Applied egg-rr26.3%
if 5e7 < x Initial program 87.4%
+-commutative87.4%
associate-+r+87.4%
associate-+r-87.4%
associate-+l-64.3%
associate-+r-53.2%
Simplified53.0%
Taylor expanded in t around inf 6.9%
associate--l+7.9%
+-commutative7.9%
+-commutative7.9%
+-commutative7.9%
associate-+l+7.9%
+-commutative7.9%
Simplified7.9%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 8.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 / (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 = 1.0d0 / (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 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 / (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(1.0 / 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 = 1.0 / (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[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{1 + x} + \sqrt{x}}
\end{array}
Initial program 92.4%
+-commutative92.4%
associate-+r+92.4%
associate-+r-76.8%
associate-+l-63.6%
associate-+r-56.4%
Simplified45.0%
Taylor expanded in t around inf 14.4%
associate--l+23.7%
+-commutative23.7%
+-commutative23.7%
+-commutative23.7%
associate-+l+23.7%
+-commutative23.7%
Simplified23.7%
Taylor expanded in x around inf 14.3%
mul-1-neg14.3%
Simplified14.3%
flip-+14.3%
sqr-neg14.3%
add-sqr-sqrt14.6%
add-sqr-sqrt14.3%
div-sub14.3%
Applied egg-rr14.3%
div-sub14.3%
associate--l+17.2%
+-inverses17.2%
metadata-eval17.2%
+-commutative17.2%
Simplified17.2%
Final simplification17.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 3.95) (- (+ 1.0 (* x (+ 0.5 (* x (- (* x 0.0625) 0.125))))) (sqrt x)) (* 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 = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
} else {
tmp = 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 = (1.0d0 + (x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0))))) - sqrt(x)
else
tmp = 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 = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - Math.sqrt(x);
} else {
tmp = 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 = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - math.sqrt(x) else: tmp = 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(1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.0625) - 0.125))))) - sqrt(x)); else tmp = 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 = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
else
tmp = 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[(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], N[(0.5 * N[Sqrt[N[(1.0 / x), $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(1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 3.9500000000000002Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-65.1%
associate-+l-63.4%
associate-+r-60.3%
Simplified36.3%
Taylor expanded in t around inf 22.9%
associate--l+41.5%
+-commutative41.5%
+-commutative41.5%
+-commutative41.5%
associate-+l+41.5%
+-commutative41.5%
Simplified41.5%
Taylor expanded in x around inf 26.4%
mul-1-neg26.4%
Simplified26.4%
Taylor expanded in x around 0 26.4%
if 3.9500000000000002 < x Initial program 87.5%
+-commutative87.5%
associate-+r+87.5%
associate-+r-87.0%
associate-+l-63.8%
associate-+r-52.9%
Simplified52.6%
Taylor expanded in t around inf 6.8%
associate--l+7.9%
+-commutative7.9%
+-commutative7.9%
+-commutative7.9%
associate-+l+7.9%
+-commutative7.9%
Simplified7.9%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.0%
Final simplification17.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.95) (- (+ 1.0 (* x (+ 0.5 (* x -0.125)))) (sqrt x)) (* 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 <= 0.95) {
tmp = (1.0 + (x * (0.5 + (x * -0.125)))) - sqrt(x);
} else {
tmp = 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 <= 0.95d0) then
tmp = (1.0d0 + (x * (0.5d0 + (x * (-0.125d0))))) - sqrt(x)
else
tmp = 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 <= 0.95) {
tmp = (1.0 + (x * (0.5 + (x * -0.125)))) - Math.sqrt(x);
} else {
tmp = 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 <= 0.95: tmp = (1.0 + (x * (0.5 + (x * -0.125)))) - math.sqrt(x) else: tmp = 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 <= 0.95) tmp = Float64(Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * -0.125)))) - sqrt(x)); else tmp = 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 <= 0.95)
tmp = (1.0 + (x * (0.5 + (x * -0.125)))) - sqrt(x);
else
tmp = 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, 0.95], N[(N[(1.0 + N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.95:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot -0.125\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.94999999999999996Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-65.1%
associate-+l-63.4%
associate-+r-60.3%
Simplified36.3%
Taylor expanded in t around inf 22.9%
associate--l+41.5%
+-commutative41.5%
+-commutative41.5%
+-commutative41.5%
associate-+l+41.5%
+-commutative41.5%
Simplified41.5%
Taylor expanded in x around inf 26.4%
mul-1-neg26.4%
Simplified26.4%
Taylor expanded in x around 0 26.4%
if 0.94999999999999996 < x Initial program 87.5%
+-commutative87.5%
associate-+r+87.5%
associate-+r-87.0%
associate-+l-63.8%
associate-+r-52.9%
Simplified52.6%
Taylor expanded in t around inf 6.8%
associate--l+7.9%
+-commutative7.9%
+-commutative7.9%
+-commutative7.9%
associate-+l+7.9%
+-commutative7.9%
Simplified7.9%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.0%
Final simplification17.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.0285) (+ 1.0 (- (* x 0.5) (sqrt x))) (* 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 <= 0.0285) {
tmp = 1.0 + ((x * 0.5) - sqrt(x));
} else {
tmp = 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 <= 0.0285d0) then
tmp = 1.0d0 + ((x * 0.5d0) - sqrt(x))
else
tmp = 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 <= 0.0285) {
tmp = 1.0 + ((x * 0.5) - Math.sqrt(x));
} else {
tmp = 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 <= 0.0285: tmp = 1.0 + ((x * 0.5) - math.sqrt(x)) else: tmp = 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 <= 0.0285) tmp = Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))); else tmp = 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 <= 0.0285)
tmp = 1.0 + ((x * 0.5) - sqrt(x));
else
tmp = 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, 0.0285], N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0285:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.028500000000000001Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-64.8%
associate-+l-63.1%
associate-+r-60.0%
Simplified35.8%
Taylor expanded in t around inf 22.3%
associate--l+41.0%
+-commutative41.0%
+-commutative41.0%
+-commutative41.0%
associate-+l+41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in x around inf 26.5%
mul-1-neg26.5%
Simplified26.5%
Taylor expanded in x around 0 26.5%
associate--l+26.5%
*-commutative26.5%
Simplified26.5%
if 0.028500000000000001 < x Initial program 87.6%
+-commutative87.6%
associate-+r+87.5%
associate-+r-87.1%
associate-+l-64.1%
associate-+r-53.2%
Simplified53.0%
Taylor expanded in t around inf 7.5%
associate--l+8.6%
+-commutative8.6%
+-commutative8.6%
+-commutative8.6%
associate-+l+8.6%
+-commutative8.6%
Simplified8.6%
Taylor expanded in x around inf 3.6%
mul-1-neg3.6%
Simplified3.6%
Taylor expanded in x around inf 9.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.02) (- 1.0 (sqrt x)) (* 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 <= 0.02) {
tmp = 1.0 - sqrt(x);
} else {
tmp = 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 <= 0.02d0) then
tmp = 1.0d0 - sqrt(x)
else
tmp = 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 <= 0.02) {
tmp = 1.0 - Math.sqrt(x);
} else {
tmp = 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 <= 0.02: tmp = 1.0 - math.sqrt(x) else: tmp = 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 <= 0.02) tmp = Float64(1.0 - sqrt(x)); else tmp = 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 <= 0.02)
tmp = 1.0 - sqrt(x);
else
tmp = 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, 0.02], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.02:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.0200000000000000004Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-64.8%
associate-+l-63.1%
associate-+r-60.0%
Simplified35.8%
Taylor expanded in t around inf 22.3%
associate--l+41.0%
+-commutative41.0%
+-commutative41.0%
+-commutative41.0%
associate-+l+41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in x around inf 26.5%
mul-1-neg26.5%
Simplified26.5%
Taylor expanded in x around 0 26.5%
if 0.0200000000000000004 < x Initial program 87.6%
+-commutative87.6%
associate-+r+87.5%
associate-+r-87.1%
associate-+l-64.1%
associate-+r-53.2%
Simplified53.0%
Taylor expanded in t around inf 7.5%
associate--l+8.6%
+-commutative8.6%
+-commutative8.6%
+-commutative8.6%
associate-+l+8.6%
+-commutative8.6%
Simplified8.6%
Taylor expanded in x around inf 3.6%
mul-1-neg3.6%
Simplified3.6%
Taylor expanded in x around inf 9.1%
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)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
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, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 92.4%
+-commutative92.4%
associate-+r+92.4%
associate-+r-76.8%
associate-+l-63.6%
associate-+r-56.4%
Simplified45.0%
Taylor expanded in t around inf 14.4%
associate--l+23.7%
+-commutative23.7%
+-commutative23.7%
+-commutative23.7%
associate-+l+23.7%
+-commutative23.7%
Simplified23.7%
Taylor expanded in x around 0 11.4%
+-commutative11.4%
associate-+r-26.4%
associate-+r+26.4%
+-commutative26.4%
associate-+r-23.6%
+-commutative23.6%
associate-+r+23.6%
Simplified23.6%
Taylor expanded in z around inf 44.6%
mul-1-neg44.6%
Simplified44.6%
Taylor expanded in z around inf 33.0%
(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 2024103
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))