
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y)))
(t_2 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_3 (sqrt (+ 1.0 z)))
(t_4 (+ (+ (- t_1 (sqrt y)) t_2) (- t_3 (sqrt z))))
(t_5 (sqrt (+ 1.0 t))))
(if (<= t_4 0.0001)
(+
(* -0.125 (sqrt (/ 1.0 (pow x 3.0))))
(+
(* 0.5 (sqrt (/ 1.0 x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt z) t_3)))))
(if (<= t_4 2.0002)
(+
(+ (/ 1.0 (+ t_1 (sqrt y))) t_2)
(+ (- t_5 (sqrt t)) (* 0.5 (sqrt (/ 1.0 z)))))
(-
(+ (+ 1.0 t_1) (+ t_3 (/ 1.0 (+ t_5 (sqrt t)))))
(+ (sqrt x) (+ (sqrt z) (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 t_2 = sqrt((x + 1.0)) - sqrt(x);
double t_3 = sqrt((1.0 + z));
double t_4 = ((t_1 - sqrt(y)) + t_2) + (t_3 - sqrt(z));
double t_5 = sqrt((1.0 + t));
double tmp;
if (t_4 <= 0.0001) {
tmp = (-0.125 * sqrt((1.0 / pow(x, 3.0)))) + ((0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(z) + t_3))));
} else if (t_4 <= 2.0002) {
tmp = ((1.0 / (t_1 + sqrt(y))) + t_2) + ((t_5 - sqrt(t)) + (0.5 * sqrt((1.0 / z))));
} else {
tmp = ((1.0 + t_1) + (t_3 + (1.0 / (t_5 + sqrt(t))))) - (sqrt(x) + (sqrt(z) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((x + 1.0d0)) - sqrt(x)
t_3 = sqrt((1.0d0 + z))
t_4 = ((t_1 - sqrt(y)) + t_2) + (t_3 - sqrt(z))
t_5 = sqrt((1.0d0 + t))
if (t_4 <= 0.0001d0) then
tmp = ((-0.125d0) * sqrt((1.0d0 / (x ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(z) + t_3))))
else if (t_4 <= 2.0002d0) then
tmp = ((1.0d0 / (t_1 + sqrt(y))) + t_2) + ((t_5 - sqrt(t)) + (0.5d0 * sqrt((1.0d0 / z))))
else
tmp = ((1.0d0 + t_1) + (t_3 + (1.0d0 / (t_5 + sqrt(t))))) - (sqrt(x) + (sqrt(z) + 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 t_2 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_3 = Math.sqrt((1.0 + z));
double t_4 = ((t_1 - Math.sqrt(y)) + t_2) + (t_3 - Math.sqrt(z));
double t_5 = Math.sqrt((1.0 + t));
double tmp;
if (t_4 <= 0.0001) {
tmp = (-0.125 * Math.sqrt((1.0 / Math.pow(x, 3.0)))) + ((0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(z) + t_3))));
} else if (t_4 <= 2.0002) {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + t_2) + ((t_5 - Math.sqrt(t)) + (0.5 * Math.sqrt((1.0 / z))));
} else {
tmp = ((1.0 + t_1) + (t_3 + (1.0 / (t_5 + Math.sqrt(t))))) - (Math.sqrt(x) + (Math.sqrt(z) + 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)) t_2 = math.sqrt((x + 1.0)) - math.sqrt(x) t_3 = math.sqrt((1.0 + z)) t_4 = ((t_1 - math.sqrt(y)) + t_2) + (t_3 - math.sqrt(z)) t_5 = math.sqrt((1.0 + t)) tmp = 0 if t_4 <= 0.0001: tmp = (-0.125 * math.sqrt((1.0 / math.pow(x, 3.0)))) + ((0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(z) + t_3)))) elif t_4 <= 2.0002: tmp = ((1.0 / (t_1 + math.sqrt(y))) + t_2) + ((t_5 - math.sqrt(t)) + (0.5 * math.sqrt((1.0 / z)))) else: tmp = ((1.0 + t_1) + (t_3 + (1.0 / (t_5 + math.sqrt(t))))) - (math.sqrt(x) + (math.sqrt(z) + 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)) t_2 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_3 = sqrt(Float64(1.0 + z)) t_4 = Float64(Float64(Float64(t_1 - sqrt(y)) + t_2) + Float64(t_3 - sqrt(z))) t_5 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_4 <= 0.0001) tmp = Float64(Float64(-0.125 * sqrt(Float64(1.0 / (x ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(z) + t_3))))); elseif (t_4 <= 2.0002) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + t_2) + Float64(Float64(t_5 - sqrt(t)) + Float64(0.5 * sqrt(Float64(1.0 / z))))); else tmp = Float64(Float64(Float64(1.0 + t_1) + Float64(t_3 + Float64(1.0 / Float64(t_5 + sqrt(t))))) - Float64(sqrt(x) + Float64(sqrt(z) + 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));
t_2 = sqrt((x + 1.0)) - sqrt(x);
t_3 = sqrt((1.0 + z));
t_4 = ((t_1 - sqrt(y)) + t_2) + (t_3 - sqrt(z));
t_5 = sqrt((1.0 + t));
tmp = 0.0;
if (t_4 <= 0.0001)
tmp = (-0.125 * sqrt((1.0 / (x ^ 3.0)))) + ((0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(z) + t_3))));
elseif (t_4 <= 2.0002)
tmp = ((1.0 / (t_1 + sqrt(y))) + t_2) + ((t_5 - sqrt(t)) + (0.5 * sqrt((1.0 / z))));
else
tmp = ((1.0 + t_1) + (t_3 + (1.0 / (t_5 + sqrt(t))))) - (sqrt(x) + (sqrt(z) + 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]}, Block[{t$95$2 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$4, 0.0001], N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2.0002], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(N[(t$95$5 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$1), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(t$95$5 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[z], $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}\\
t_2 := \sqrt{x + 1} - \sqrt{x}\\
t_3 := \sqrt{1 + z}\\
t_4 := \left(\left(t\_1 - \sqrt{y}\right) + t\_2\right) + \left(t\_3 - \sqrt{z}\right)\\
t_5 := \sqrt{1 + t}\\
\mathbf{if}\;t\_4 \leq 0.0001:\\
\;\;\;\;-0.125 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{z} + t\_3}\right)\right)\\
\mathbf{elif}\;t\_4 \leq 2.0002:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + t\_2\right) + \left(\left(t\_5 - \sqrt{t}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t\_1\right) + \left(t\_3 + \frac{1}{t\_5 + \sqrt{t}}\right)\right) - \left(\sqrt{x} + \left(\sqrt{z} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.00000000000000005e-4Initial program 69.4%
associate-+l+69.4%
sub-neg69.4%
sub-neg69.4%
+-commutative69.4%
+-commutative69.4%
+-commutative69.4%
Simplified69.4%
flip--69.4%
div-inv69.4%
add-sqr-sqrt36.3%
add-sqr-sqrt69.4%
Applied egg-rr69.4%
associate-*r/69.4%
*-rgt-identity69.4%
associate--l+75.2%
+-inverses75.2%
metadata-eval75.2%
Simplified75.2%
Taylor expanded in t around inf 3.2%
associate--l+6.4%
Simplified6.4%
Taylor expanded in y around inf 8.2%
Taylor expanded in x around inf 27.5%
if 1.00000000000000005e-4 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.00019999999999998Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in z around inf 52.3%
flip--52.3%
div-inv52.3%
add-sqr-sqrt41.6%
add-sqr-sqrt52.3%
Applied egg-rr52.3%
associate-*r/52.3%
*-rgt-identity52.3%
associate--l+52.3%
+-inverses52.3%
metadata-eval52.3%
Simplified52.3%
if 2.00019999999999998 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 99.5%
associate-+l+99.5%
sub-neg99.5%
sub-neg99.5%
+-commutative99.5%
+-commutative99.5%
+-commutative99.5%
Simplified99.5%
flip--99.5%
div-inv99.5%
add-sqr-sqrt75.0%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
associate-*r/99.5%
*-rgt-identity99.5%
associate--l+99.5%
+-inverses99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 90.3%
associate-+r+90.3%
+-commutative90.3%
+-commutative90.3%
Simplified90.3%
Final simplification56.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_2 (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z))))))
(if (<= t_1 0.0001)
(+
(* -0.125 (sqrt (/ 1.0 (pow x 3.0))))
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ (* 0.5 (sqrt (/ 1.0 y))) t_2)))
(+
(+ (- (sqrt (+ 1.0 y)) (sqrt y)) t_1)
(+ t_2 (- (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 t_2 = 1.0 / (sqrt(z) + sqrt((1.0 + z)));
double tmp;
if (t_1 <= 0.0001) {
tmp = (-0.125 * sqrt((1.0 / pow(x, 3.0)))) + ((0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_2));
} else {
tmp = ((sqrt((1.0 + y)) - sqrt(y)) + t_1) + (t_2 + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
t_2 = 1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))
if (t_1 <= 0.0001d0) then
tmp = ((-0.125d0) * sqrt((1.0d0 / (x ** 3.0d0)))) + ((0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + t_2))
else
tmp = ((sqrt((1.0d0 + y)) - sqrt(y)) + t_1) + (t_2 + (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 t_2 = 1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)));
double tmp;
if (t_1 <= 0.0001) {
tmp = (-0.125 * Math.sqrt((1.0 / Math.pow(x, 3.0)))) + ((0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + t_2));
} else {
tmp = ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + t_1) + (t_2 + (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) t_2 = 1.0 / (math.sqrt(z) + math.sqrt((1.0 + z))) tmp = 0 if t_1 <= 0.0001: tmp = (-0.125 * math.sqrt((1.0 / math.pow(x, 3.0)))) + ((0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + t_2)) else: tmp = ((math.sqrt((1.0 + y)) - math.sqrt(y)) + t_1) + (t_2 + (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)) t_2 = Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) tmp = 0.0 if (t_1 <= 0.0001) tmp = Float64(Float64(-0.125 * sqrt(Float64(1.0 / (x ^ 3.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + t_2))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + t_1) + Float64(t_2 + 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);
t_2 = 1.0 / (sqrt(z) + sqrt((1.0 + z)));
tmp = 0.0;
if (t_1 <= 0.0001)
tmp = (-0.125 * sqrt((1.0 / (x ^ 3.0)))) + ((0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_2));
else
tmp = ((sqrt((1.0 + y)) - sqrt(y)) + t_1) + (t_2 + (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]}, Block[{t$95$2 = N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0001], N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(t$95$2 + 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}\\
t_2 := \frac{1}{\sqrt{z} + \sqrt{1 + z}}\\
\mathbf{if}\;t\_1 \leq 0.0001:\\
\;\;\;\;-0.125 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + t\_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + y} - \sqrt{y}\right) + t\_1\right) + \left(t\_2 + \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)) < 1.00000000000000005e-4Initial program 91.2%
associate-+l+91.2%
sub-neg91.2%
sub-neg91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
Simplified91.2%
flip--91.2%
div-inv91.2%
add-sqr-sqrt77.5%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate-*r/91.2%
*-rgt-identity91.2%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
Simplified92.4%
Taylor expanded in t around inf 4.7%
associate--l+5.9%
Simplified5.9%
Taylor expanded in y around inf 5.9%
Taylor expanded in x around inf 27.0%
if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 98.6%
associate-+l+98.6%
sub-neg98.6%
sub-neg98.6%
+-commutative98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
flip--98.8%
div-inv98.8%
add-sqr-sqrt72.3%
add-sqr-sqrt98.9%
Applied egg-rr98.9%
associate-*r/98.9%
*-rgt-identity98.9%
associate--l+99.0%
+-inverses99.0%
metadata-eval99.0%
Simplified99.0%
Final simplification66.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= y 13500000000.0)
(+
(+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) t_1)
(- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y))))
(+
(+ t_1 (* 0.5 (sqrt (/ 1.0 z))))
(- (+ (* 0.5 (sqrt (/ 1.0 y))) (sqrt (+ x 1.0))) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (y <= 13500000000.0) {
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + t_1) + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (t_1 + (0.5 * sqrt((1.0 / z)))) + (((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
if (y <= 13500000000.0d0) then
tmp = ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + t_1) + ((1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y)))
else
tmp = (t_1 + (0.5d0 * sqrt((1.0d0 / z)))) + (((0.5d0 * sqrt((1.0d0 / y))) + sqrt((x + 1.0d0))) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (y <= 13500000000.0) {
tmp = ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + t_1) + ((1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (t_1 + (0.5 * Math.sqrt((1.0 / z)))) + (((0.5 * Math.sqrt((1.0 / y))) + Math.sqrt((x + 1.0))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if y <= 13500000000.0: tmp = ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + t_1) + ((1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (t_1 + (0.5 * math.sqrt((1.0 / z)))) + (((0.5 * math.sqrt((1.0 / y))) + math.sqrt((x + 1.0))) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (y <= 13500000000.0) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + t_1) + Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + sqrt(Float64(x + 1.0))) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (y <= 13500000000.0)
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + t_1) + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
else
tmp = (t_1 + (0.5 * sqrt((1.0 / z)))) + (((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 13500000000.0], N[(N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $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}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;y \leq 13500000000:\\
\;\;\;\;\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + t\_1\right) + \left(\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{y}} + \sqrt{x + 1}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 1.35e10Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.9%
div-inv97.9%
add-sqr-sqrt76.7%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate-*r/98.0%
*-rgt-identity98.0%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in x around 0 56.4%
if 1.35e10 < y Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in z around inf 45.5%
Taylor expanded in y around inf 45.5%
Final simplification51.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1.18e-17)
(+
(+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) (- (sqrt (+ 1.0 t)) (sqrt t)))
(- 2.0 (+ (sqrt x) (sqrt y))))
(+
(+ (- (sqrt (+ 1.0 y)) (sqrt y)) (- (sqrt (+ x 1.0)) (sqrt x)))
(+ (* 0.5 (sqrt (/ 1.0 z))) (* 0.5 (sqrt (/ 1.0 t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.18e-17) {
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(x) + sqrt(y)));
} else {
tmp = ((sqrt((1.0 + y)) - sqrt(y)) + (sqrt((x + 1.0)) - sqrt(x))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.18d-17) then
tmp = ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (sqrt((1.0d0 + t)) - sqrt(t))) + (2.0d0 - (sqrt(x) + sqrt(y)))
else
tmp = ((sqrt((1.0d0 + y)) - sqrt(y)) + (sqrt((x + 1.0d0)) - sqrt(x))) + ((0.5d0 * sqrt((1.0d0 / z))) + (0.5d0 * sqrt((1.0d0 / t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.18e-17) {
tmp = ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (2.0 - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + (Math.sqrt((x + 1.0)) - Math.sqrt(x))) + ((0.5 * Math.sqrt((1.0 / z))) + (0.5 * Math.sqrt((1.0 / t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.18e-17: tmp = ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (2.0 - (math.sqrt(x) + math.sqrt(y))) else: tmp = ((math.sqrt((1.0 + y)) - math.sqrt(y)) + (math.sqrt((x + 1.0)) - math.sqrt(x))) + ((0.5 * math.sqrt((1.0 / z))) + (0.5 * math.sqrt((1.0 / t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.18e-17) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(2.0 - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + Float64(sqrt(Float64(x + 1.0)) - sqrt(x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(0.5 * sqrt(Float64(1.0 / t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.18e-17)
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(x) + sqrt(y)));
else
tmp = ((sqrt((1.0 + y)) - sqrt(y)) + (sqrt((x + 1.0)) - sqrt(x))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.18e-17], N[(N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.18 \cdot 10^{-17}:\\
\;\;\;\;\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{x + 1} - \sqrt{x}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\end{array}
\end{array}
if y < 1.18000000000000004e-17Initial program 98.0%
associate-+l+98.0%
sub-neg98.0%
sub-neg98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
flip--98.1%
div-inv98.1%
add-sqr-sqrt79.5%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
*-rgt-identity98.2%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in x around 0 55.8%
Taylor expanded in y around 0 55.8%
if 1.18000000000000004e-17 < y Initial program 92.5%
associate-+l+92.5%
sub-neg92.5%
sub-neg92.5%
+-commutative92.5%
+-commutative92.5%
+-commutative92.5%
Simplified92.5%
Taylor expanded in z around inf 47.2%
Taylor expanded in t around inf 28.7%
Final simplification42.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt x) (sqrt y))))
(if (<= y 1.05e-26)
(+
(+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) (- (sqrt (+ 1.0 t)) (sqrt t)))
(- 2.0 t_1))
(if (<= y 20000000.0)
(+
(- (+ 1.0 (sqrt (+ 1.0 y))) t_1)
(+ (* 0.5 (sqrt (/ 1.0 z))) (* 0.5 (sqrt (/ 1.0 t)))))
(- (+ (* 0.5 (sqrt (/ 1.0 y))) (sqrt (+ x 1.0))) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (y <= 1.05e-26) {
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - t_1);
} else if (y <= 20000000.0) {
tmp = ((1.0 + sqrt((1.0 + y))) - t_1) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
if (y <= 1.05d-26) then
tmp = ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (sqrt((1.0d0 + t)) - sqrt(t))) + (2.0d0 - t_1)
else if (y <= 20000000.0d0) then
tmp = ((1.0d0 + sqrt((1.0d0 + y))) - t_1) + ((0.5d0 * sqrt((1.0d0 / z))) + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + sqrt((x + 1.0d0))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (y <= 1.05e-26) {
tmp = ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (2.0 - t_1);
} else if (y <= 20000000.0) {
tmp = ((1.0 + Math.sqrt((1.0 + y))) - t_1) + ((0.5 * Math.sqrt((1.0 / z))) + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + Math.sqrt((x + 1.0))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if y <= 1.05e-26: tmp = ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (2.0 - t_1) elif y <= 20000000.0: tmp = ((1.0 + math.sqrt((1.0 + y))) - t_1) + ((0.5 * math.sqrt((1.0 / z))) + (0.5 * math.sqrt((1.0 / t)))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + math.sqrt((x + 1.0))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (y <= 1.05e-26) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(2.0 - t_1)); elseif (y <= 20000000.0) tmp = Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - t_1) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + sqrt(Float64(x + 1.0))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (y <= 1.05e-26)
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - t_1);
elseif (y <= 20000000.0)
tmp = ((1.0 + sqrt((1.0 + y))) - t_1) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
else
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.05e-26], N[(N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 20000000.0], N[(N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;y \leq 1.05 \cdot 10^{-26}:\\
\;\;\;\;\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(2 - t\_1\right)\\
\mathbf{elif}\;y \leq 20000000:\\
\;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) - t\_1\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \sqrt{x + 1}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.05000000000000004e-26Initial program 98.0%
associate-+l+98.0%
sub-neg98.0%
sub-neg98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
flip--98.1%
div-inv98.1%
add-sqr-sqrt79.4%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
*-rgt-identity98.2%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in x around 0 54.8%
Taylor expanded in y around 0 54.8%
if 1.05000000000000004e-26 < y < 2e7Initial program 96.7%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in z around inf 60.8%
Taylor expanded in x around 0 52.1%
Taylor expanded in t around inf 19.8%
if 2e7 < y Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
flip--92.2%
div-inv92.2%
add-sqr-sqrt72.2%
add-sqr-sqrt92.2%
Applied egg-rr92.2%
associate-*r/92.2%
*-rgt-identity92.2%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
Simplified93.2%
Taylor expanded in t around inf 3.4%
associate--l+26.0%
Simplified26.0%
Taylor expanded in y around inf 38.0%
Taylor expanded in z around inf 28.7%
Final simplification40.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) (sqrt y))))
(if (<= t 3e+20)
(+ (- 2.0 t_1) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ 1.0 (sqrt z)))))
(+
1.0
(+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) (- (sqrt (+ 1.0 y)) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (t <= 3e+20) {
tmp = (2.0 - t_1) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (1.0 + sqrt(z))));
} else {
tmp = 1.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + y)) - t_1));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
if (t <= 3d+20) then
tmp = (2.0d0 - t_1) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (1.0d0 + sqrt(z))))
else
tmp = 1.0d0 + ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (sqrt((1.0d0 + y)) - t_1))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (t <= 3e+20) {
tmp = (2.0 - t_1) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (1.0 + Math.sqrt(z))));
} else {
tmp = 1.0 + ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (Math.sqrt((1.0 + y)) - t_1));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if t <= 3e+20: tmp = (2.0 - t_1) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (1.0 + math.sqrt(z)))) else: tmp = 1.0 + ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (math.sqrt((1.0 + y)) - t_1)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (t <= 3e+20) tmp = Float64(Float64(2.0 - t_1) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(1.0 + sqrt(z))))); else tmp = Float64(1.0 + Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(sqrt(Float64(1.0 + y)) - t_1))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (t <= 3e+20)
tmp = (2.0 - t_1) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (1.0 + sqrt(z))));
else
tmp = 1.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + y)) - t_1));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 3e+20], N[(N[(2.0 - t$95$1), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;t \leq 3 \cdot 10^{+20}:\\
\;\;\;\;\left(2 - t\_1\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\sqrt{1 + y} - t\_1\right)\right)\\
\end{array}
\end{array}
if t < 3e20Initial program 96.3%
associate-+l+96.3%
sub-neg96.3%
sub-neg96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
flip--96.4%
div-inv96.4%
add-sqr-sqrt75.6%
add-sqr-sqrt96.4%
Applied egg-rr96.4%
associate-*r/96.4%
*-rgt-identity96.4%
associate--l+96.6%
+-inverses96.6%
metadata-eval96.6%
Simplified96.6%
Taylor expanded in x around 0 46.6%
Taylor expanded in z around 0 45.8%
Taylor expanded in y around 0 29.6%
if 3e20 < t Initial program 94.0%
associate-+l+94.0%
sub-neg94.0%
sub-neg94.0%
+-commutative94.0%
+-commutative94.0%
+-commutative94.0%
Simplified94.0%
flip--94.2%
div-inv94.2%
add-sqr-sqrt73.6%
add-sqr-sqrt94.3%
Applied egg-rr94.3%
associate-*r/94.3%
*-rgt-identity94.3%
associate--l+95.4%
+-inverses95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in t around inf 33.7%
associate--l+51.9%
Simplified51.9%
Taylor expanded in x around 0 31.0%
associate--l+53.7%
associate-+r-53.7%
+-commutative53.7%
associate-+l-57.1%
Simplified57.1%
Final simplification42.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 2300000000.0)
(+
1.0
(+
(/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z))))
(- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))))
(- (+ (* 0.5 (sqrt (/ 1.0 y))) (sqrt (+ x 1.0))) (sqrt x))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2300000000.0) {
tmp = 1.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2300000000.0d0) then
tmp = 1.0d0 + ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + sqrt((x + 1.0d0))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2300000000.0) {
tmp = 1.0 + ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + Math.sqrt((x + 1.0))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2300000000.0: tmp = 1.0 + ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + math.sqrt((x + 1.0))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2300000000.0) tmp = Float64(1.0 + Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + sqrt(Float64(x + 1.0))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2300000000.0)
tmp = 1.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
else
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2300000000.0], N[(1.0 + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2300000000:\\
\;\;\;\;1 + \left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \sqrt{x + 1}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.3e9Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.9%
div-inv97.9%
add-sqr-sqrt76.7%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate-*r/98.0%
*-rgt-identity98.0%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in t around inf 35.6%
associate--l+35.5%
Simplified35.5%
Taylor expanded in x around 0 32.4%
associate--l+32.4%
associate-+r-32.4%
+-commutative32.4%
associate-+l-32.4%
Simplified32.4%
if 2.3e9 < y Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
flip--92.2%
div-inv92.2%
add-sqr-sqrt72.2%
add-sqr-sqrt92.2%
Applied egg-rr92.2%
associate-*r/92.2%
*-rgt-identity92.2%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
Simplified93.2%
Taylor expanded in t around inf 3.4%
associate--l+26.0%
Simplified26.0%
Taylor expanded in y around inf 38.0%
Taylor expanded in z around inf 28.7%
Final simplification30.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt x) (sqrt y))))
(if (<= y 1.05e-26)
(+ 2.0 (- (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) t_1))
(if (<= y 160000000.0)
(- (+ 1.0 (+ (sqrt (+ 1.0 y)) (* 0.5 (sqrt (/ 1.0 z))))) t_1)
(- (+ (* 0.5 (sqrt (/ 1.0 y))) (sqrt (+ x 1.0))) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (y <= 1.05e-26) {
tmp = 2.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) - t_1);
} else if (y <= 160000000.0) {
tmp = (1.0 + (sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z))))) - t_1;
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
if (y <= 1.05d-26) then
tmp = 2.0d0 + ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) - t_1)
else if (y <= 160000000.0d0) then
tmp = (1.0d0 + (sqrt((1.0d0 + y)) + (0.5d0 * sqrt((1.0d0 / z))))) - t_1
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + sqrt((x + 1.0d0))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (y <= 1.05e-26) {
tmp = 2.0 + ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) - t_1);
} else if (y <= 160000000.0) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) + (0.5 * Math.sqrt((1.0 / z))))) - t_1;
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + Math.sqrt((x + 1.0))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if y <= 1.05e-26: tmp = 2.0 + ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) - t_1) elif y <= 160000000.0: tmp = (1.0 + (math.sqrt((1.0 + y)) + (0.5 * math.sqrt((1.0 / z))))) - t_1 else: tmp = ((0.5 * math.sqrt((1.0 / y))) + math.sqrt((x + 1.0))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (y <= 1.05e-26) tmp = Float64(2.0 + Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) - t_1)); elseif (y <= 160000000.0) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(0.5 * sqrt(Float64(1.0 / z))))) - t_1); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + sqrt(Float64(x + 1.0))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (y <= 1.05e-26)
tmp = 2.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) - t_1);
elseif (y <= 160000000.0)
tmp = (1.0 + (sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z))))) - t_1;
else
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.05e-26], N[(2.0 + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 160000000.0], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;y \leq 1.05 \cdot 10^{-26}:\\
\;\;\;\;2 + \left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} - t\_1\right)\\
\mathbf{elif}\;y \leq 160000000:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \sqrt{x + 1}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.05000000000000004e-26Initial program 98.0%
associate-+l+98.0%
sub-neg98.0%
sub-neg98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
flip--98.1%
div-inv98.1%
add-sqr-sqrt79.4%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
*-rgt-identity98.2%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in t around inf 34.6%
associate--l+34.6%
Simplified34.6%
Taylor expanded in x around 0 32.0%
associate--l+32.0%
associate-+r-32.0%
+-commutative32.0%
associate-+l-32.0%
Simplified32.0%
Taylor expanded in y around 0 32.0%
associate--l+32.0%
Simplified32.0%
if 1.05000000000000004e-26 < y < 1.6e8Initial program 96.7%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
flip--96.8%
div-inv96.8%
add-sqr-sqrt57.7%
add-sqr-sqrt96.8%
Applied egg-rr96.8%
associate-*r/96.8%
*-rgt-identity96.8%
associate--l+96.8%
+-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in t around inf 42.7%
associate--l+42.5%
Simplified42.5%
Taylor expanded in x around 0 35.2%
associate--l+35.1%
associate-+r-35.1%
+-commutative35.1%
associate-+l-35.1%
Simplified35.1%
Taylor expanded in z around inf 24.2%
if 1.6e8 < y Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
flip--92.2%
div-inv92.2%
add-sqr-sqrt72.2%
add-sqr-sqrt92.2%
Applied egg-rr92.2%
associate-*r/92.2%
*-rgt-identity92.2%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
Simplified93.2%
Taylor expanded in t around inf 3.4%
associate--l+26.0%
Simplified26.0%
Taylor expanded in y around inf 38.0%
Taylor expanded in z around inf 28.7%
Final simplification29.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1.4)
(+
1.0
(+
(/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z))))
(- 1.0 (+ (sqrt x) (+ (sqrt y) (* y -0.5))))))
(- (+ (* 0.5 (sqrt (/ 1.0 y))) (sqrt (+ x 1.0))) (sqrt x))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4) {
tmp = 1.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (1.0 - (sqrt(x) + (sqrt(y) + (y * -0.5)))));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.4d0) then
tmp = 1.0d0 + ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (1.0d0 - (sqrt(x) + (sqrt(y) + (y * (-0.5d0))))))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + sqrt((x + 1.0d0))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4) {
tmp = 1.0 + ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (1.0 - (Math.sqrt(x) + (Math.sqrt(y) + (y * -0.5)))));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + Math.sqrt((x + 1.0))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.4: tmp = 1.0 + ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (1.0 - (math.sqrt(x) + (math.sqrt(y) + (y * -0.5))))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + math.sqrt((x + 1.0))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.4) tmp = Float64(1.0 + Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(1.0 - Float64(sqrt(x) + Float64(sqrt(y) + Float64(y * -0.5)))))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + sqrt(Float64(x + 1.0))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.4)
tmp = 1.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (1.0 - (sqrt(x) + (sqrt(y) + (y * -0.5)))));
else
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.4], N[(1.0 + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4:\\
\;\;\;\;1 + \left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(1 - \left(\sqrt{x} + \left(\sqrt{y} + y \cdot -0.5\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \sqrt{x + 1}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.3999999999999999Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.9%
div-inv97.9%
add-sqr-sqrt77.8%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate-*r/98.0%
*-rgt-identity98.0%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in t around inf 35.8%
associate--l+35.8%
Simplified35.8%
Taylor expanded in x around 0 32.6%
associate--l+32.6%
associate-+r-32.6%
+-commutative32.6%
associate-+l-32.6%
Simplified32.6%
Taylor expanded in y around 0 32.6%
if 1.3999999999999999 < y Initial program 92.3%
associate-+l+92.3%
sub-neg92.3%
sub-neg92.3%
+-commutative92.3%
+-commutative92.3%
+-commutative92.3%
Simplified92.3%
flip--92.3%
div-inv92.3%
add-sqr-sqrt71.0%
add-sqr-sqrt92.3%
Applied egg-rr92.3%
associate-*r/92.3%
*-rgt-identity92.3%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
Simplified93.2%
Taylor expanded in t around inf 3.7%
associate--l+25.9%
Simplified25.9%
Taylor expanded in y around inf 37.7%
Taylor expanded in z around inf 28.5%
Final simplification30.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt x) (sqrt y))))
(if (<= y 3e-13)
(+ 2.0 (- (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) t_1))
(if (<= y 82000000.0)
(- (+ 1.0 (sqrt (+ 1.0 y))) t_1)
(- (+ (* 0.5 (sqrt (/ 1.0 y))) (sqrt (+ x 1.0))) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (y <= 3e-13) {
tmp = 2.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) - t_1);
} else if (y <= 82000000.0) {
tmp = (1.0 + sqrt((1.0 + y))) - t_1;
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
if (y <= 3d-13) then
tmp = 2.0d0 + ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) - t_1)
else if (y <= 82000000.0d0) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - t_1
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + sqrt((x + 1.0d0))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (y <= 3e-13) {
tmp = 2.0 + ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) - t_1);
} else if (y <= 82000000.0) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - t_1;
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + Math.sqrt((x + 1.0))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if y <= 3e-13: tmp = 2.0 + ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) - t_1) elif y <= 82000000.0: tmp = (1.0 + math.sqrt((1.0 + y))) - t_1 else: tmp = ((0.5 * math.sqrt((1.0 / y))) + math.sqrt((x + 1.0))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (y <= 3e-13) tmp = Float64(2.0 + Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) - t_1)); elseif (y <= 82000000.0) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - t_1); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + sqrt(Float64(x + 1.0))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (y <= 3e-13)
tmp = 2.0 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) - t_1);
elseif (y <= 82000000.0)
tmp = (1.0 + sqrt((1.0 + y))) - t_1;
else
tmp = ((0.5 * sqrt((1.0 / y))) + sqrt((x + 1.0))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3e-13], N[(2.0 + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 82000000.0], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;y \leq 3 \cdot 10^{-13}:\\
\;\;\;\;2 + \left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} - t\_1\right)\\
\mathbf{elif}\;y \leq 82000000:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \sqrt{x + 1}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.99999999999999984e-13Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.9%
div-inv97.9%
add-sqr-sqrt79.3%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate-*r/98.0%
*-rgt-identity98.0%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in t around inf 36.5%
associate--l+36.5%
Simplified36.5%
Taylor expanded in x around 0 33.2%
associate--l+33.2%
associate-+r-33.2%
+-commutative33.2%
associate-+l-33.2%
Simplified33.2%
Taylor expanded in y around 0 33.2%
associate--l+33.2%
Simplified33.2%
if 2.99999999999999984e-13 < y < 8.2e7Initial program 98.5%
associate-+l+98.5%
sub-neg98.5%
sub-neg98.5%
+-commutative98.5%
+-commutative98.5%
+-commutative98.5%
Simplified98.5%
flip--98.5%
div-inv98.5%
add-sqr-sqrt19.6%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
associate-*r/98.5%
*-rgt-identity98.5%
associate--l+98.5%
+-inverses98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in t around inf 14.1%
associate--l+14.1%
Simplified14.1%
Taylor expanded in x around 0 13.5%
associate--l+13.5%
associate-+r-13.5%
+-commutative13.5%
associate-+l-13.5%
Simplified13.5%
Taylor expanded in z around inf 13.5%
if 8.2e7 < y Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
flip--92.2%
div-inv92.2%
add-sqr-sqrt72.2%
add-sqr-sqrt92.2%
Applied egg-rr92.2%
associate-*r/92.2%
*-rgt-identity92.2%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
Simplified93.2%
Taylor expanded in t around inf 3.4%
associate--l+26.0%
Simplified26.0%
Taylor expanded in y around inf 38.0%
Taylor expanded in z around inf 28.7%
Final simplification30.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))) (t_2 (+ (sqrt x) (sqrt y)))) (if (<= z 0.066) (- (+ t_1 2.0) t_2) (+ 1.0 (- t_1 t_2)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt(x) + sqrt(y);
double tmp;
if (z <= 0.066) {
tmp = (t_1 + 2.0) - t_2;
} else {
tmp = 1.0 + (t_1 - t_2);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt(x) + sqrt(y)
if (z <= 0.066d0) then
tmp = (t_1 + 2.0d0) - t_2
else
tmp = 1.0d0 + (t_1 - t_2)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (z <= 0.066) {
tmp = (t_1 + 2.0) - t_2;
} else {
tmp = 1.0 + (t_1 - t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt(x) + math.sqrt(y) tmp = 0 if z <= 0.066: tmp = (t_1 + 2.0) - t_2 else: tmp = 1.0 + (t_1 - t_2) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (z <= 0.066) tmp = Float64(Float64(t_1 + 2.0) - t_2); else tmp = Float64(1.0 + Float64(t_1 - t_2)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (z <= 0.066)
tmp = (t_1 + 2.0) - t_2;
else
tmp = 1.0 + (t_1 - t_2);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 0.066], N[(N[(t$95$1 + 2.0), $MachinePrecision] - t$95$2), $MachinePrecision], N[(1.0 + N[(t$95$1 - t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 0.066:\\
\;\;\;\;\left(t\_1 + 2\right) - t\_2\\
\mathbf{else}:\\
\;\;\;\;1 + \left(t\_1 - t\_2\right)\\
\end{array}
\end{array}
if z < 0.066000000000000003Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in t around inf 17.2%
associate--l+20.2%
Simplified20.2%
Taylor expanded in y around inf 20.2%
Taylor expanded in z around 0 17.2%
Taylor expanded in x around 0 14.3%
+-commutative14.3%
Simplified14.3%
if 0.066000000000000003 < z Initial program 93.6%
associate-+l+93.6%
sub-neg93.6%
sub-neg93.6%
+-commutative93.6%
+-commutative93.6%
+-commutative93.6%
Simplified93.6%
flip--93.8%
div-inv93.8%
add-sqr-sqrt48.9%
add-sqr-sqrt93.9%
Applied egg-rr93.9%
associate-*r/93.9%
*-rgt-identity93.9%
associate--l+95.3%
+-inverses95.3%
metadata-eval95.3%
Simplified95.3%
Taylor expanded in t around inf 25.2%
associate--l+44.0%
Simplified44.0%
Taylor expanded in x around 0 24.2%
associate--l+47.8%
associate-+r-47.8%
+-commutative47.8%
associate-+l-47.8%
Simplified47.8%
Taylor expanded in z around inf 46.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 2e+16) (- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e+16) {
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2d+16) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e+16) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2e+16: tmp = (1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2e+16) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2e+16)
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2e+16], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+16}:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 2e16Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.9%
div-inv97.9%
add-sqr-sqrt76.7%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate-*r/98.0%
*-rgt-identity98.0%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in t around inf 35.6%
associate--l+35.5%
Simplified35.5%
Taylor expanded in x around 0 32.4%
associate--l+32.4%
associate-+r-32.4%
+-commutative32.4%
associate-+l-32.4%
Simplified32.4%
Taylor expanded in z around inf 23.7%
if 2e16 < y Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in t around inf 3.4%
associate--l+26.1%
Simplified26.1%
Taylor expanded in x around inf 28.7%
mul-1-neg28.7%
Simplified28.7%
Final simplification26.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 5.6e+16) (+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.6e+16) {
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 5.6d+16) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.6e+16) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5.6e+16: tmp = 1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5.6e+16) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 5.6e+16)
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 5.6e+16], 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[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.6 \cdot 10^{+16}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 5.6e16Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.9%
div-inv97.9%
add-sqr-sqrt76.7%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate-*r/98.0%
*-rgt-identity98.0%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in t around inf 35.6%
associate--l+35.5%
Simplified35.5%
Taylor expanded in x around 0 32.4%
associate--l+32.4%
associate-+r-32.4%
+-commutative32.4%
associate-+l-32.4%
Simplified32.4%
Taylor expanded in z around inf 23.7%
if 5.6e16 < y Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in t around inf 3.4%
associate--l+26.1%
Simplified26.1%
Taylor expanded in x around inf 28.7%
mul-1-neg28.7%
Simplified28.7%
Final simplification26.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 2e+16) (- (+ 1.0 (sqrt (+ 1.0 y))) (sqrt y)) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e+16) {
tmp = (1.0 + sqrt((1.0 + y))) - sqrt(y);
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2d+16) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - sqrt(y)
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e+16) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - Math.sqrt(y);
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2e+16: tmp = (1.0 + math.sqrt((1.0 + y))) - math.sqrt(y) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2e+16) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - sqrt(y)); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2e+16)
tmp = (1.0 + sqrt((1.0 + y))) - sqrt(y);
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2e+16], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+16}:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 2e16Initial 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.8%
associate--l+23.4%
Simplified23.4%
Taylor expanded in y around inf 18.4%
Taylor expanded in z around 0 33.6%
Taylor expanded in x around inf 47.3%
if 2e16 < y Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in t around inf 3.4%
associate--l+26.1%
Simplified26.1%
Taylor expanded in x around inf 28.7%
mul-1-neg28.7%
Simplified28.7%
Final simplification38.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))) (if (<= y 0.9) (+ 1.0 t_1) t_1)))
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 (y <= 0.9) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (y <= 0.9d0) then
tmp = 1.0d0 + t_1
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (y <= 0.9) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
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 y <= 0.9: tmp = 1.0 + t_1 else: tmp = t_1 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 (y <= 0.9) tmp = Float64(1.0 + t_1); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (y <= 0.9)
tmp = 1.0 + t_1;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 0.9], N[(1.0 + t$95$1), $MachinePrecision], t$95$1]]
\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}\;y \leq 0.9:\\
\;\;\;\;1 + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < 0.900000000000000022Initial 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 19.0%
associate--l+23.5%
Simplified23.5%
Taylor expanded in y around inf 18.5%
Taylor expanded in z around 0 32.6%
Taylor expanded in y around inf 24.8%
associate--l+35.3%
Simplified35.3%
if 0.900000000000000022 < y Initial program 92.3%
associate-+l+92.3%
sub-neg92.3%
sub-neg92.3%
+-commutative92.3%
+-commutative92.3%
+-commutative92.3%
Simplified92.3%
Taylor expanded in t around inf 3.4%
associate--l+25.9%
Simplified25.9%
Taylor expanded in x around inf 28.5%
mul-1-neg28.5%
Simplified28.5%
Final simplification32.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Initial program 95.2%
associate-+l+95.2%
sub-neg95.2%
sub-neg95.2%
+-commutative95.2%
+-commutative95.2%
+-commutative95.2%
Simplified95.2%
Taylor expanded in t around inf 11.8%
associate--l+24.6%
Simplified24.6%
Taylor expanded in x around inf 19.5%
mul-1-neg19.5%
Simplified19.5%
Final simplification19.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* 0.5 (sqrt (/ 1.0 y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.5 * sqrt((1.0 / y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 * sqrt((1.0d0 / y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 0.5 * Math.sqrt((1.0 / y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.5 * math.sqrt((1.0 / y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(0.5 * sqrt(Float64(1.0 / y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.5 * sqrt((1.0 / y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot \sqrt{\frac{1}{y}}
\end{array}
Initial program 95.2%
associate-+l+95.2%
sub-neg95.2%
sub-neg95.2%
+-commutative95.2%
+-commutative95.2%
+-commutative95.2%
Simplified95.2%
flip--95.3%
div-inv95.3%
add-sqr-sqrt74.6%
add-sqr-sqrt95.4%
Applied egg-rr95.4%
associate-*r/95.4%
*-rgt-identity95.4%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified96.0%
Taylor expanded in t around inf 20.9%
associate--l+31.2%
Simplified31.2%
Taylor expanded in y around inf 20.8%
Taylor expanded in y around 0 6.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (sqrt z))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt(z);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt(z)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt(z);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt(z)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(z) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt(z);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[Sqrt[z], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{z}
\end{array}
Initial program 95.2%
associate-+l+95.2%
sub-neg95.2%
sub-neg95.2%
+-commutative95.2%
+-commutative95.2%
+-commutative95.2%
Simplified95.2%
Taylor expanded in t around inf 11.8%
associate--l+24.6%
Simplified24.6%
Taylor expanded in y around inf 16.8%
Taylor expanded in z around inf 6.7%
(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 2024135
(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))))