
(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 25 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x))))
(if (<= t_1 1e-7)
(* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))
(+
(+ t_1 (exp (- (log (+ (sqrt (+ 1.0 y)) (sqrt y))))))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t_1 <= 1e-7) {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
} else {
tmp = (t_1 + exp(-log((sqrt((1.0 + y)) + sqrt(y))))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (t_1 <= 1d-7) then
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
else
tmp = (t_1 + exp(-log((sqrt((1.0d0 + y)) + sqrt(y))))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t_1 <= 1e-7) {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
} else {
tmp = (t_1 + Math.exp(-Math.log((Math.sqrt((1.0 + y)) + Math.sqrt(y))))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t_1 <= 1e-7: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) else: tmp = (t_1 + math.exp(-math.log((math.sqrt((1.0 + y)) + math.sqrt(y))))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t_1 <= 1e-7) tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(t_1 + exp(Float64(-log(Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t_1 <= 1e-7)
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
else
tmp = (t_1 + exp(-log((sqrt((1.0 + y)) + sqrt(y))))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-7], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[Exp[(-N[Log[N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t\_1 \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + e^{-\log \left(\sqrt{1 + y} + \sqrt{y}\right)}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.2%
associate--l+4.7%
Simplified4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.9%
distribute-lft-out11.9%
associate-+r+11.9%
unpow-111.9%
metadata-eval11.9%
pow-sqr11.9%
rem-sqrt-square11.9%
Simplified11.9%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
flip--97.6%
div-inv97.6%
add-sqr-sqrt79.3%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.6%
*-rgt-identity97.6%
associate--l+98.5%
+-inverses98.5%
metadata-eval98.5%
Simplified98.5%
add-exp-log98.5%
log-rec98.5%
Applied egg-rr98.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x))))
(if (<= t_1 1e-7)
(* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t_1 <= 1e-7) {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
} else {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (t_1 <= 1d-7) then
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
else
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (t_1 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t_1 <= 1e-7) {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
} else {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (t_1 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t_1 <= 1e-7: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) else: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (t_1 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t_1 <= 1e-7) tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t_1 <= 1e-7)
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
else
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-7], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t\_1 \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(t\_1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.2%
associate--l+4.7%
Simplified4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.9%
distribute-lft-out11.9%
associate-+r+11.9%
unpow-111.9%
metadata-eval11.9%
pow-sqr11.9%
rem-sqrt-square11.9%
Simplified11.9%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
flip--97.6%
div-inv97.6%
add-sqr-sqrt79.3%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.6%
*-rgt-identity97.6%
associate--l+98.5%
+-inverses98.5%
metadata-eval98.5%
Simplified98.5%
Final simplification52.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 1e-7)
(* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(- (+ 1.0 (+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (* x 0.5))) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
} else {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (x * 0.5))) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 1d-7) then
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
else
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((1.0d0 + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (x * 0.5d0))) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
} else {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((1.0 + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (x * 0.5))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 1e-7: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) else: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((1.0 + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (x * 0.5))) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 1e-7) tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(1.0 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(x * 0.5))) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7)
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
else
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (x * 0.5))) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $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}\;\sqrt{x + 1} - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(1 + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + x \cdot 0.5\right)\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.2%
associate--l+4.7%
Simplified4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.9%
distribute-lft-out11.9%
associate-+r+11.9%
unpow-111.9%
metadata-eval11.9%
pow-sqr11.9%
rem-sqrt-square11.9%
Simplified11.9%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
flip--97.6%
div-inv97.6%
add-sqr-sqrt79.3%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.6%
*-rgt-identity97.6%
associate--l+98.5%
+-inverses98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in x around 0 96.2%
Final simplification51.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 (<= (- (sqrt (+ x 1.0)) (sqrt x)) 1e-7)
(* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ (+ 1.0 (- (* x 0.5) (sqrt x))) (- (sqrt (+ 1.0 y)) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
} else {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + ((x * 0.5) - sqrt(x))) + (sqrt((1.0 + y)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 1d-7) then
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
else
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((1.0d0 + ((x * 0.5d0) - sqrt(x))) + (sqrt((1.0d0 + y)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
} else {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((1.0 + ((x * 0.5) - Math.sqrt(x))) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 1e-7: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) else: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((1.0 + ((x * 0.5) - math.sqrt(x))) + (math.sqrt((1.0 + y)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 1e-7) tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7)
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
else
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + ((x * 0.5) - sqrt(x))) + (sqrt((1.0 + y)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.2%
associate--l+4.7%
Simplified4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.9%
distribute-lft-out11.9%
associate-+r+11.9%
unpow-111.9%
metadata-eval11.9%
pow-sqr11.9%
rem-sqrt-square11.9%
Simplified11.9%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in x around 0 95.1%
associate--l+95.1%
*-commutative95.1%
Simplified95.1%
Final simplification51.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 1e-7)
(* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))
(+
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
} else {
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 1d-7) then
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
else
tmp = (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
} else {
tmp = (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 1e-7: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) else: tmp = (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 1e-7) tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7)
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
else
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.2%
associate--l+4.7%
Simplified4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.9%
distribute-lft-out11.9%
associate-+r+11.9%
unpow-111.9%
metadata-eval11.9%
pow-sqr11.9%
rem-sqrt-square11.9%
Simplified11.9%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in x around 0 59.0%
associate--l+93.9%
Simplified93.9%
flip--93.9%
div-inv93.9%
add-sqr-sqrt74.4%
add-sqr-sqrt94.2%
Applied egg-rr94.2%
associate-*r/94.2%
*-rgt-identity94.2%
associate--l+94.5%
+-inverses94.5%
metadata-eval94.5%
Simplified94.5%
Final simplification50.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 (<= (- (sqrt (+ x 1.0)) (sqrt x)) 1e-7)
(* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))
(+
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
} else {
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 1d-7) then
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
else
tmp = (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
} else {
tmp = (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 1e-7: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) else: tmp = (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 1e-7) tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7)
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
else
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.2%
associate--l+4.7%
Simplified4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.9%
distribute-lft-out11.9%
associate-+r+11.9%
unpow-111.9%
metadata-eval11.9%
pow-sqr11.9%
rem-sqrt-square11.9%
Simplified11.9%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in x around 0 59.0%
associate--l+93.9%
Simplified93.9%
flip--93.9%
div-inv93.9%
add-sqr-sqrt70.3%
add-sqr-sqrt93.9%
Applied egg-rr93.9%
associate-*r/93.9%
*-rgt-identity93.9%
associate--l+94.3%
+-inverses94.3%
metadata-eval94.3%
Simplified94.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 1e-7)
(* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
} else {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 1d-7) then
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
else
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 1e-7) {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
} else {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 1e-7: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) else: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 1e-7) tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7)
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
else
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.2%
associate--l+4.7%
Simplified4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.9%
distribute-lft-out11.9%
associate-+r+11.9%
unpow-111.9%
metadata-eval11.9%
pow-sqr11.9%
rem-sqrt-square11.9%
Simplified11.9%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in x around 0 59.0%
associate--l+93.9%
Simplified93.9%
Final simplification50.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 1.05e-32)
(-
(+ (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))) (+ t_1 2.0))
(+ (sqrt z) (+ (sqrt x) (sqrt y))))
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (/ 1.0 (+ t_1 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 1.05e-32) {
tmp = ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + (t_1 + 2.0)) - (sqrt(z) + (sqrt(x) + sqrt(y)));
} else {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((sqrt((x + 1.0)) - sqrt(x)) + (1.0 / (t_1 + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 1.05d-32) then
tmp = ((1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))) + (t_1 + 2.0d0)) - (sqrt(z) + (sqrt(x) + sqrt(y)))
else
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((sqrt((x + 1.0d0)) - sqrt(x)) + (1.0d0 / (t_1 + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 1.05e-32) {
tmp = ((1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))) + (t_1 + 2.0)) - (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (1.0 / (t_1 + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 1.05e-32: tmp = ((1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))) + (t_1 + 2.0)) - (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y))) else: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((math.sqrt((x + 1.0)) - math.sqrt(x)) + (1.0 / (t_1 + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 1.05e-32) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) + Float64(t_1 + 2.0)) - Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(1.0 / Float64(t_1 + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 1.05e-32)
tmp = ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + (t_1 + 2.0)) - (sqrt(z) + (sqrt(x) + sqrt(y)));
else
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((sqrt((x + 1.0)) - sqrt(x)) + (1.0 / (t_1 + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.05e-32], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + 2.0), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 1.05 \cdot 10^{-32}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \left(t\_1 + 2\right)\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \frac{1}{t\_1 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if z < 1.05e-32Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 42.6%
associate--l+46.1%
Simplified46.1%
flip--46.1%
div-inv46.1%
add-sqr-sqrt34.6%
add-sqr-sqrt46.1%
Applied egg-rr46.1%
associate-*r/46.1%
*-rgt-identity46.1%
associate--l+46.2%
+-inverses46.2%
metadata-eval46.2%
Simplified46.2%
Taylor expanded in z around 0 29.3%
associate-+r+29.4%
+-commutative29.4%
associate-+r+29.4%
+-commutative29.4%
Simplified29.4%
if 1.05e-32 < z Initial program 85.3%
associate-+l+85.3%
sub-neg85.3%
sub-neg85.3%
+-commutative85.3%
+-commutative85.3%
+-commutative85.3%
Simplified85.3%
flip--85.4%
div-inv85.4%
add-sqr-sqrt65.2%
add-sqr-sqrt85.4%
Applied egg-rr85.4%
associate-*r/85.4%
*-rgt-identity85.4%
associate--l+87.7%
+-inverses87.7%
metadata-eval87.7%
Simplified87.7%
Taylor expanded in t around inf 46.2%
Final simplification38.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 64000000000000.0)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 64000000000000.0) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((sqrt((x + 1.0)) - sqrt(x)) + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
} else {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 64000000000000.0d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((sqrt((x + 1.0d0)) - sqrt(x)) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))))
else
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 64000000000000.0) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))));
} else {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 64000000000000.0: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((math.sqrt((x + 1.0)) - math.sqrt(x)) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) else: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 64000000000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))); else tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 64000000000000.0)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((sqrt((x + 1.0)) - sqrt(x)) + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
else
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 64000000000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 64000000000000:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\end{array}
\end{array}
if x < 6.4e13Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
flip--97.6%
div-inv97.6%
add-sqr-sqrt79.3%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.6%
*-rgt-identity97.6%
associate--l+98.5%
+-inverses98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in t around inf 58.2%
if 6.4e13 < x Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.2%
associate--l+4.7%
Simplified4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.9%
distribute-lft-out11.9%
associate-+r+11.9%
unpow-111.9%
metadata-eval11.9%
pow-sqr11.9%
rem-sqrt-square11.9%
Simplified11.9%
Final simplification33.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 102.0)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(- (+ 1.0 (+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (* x 0.5))) (sqrt x)))
(* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 102.0) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (x * 0.5))) - sqrt(x));
} else {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 102.0d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (x * 0.5d0))) - sqrt(x))
else
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 102.0) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (x * 0.5))) - Math.sqrt(x));
} else {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 102.0: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (x * 0.5))) - math.sqrt(x)) else: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 102.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(x * 0.5))) - sqrt(x))); else tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 102.0)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (x * 0.5))) - sqrt(x));
else
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 102.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 102:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(1 + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + x \cdot 0.5\right)\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\end{array}
\end{array}
if x < 102Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
flip--97.9%
div-inv97.9%
add-sqr-sqrt79.2%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
associate-*r/97.9%
*-rgt-identity97.9%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in x around 0 97.6%
Taylor expanded in t around inf 58.9%
if 102 < x Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in t around inf 3.3%
associate--l+4.9%
Simplified4.9%
Taylor expanded in z around inf 5.5%
Taylor expanded in y around inf 4.6%
distribute-lft-out4.6%
Simplified4.6%
Taylor expanded in x around inf 11.8%
distribute-lft-out11.8%
associate-+r+11.8%
unpow-111.8%
metadata-eval11.8%
pow-sqr11.8%
rem-sqrt-square11.8%
Simplified11.8%
Final simplification33.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 10000000.0)
(- (+ (sqrt (+ 1.0 z)) (+ 1.0 t_1)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
(sqrt (+ x 1.0))
(- (+ t_1 (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 10000000.0) {
tmp = (sqrt((1.0 + z)) + (1.0 + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = sqrt((x + 1.0)) + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 10000000.0d0) then
tmp = (sqrt((1.0d0 + z)) + (1.0d0 + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = sqrt((x + 1.0d0)) + ((t_1 + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 10000000.0) {
tmp = (Math.sqrt((1.0 + z)) + (1.0 + t_1)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = Math.sqrt((x + 1.0)) + ((t_1 + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 10000000.0: tmp = (math.sqrt((1.0 + z)) + (1.0 + t_1)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = math.sqrt((x + 1.0)) + ((t_1 + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 10000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(1.0 + t_1)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 10000000.0)
tmp = (sqrt((1.0 + z)) + (1.0 + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = sqrt((x + 1.0)) + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 10000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 10000000:\\
\;\;\;\;\left(\sqrt{1 + z} + \left(1 + t\_1\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1e7Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 17.8%
associate--l+21.1%
Simplified21.1%
Taylor expanded in x around 0 16.8%
associate-+r+16.8%
Simplified16.8%
if 1e7 < z Initial program 83.3%
associate-+l+83.3%
sub-neg83.3%
sub-neg83.3%
+-commutative83.3%
+-commutative83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in t around inf 4.7%
associate--l+25.4%
Simplified25.4%
Taylor expanded in z around inf 31.9%
Final simplification23.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 10000000.0)
(- (+ (sqrt (+ 1.0 z)) (+ 1.0 t_1)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+ 1.0 (- (+ t_1 (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 10000000.0) {
tmp = (sqrt((1.0 + z)) + (1.0 + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = 1.0 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 10000000.0d0) then
tmp = (sqrt((1.0d0 + z)) + (1.0d0 + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = 1.0d0 + ((t_1 + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 10000000.0) {
tmp = (Math.sqrt((1.0 + z)) + (1.0 + t_1)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 1.0 + ((t_1 + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 10000000.0: tmp = (math.sqrt((1.0 + z)) + (1.0 + t_1)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = 1.0 + ((t_1 + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 10000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(1.0 + t_1)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(1.0 + Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 10000000.0)
tmp = (sqrt((1.0 + z)) + (1.0 + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = 1.0 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 10000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 10000000:\\
\;\;\;\;\left(\sqrt{1 + z} + \left(1 + t\_1\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1e7Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 17.8%
associate--l+21.1%
Simplified21.1%
Taylor expanded in x around 0 16.8%
associate-+r+16.8%
Simplified16.8%
if 1e7 < z Initial program 83.3%
associate-+l+83.3%
sub-neg83.3%
sub-neg83.3%
+-commutative83.3%
+-commutative83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in t around inf 4.7%
associate--l+25.4%
Simplified25.4%
Taylor expanded in z around inf 31.9%
Taylor expanded in x around 0 34.5%
Final simplification24.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 30500000.0)
(+ 1.0 (- (+ t_1 (sqrt (+ 1.0 z))) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+ 1.0 (- (+ t_1 (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 30500000.0) {
tmp = 1.0 + ((t_1 + sqrt((1.0 + z))) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = 1.0 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 30500000.0d0) then
tmp = 1.0d0 + ((t_1 + sqrt((1.0d0 + z))) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = 1.0d0 + ((t_1 + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 30500000.0) {
tmp = 1.0 + ((t_1 + Math.sqrt((1.0 + z))) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = 1.0 + ((t_1 + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 30500000.0: tmp = 1.0 + ((t_1 + math.sqrt((1.0 + z))) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = 1.0 + ((t_1 + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 30500000.0) tmp = Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + z))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(1.0 + Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 30500000.0)
tmp = 1.0 + ((t_1 + sqrt((1.0 + z))) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = 1.0 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 30500000.0], N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 30500000:\\
\;\;\;\;1 + \left(\left(t\_1 + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 3.05e7Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 17.8%
associate--l+21.1%
Simplified21.1%
Taylor expanded in x around 0 27.9%
if 3.05e7 < z Initial program 83.3%
associate-+l+83.3%
sub-neg83.3%
sub-neg83.3%
+-commutative83.3%
+-commutative83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in t around inf 4.7%
associate--l+25.4%
Simplified25.4%
Taylor expanded in z around inf 31.9%
Taylor expanded in x around 0 34.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 y))))
(if (<= z 0.95)
(-
(+ 2.0 (+ t_1 (* z (+ 0.5 (* z -0.125)))))
(+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+ 1.0 (- (+ t_1 (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 0.95) {
tmp = (2.0 + (t_1 + (z * (0.5 + (z * -0.125))))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = 1.0 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 0.95d0) then
tmp = (2.0d0 + (t_1 + (z * (0.5d0 + (z * (-0.125d0)))))) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = 1.0d0 + ((t_1 + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 0.95) {
tmp = (2.0 + (t_1 + (z * (0.5 + (z * -0.125))))) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 1.0 + ((t_1 + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 0.95: tmp = (2.0 + (t_1 + (z * (0.5 + (z * -0.125))))) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = 1.0 + ((t_1 + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 0.95) tmp = Float64(Float64(2.0 + Float64(t_1 + Float64(z * Float64(0.5 + Float64(z * -0.125))))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(1.0 + Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 0.95)
tmp = (2.0 + (t_1 + (z * (0.5 + (z * -0.125))))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = 1.0 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.95], N[(N[(2.0 + N[(t$95$1 + N[(z * N[(0.5 + N[(z * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 0.95:\\
\;\;\;\;\left(2 + \left(t\_1 + z \cdot \left(0.5 + z \cdot -0.125\right)\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 0.94999999999999996Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in t around inf 18.0%
associate--l+21.2%
Simplified21.2%
Taylor expanded in z around 0 17.6%
associate-+r+17.6%
associate--l+40.3%
associate-+r+40.3%
+-commutative40.3%
*-commutative40.3%
associate-+r+40.3%
Simplified40.3%
Taylor expanded in x around 0 16.7%
if 0.94999999999999996 < z Initial program 83.3%
associate-+l+83.3%
sub-neg83.3%
sub-neg83.3%
+-commutative83.3%
+-commutative83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in t around inf 4.7%
associate--l+25.1%
Simplified25.1%
Taylor expanded in z around inf 31.6%
Taylor expanded in x around 0 34.0%
Final simplification24.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 2100000000.0) (+ (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))) (sqrt (+ x 1.0))) (* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2100000000.0) {
tmp = (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))) + sqrt((x + 1.0));
} else {
tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 2100000000.0d0) then
tmp = (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))) + sqrt((x + 1.0d0))
else
tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2100000000.0) {
tmp = (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))) + Math.sqrt((x + 1.0));
} else {
tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 2100000000.0: tmp = (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) + math.sqrt((x + 1.0)) else: tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 2100000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))) + sqrt(Float64(x + 1.0))); else tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 2100000000.0)
tmp = (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))) + sqrt((x + 1.0));
else
tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 2100000000.0], N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2100000000:\\
\;\;\;\;\left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right) + \sqrt{x + 1}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\
\end{array}
\end{array}
if x < 2.1e9Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 21.6%
associate--l+43.6%
Simplified43.6%
Taylor expanded in z around inf 20.2%
associate--l+37.8%
+-commutative37.8%
Simplified37.8%
if 2.1e9 < x Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in t around inf 3.3%
associate--l+4.8%
Simplified4.8%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.8%
distribute-lft-out11.8%
associate-+r+11.8%
unpow-111.8%
metadata-eval11.8%
pow-sqr11.8%
rem-sqrt-square11.8%
Simplified11.8%
Final simplification24.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 (<= x 1150000000.0) (+ (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))) (sqrt (+ x 1.0))) (* 0.5 (+ (sqrt (/ 1.0 x)) (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 z)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1150000000.0) {
tmp = (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))) + sqrt((x + 1.0));
} else {
tmp = 0.5 * (sqrt((1.0 / x)) + (sqrt((1.0 / y)) + sqrt((1.0 / z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1150000000.0d0) then
tmp = (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))) + sqrt((x + 1.0d0))
else
tmp = 0.5d0 * (sqrt((1.0d0 / x)) + (sqrt((1.0d0 / y)) + sqrt((1.0d0 / z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1150000000.0) {
tmp = (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))) + Math.sqrt((x + 1.0));
} else {
tmp = 0.5 * (Math.sqrt((1.0 / x)) + (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1150000000.0: tmp = (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) + math.sqrt((x + 1.0)) else: tmp = 0.5 * (math.sqrt((1.0 / x)) + (math.sqrt((1.0 / y)) + math.sqrt((1.0 / z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1150000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))) + sqrt(Float64(x + 1.0))); else tmp = Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1150000000.0)
tmp = (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))) + sqrt((x + 1.0));
else
tmp = 0.5 * (sqrt((1.0 / x)) + (sqrt((1.0 / y)) + sqrt((1.0 / z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1150000000.0], N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1150000000:\\
\;\;\;\;\left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right) + \sqrt{x + 1}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{z}}\right)\right)\\
\end{array}
\end{array}
if x < 1.15e9Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 21.6%
associate--l+43.6%
Simplified43.6%
Taylor expanded in z around inf 20.2%
associate--l+37.8%
+-commutative37.8%
Simplified37.8%
if 1.15e9 < x Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in t around inf 3.3%
associate--l+4.8%
Simplified4.8%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 4.5%
distribute-lft-out4.5%
Simplified4.5%
Taylor expanded in x around inf 11.8%
distribute-lft-out11.8%
Simplified11.8%
Final simplification24.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 (<= x 110.0) (- (+ 1.0 (* x (+ 0.5 (* x (- (* x 0.0625) 0.125))))) (sqrt x)) (* 0.5 (+ (sqrt (/ 1.0 x)) (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 z)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 110.0) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
} else {
tmp = 0.5 * (sqrt((1.0 / x)) + (sqrt((1.0 / y)) + sqrt((1.0 / z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 110.0d0) then
tmp = (1.0d0 + (x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0))))) - sqrt(x)
else
tmp = 0.5d0 * (sqrt((1.0d0 / x)) + (sqrt((1.0d0 / y)) + sqrt((1.0d0 / z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 110.0) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - Math.sqrt(x);
} else {
tmp = 0.5 * (Math.sqrt((1.0 / x)) + (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 110.0: tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - math.sqrt(x) else: tmp = 0.5 * (math.sqrt((1.0 / x)) + (math.sqrt((1.0 / y)) + math.sqrt((1.0 / z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 110.0) 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 * Float64(sqrt(Float64(1.0 / x)) + Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 110.0)
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
else
tmp = 0.5 * (sqrt((1.0 / x)) + (sqrt((1.0 / y)) + sqrt((1.0 / z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 110.0], 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[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 110:\\
\;\;\;\;\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 \left(\sqrt{\frac{1}{x}} + \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{z}}\right)\right)\\
\end{array}
\end{array}
if x < 110Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 21.7%
associate--l+43.9%
Simplified43.9%
Taylor expanded in x around inf 30.6%
neg-mul-130.6%
Simplified30.6%
Taylor expanded in x around 0 30.6%
if 110 < x Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in t around inf 3.3%
associate--l+4.9%
Simplified4.9%
Taylor expanded in z around inf 5.5%
Taylor expanded in y around inf 4.6%
distribute-lft-out4.6%
Simplified4.6%
Taylor expanded in x around inf 11.8%
distribute-lft-out11.8%
Simplified11.8%
Final simplification20.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 1.45) (- (+ 1.0 (* x (+ 0.5 (* x (- (* x 0.0625) 0.125))))) (sqrt x)) (/ (+ (* (pow x -0.5) -0.125) (* (sqrt x) 0.5)) x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.45) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
} else {
tmp = ((pow(x, -0.5) * -0.125) + (sqrt(x) * 0.5)) / 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 <= 1.45d0) then
tmp = (1.0d0 + (x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0))))) - sqrt(x)
else
tmp = (((x ** (-0.5d0)) * (-0.125d0)) + (sqrt(x) * 0.5d0)) / 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 <= 1.45) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - Math.sqrt(x);
} else {
tmp = ((Math.pow(x, -0.5) * -0.125) + (Math.sqrt(x) * 0.5)) / x;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.45: tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - math.sqrt(x) else: tmp = ((math.pow(x, -0.5) * -0.125) + (math.sqrt(x) * 0.5)) / x return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.45) tmp = Float64(Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.0625) - 0.125))))) - sqrt(x)); else tmp = Float64(Float64(Float64((x ^ -0.5) * -0.125) + Float64(sqrt(x) * 0.5)) / 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 <= 1.45)
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
else
tmp = (((x ^ -0.5) * -0.125) + (sqrt(x) * 0.5)) / 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, 1.45], 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[(N[(N[(N[Power[x, -0.5], $MachinePrecision] * -0.125), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5} \cdot -0.125 + \sqrt{x} \cdot 0.5}{x}\\
\end{array}
\end{array}
if x < 1.44999999999999996Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 21.7%
associate--l+43.9%
Simplified43.9%
Taylor expanded in x around inf 30.6%
neg-mul-130.6%
Simplified30.6%
Taylor expanded in x around 0 30.6%
if 1.44999999999999996 < x Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in t around inf 3.3%
associate--l+4.9%
Simplified4.9%
Taylor expanded in x around inf 3.4%
neg-mul-13.4%
Simplified3.4%
Taylor expanded in x around inf 7.8%
pow17.8%
pow1/27.8%
inv-pow7.8%
pow-pow7.8%
metadata-eval7.8%
Applied egg-rr7.8%
unpow17.8%
Simplified7.8%
Final simplification18.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 4.2) (- (+ 1.0 (* x (+ 0.5 (* x (- (* x 0.0625) 0.125))))) (sqrt x)) (* 0.5 (fabs (pow x -0.5)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.2) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
} else {
tmp = 0.5 * fabs(pow(x, -0.5));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 4.2d0) then
tmp = (1.0d0 + (x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0))))) - sqrt(x)
else
tmp = 0.5d0 * abs((x ** (-0.5d0)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.2) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.abs(Math.pow(x, -0.5));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 4.2: tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - math.sqrt(x) else: tmp = 0.5 * math.fabs(math.pow(x, -0.5)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 4.2) 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 * abs((x ^ -0.5))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 4.2)
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
else
tmp = 0.5 * abs((x ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 4.2], 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[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.2:\\
\;\;\;\;\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 \left|{x}^{-0.5}\right|\\
\end{array}
\end{array}
if x < 4.20000000000000018Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 21.7%
associate--l+43.9%
Simplified43.9%
Taylor expanded in x around inf 30.6%
neg-mul-130.6%
Simplified30.6%
Taylor expanded in x around 0 30.6%
if 4.20000000000000018 < x Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in t around inf 3.3%
associate--l+4.9%
Simplified4.9%
Taylor expanded in x around inf 3.4%
neg-mul-13.4%
Simplified3.4%
Taylor expanded in x around inf 7.8%
Taylor expanded in x around inf 7.8%
unpow-17.8%
metadata-eval7.8%
pow-sqr7.8%
rem-sqrt-square7.8%
Simplified7.8%
Final simplification18.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 3.8) (- (+ 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.8) {
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.8d0) 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.8) {
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.8: 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.8) 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.8)
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.8], 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.8:\\
\;\;\;\;\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.7999999999999998Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 21.7%
associate--l+43.9%
Simplified43.9%
Taylor expanded in x around inf 30.6%
neg-mul-130.6%
Simplified30.6%
Taylor expanded in x around 0 30.6%
if 3.7999999999999998 < x Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in t around inf 3.3%
associate--l+4.9%
Simplified4.9%
Taylor expanded in x around inf 3.4%
neg-mul-13.4%
Simplified3.4%
Taylor expanded in x around inf 7.8%
Final simplification18.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 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(1.0 + Float64(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[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $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.95:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.94999999999999996Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 21.7%
associate--l+43.9%
Simplified43.9%
Taylor expanded in x around inf 30.6%
neg-mul-130.6%
Simplified30.6%
Taylor expanded in x around 0 30.6%
associate--l+30.6%
*-commutative30.6%
Simplified30.6%
if 0.94999999999999996 < x Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in t around inf 3.3%
associate--l+4.9%
Simplified4.9%
Taylor expanded in x around inf 3.4%
neg-mul-13.4%
Simplified3.4%
Taylor expanded in x around inf 7.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 9.5) (+ 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 <= 9.5) {
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 <= 9.5d0) 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 <= 9.5) {
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 <= 9.5: 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 <= 9.5) 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 <= 9.5)
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, 9.5], 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 9.5:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 9.5Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 21.7%
associate--l+43.9%
Simplified43.9%
Taylor expanded in x around inf 30.6%
neg-mul-130.6%
Simplified30.6%
Taylor expanded in x around 0 30.6%
associate--l+30.6%
*-commutative30.6%
Simplified30.6%
if 9.5 < x Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in t around inf 3.3%
associate--l+4.9%
Simplified4.9%
Taylor expanded in x around inf 3.4%
neg-mul-13.4%
Simplified3.4%
Taylor expanded in x around inf 7.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.048) (- 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.048) {
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.048d0) 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.048) {
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.048: 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.048) 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.048)
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.048], 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.048:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.048000000000000001Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 21.9%
associate--l+44.1%
Simplified44.1%
Taylor expanded in x around inf 30.7%
neg-mul-130.7%
Simplified30.7%
Taylor expanded in x around 0 30.7%
if 0.048000000000000001 < x Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.3%
associate--l+5.0%
Simplified5.0%
Taylor expanded in x around inf 3.4%
neg-mul-13.4%
Simplified3.4%
Taylor expanded in x around inf 7.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 x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Initial program 91.1%
associate-+l+91.1%
sub-neg91.1%
sub-neg91.1%
+-commutative91.1%
+-commutative91.1%
+-commutative91.1%
Simplified91.1%
Taylor expanded in t around inf 11.9%
associate--l+23.0%
Simplified23.0%
Taylor expanded in x around inf 16.0%
neg-mul-116.0%
Simplified16.0%
Taylor expanded in x around 0 14.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (sqrt y))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(y) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt(y);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[Sqrt[y], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{y}
\end{array}
Initial program 91.1%
associate-+l+91.1%
sub-neg91.1%
sub-neg91.1%
+-commutative91.1%
+-commutative91.1%
+-commutative91.1%
Simplified91.1%
Taylor expanded in t around inf 11.9%
associate--l+23.0%
Simplified23.0%
flip-+20.8%
add-sqr-sqrt17.6%
add-sqr-sqrt16.3%
Applied egg-rr16.3%
Taylor expanded in y around inf 6.8%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024177
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (sqrt t))))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))