
(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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (+ t_1 (- t_2 (sqrt y))))
(t_4 (- (sqrt (+ 1.0 z)) (sqrt z)))
(t_5 (+ t_3 t_4))
(t_6 (* 0.5 (sqrt (/ 1.0 z))))
(t_7 (sqrt (+ 1.0 t))))
(if (<= t_5 5e-6)
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ t_6 (* 0.5 (sqrt (/ 1.0 t)))))
(if (<= t_5 2.00005)
(+ (+ t_1 (/ 1.0 (+ (sqrt y) t_2))) (+ t_6 (- t_7 (sqrt t))))
(+ t_3 (+ t_4 (/ 1.0 (+ t_7 (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 = sqrt((1.0 + y));
double t_3 = t_1 + (t_2 - sqrt(y));
double t_4 = sqrt((1.0 + z)) - sqrt(z);
double t_5 = t_3 + t_4;
double t_6 = 0.5 * sqrt((1.0 / z));
double t_7 = sqrt((1.0 + t));
double tmp;
if (t_5 <= 5e-6) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + (t_6 + (0.5 * sqrt((1.0 / t))));
} else if (t_5 <= 2.00005) {
tmp = (t_1 + (1.0 / (sqrt(y) + t_2))) + (t_6 + (t_7 - sqrt(t)));
} else {
tmp = t_3 + (t_4 + (1.0 / (t_7 + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
t_2 = sqrt((1.0d0 + y))
t_3 = t_1 + (t_2 - sqrt(y))
t_4 = sqrt((1.0d0 + z)) - sqrt(z)
t_5 = t_3 + t_4
t_6 = 0.5d0 * sqrt((1.0d0 / z))
t_7 = sqrt((1.0d0 + t))
if (t_5 <= 5d-6) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + (t_6 + (0.5d0 * sqrt((1.0d0 / t))))
else if (t_5 <= 2.00005d0) then
tmp = (t_1 + (1.0d0 / (sqrt(y) + t_2))) + (t_6 + (t_7 - sqrt(t)))
else
tmp = t_3 + (t_4 + (1.0d0 / (t_7 + 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 = Math.sqrt((1.0 + y));
double t_3 = t_1 + (t_2 - Math.sqrt(y));
double t_4 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_5 = t_3 + t_4;
double t_6 = 0.5 * Math.sqrt((1.0 / z));
double t_7 = Math.sqrt((1.0 + t));
double tmp;
if (t_5 <= 5e-6) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + (t_6 + (0.5 * Math.sqrt((1.0 / t))));
} else if (t_5 <= 2.00005) {
tmp = (t_1 + (1.0 / (Math.sqrt(y) + t_2))) + (t_6 + (t_7 - Math.sqrt(t)));
} else {
tmp = t_3 + (t_4 + (1.0 / (t_7 + 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 = math.sqrt((1.0 + y)) t_3 = t_1 + (t_2 - math.sqrt(y)) t_4 = math.sqrt((1.0 + z)) - math.sqrt(z) t_5 = t_3 + t_4 t_6 = 0.5 * math.sqrt((1.0 / z)) t_7 = math.sqrt((1.0 + t)) tmp = 0 if t_5 <= 5e-6: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + (t_6 + (0.5 * math.sqrt((1.0 / t)))) elif t_5 <= 2.00005: tmp = (t_1 + (1.0 / (math.sqrt(y) + t_2))) + (t_6 + (t_7 - math.sqrt(t))) else: tmp = t_3 + (t_4 + (1.0 / (t_7 + 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 = sqrt(Float64(1.0 + y)) t_3 = Float64(t_1 + Float64(t_2 - sqrt(y))) t_4 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_5 = Float64(t_3 + t_4) t_6 = Float64(0.5 * sqrt(Float64(1.0 / z))) t_7 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_5 <= 5e-6) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(t_6 + Float64(0.5 * sqrt(Float64(1.0 / t))))); elseif (t_5 <= 2.00005) tmp = Float64(Float64(t_1 + Float64(1.0 / Float64(sqrt(y) + t_2))) + Float64(t_6 + Float64(t_7 - sqrt(t)))); else tmp = Float64(t_3 + Float64(t_4 + Float64(1.0 / Float64(t_7 + 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 = sqrt((1.0 + y));
t_3 = t_1 + (t_2 - sqrt(y));
t_4 = sqrt((1.0 + z)) - sqrt(z);
t_5 = t_3 + t_4;
t_6 = 0.5 * sqrt((1.0 / z));
t_7 = sqrt((1.0 + t));
tmp = 0.0;
if (t_5 <= 5e-6)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + (t_6 + (0.5 * sqrt((1.0 / t))));
elseif (t_5 <= 2.00005)
tmp = (t_1 + (1.0 / (sqrt(y) + t_2))) + (t_6 + (t_7 - sqrt(t)));
else
tmp = t_3 + (t_4 + (1.0 / (t_7 + 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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 + t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$5, 5e-6], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$6 + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2.00005], N[(N[(t$95$1 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$6 + N[(t$95$7 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(t$95$4 + N[(1.0 / N[(t$95$7 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
t_2 := \sqrt{1 + y}\\
t_3 := t\_1 + \left(t\_2 - \sqrt{y}\right)\\
t_4 := \sqrt{1 + z} - \sqrt{z}\\
t_5 := t\_3 + t\_4\\
t_6 := 0.5 \cdot \sqrt{\frac{1}{z}}\\
t_7 := \sqrt{1 + t}\\
\mathbf{if}\;t\_5 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(t\_6 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{elif}\;t\_5 \leq 2.00005:\\
\;\;\;\;\left(t\_1 + \frac{1}{\sqrt{y} + t\_2}\right) + \left(t\_6 + \left(t\_7 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(t\_4 + \frac{1}{t\_7 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 5.00000000000000041e-6Initial program 55.0%
associate-+l+55.0%
sub-neg55.0%
sub-neg55.0%
+-commutative55.0%
+-commutative55.0%
+-commutative55.0%
Simplified55.0%
Taylor expanded in x around inf 65.3%
Taylor expanded in y around inf 79.2%
Taylor expanded in t around inf 39.9%
Taylor expanded in z around inf 48.7%
if 5.00000000000000041e-6 < (+.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.0000499999999999Initial program 96.2%
associate-+l+96.2%
sub-neg96.2%
sub-neg96.2%
+-commutative96.2%
+-commutative96.2%
+-commutative96.2%
Simplified96.2%
flip--96.2%
div-inv96.2%
add-sqr-sqrt74.8%
add-sqr-sqrt96.6%
Applied egg-rr96.6%
associate-*r/96.6%
*-rgt-identity96.6%
associate--l+96.8%
+-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in z around inf 49.3%
if 2.0000499999999999 < (+.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 98.4%
associate-+l+98.4%
sub-neg98.4%
sub-neg98.4%
+-commutative98.4%
+-commutative98.4%
+-commutative98.4%
Simplified98.4%
flip--98.4%
div-inv98.4%
add-sqr-sqrt85.0%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate--l+99.7%
+-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification54.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_3 (sqrt (+ 1.0 y)))
(t_4 (+ (+ t_2 (- t_3 (sqrt y))) (- t_1 (sqrt z))))
(t_5 (* 0.5 (sqrt (/ 1.0 z))))
(t_6 (sqrt (+ 1.0 t))))
(if (<= t_4 5e-6)
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ t_5 (* 0.5 (sqrt (/ 1.0 t)))))
(if (<= t_4 2.00005)
(+ (+ t_2 (/ 1.0 (+ (sqrt y) t_3))) (+ t_5 (- t_6 (sqrt t))))
(-
(+ (+ 1.0 t_3) (+ t_1 (/ 1.0 (+ t_6 (sqrt t)))))
(+ (sqrt x) (+ (sqrt y) (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((x + 1.0)) - sqrt(x);
double t_3 = sqrt((1.0 + y));
double t_4 = (t_2 + (t_3 - sqrt(y))) + (t_1 - sqrt(z));
double t_5 = 0.5 * sqrt((1.0 / z));
double t_6 = sqrt((1.0 + t));
double tmp;
if (t_4 <= 5e-6) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + (t_5 + (0.5 * sqrt((1.0 / t))));
} else if (t_4 <= 2.00005) {
tmp = (t_2 + (1.0 / (sqrt(y) + t_3))) + (t_5 + (t_6 - sqrt(t)));
} else {
tmp = ((1.0 + t_3) + (t_1 + (1.0 / (t_6 + sqrt(t))))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((x + 1.0d0)) - sqrt(x)
t_3 = sqrt((1.0d0 + y))
t_4 = (t_2 + (t_3 - sqrt(y))) + (t_1 - sqrt(z))
t_5 = 0.5d0 * sqrt((1.0d0 / z))
t_6 = sqrt((1.0d0 + t))
if (t_4 <= 5d-6) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + (t_5 + (0.5d0 * sqrt((1.0d0 / t))))
else if (t_4 <= 2.00005d0) then
tmp = (t_2 + (1.0d0 / (sqrt(y) + t_3))) + (t_5 + (t_6 - sqrt(t)))
else
tmp = ((1.0d0 + t_3) + (t_1 + (1.0d0 / (t_6 + sqrt(t))))) - (sqrt(x) + (sqrt(y) + sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_3 = Math.sqrt((1.0 + y));
double t_4 = (t_2 + (t_3 - Math.sqrt(y))) + (t_1 - Math.sqrt(z));
double t_5 = 0.5 * Math.sqrt((1.0 / z));
double t_6 = Math.sqrt((1.0 + t));
double tmp;
if (t_4 <= 5e-6) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + (t_5 + (0.5 * Math.sqrt((1.0 / t))));
} else if (t_4 <= 2.00005) {
tmp = (t_2 + (1.0 / (Math.sqrt(y) + t_3))) + (t_5 + (t_6 - Math.sqrt(t)));
} else {
tmp = ((1.0 + t_3) + (t_1 + (1.0 / (t_6 + Math.sqrt(t))))) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((x + 1.0)) - math.sqrt(x) t_3 = math.sqrt((1.0 + y)) t_4 = (t_2 + (t_3 - math.sqrt(y))) + (t_1 - math.sqrt(z)) t_5 = 0.5 * math.sqrt((1.0 / z)) t_6 = math.sqrt((1.0 + t)) tmp = 0 if t_4 <= 5e-6: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + (t_5 + (0.5 * math.sqrt((1.0 / t)))) elif t_4 <= 2.00005: tmp = (t_2 + (1.0 / (math.sqrt(y) + t_3))) + (t_5 + (t_6 - math.sqrt(t))) else: tmp = ((1.0 + t_3) + (t_1 + (1.0 / (t_6 + math.sqrt(t))))) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_3 = sqrt(Float64(1.0 + y)) t_4 = Float64(Float64(t_2 + Float64(t_3 - sqrt(y))) + Float64(t_1 - sqrt(z))) t_5 = Float64(0.5 * sqrt(Float64(1.0 / z))) t_6 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_4 <= 5e-6) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(t_5 + Float64(0.5 * sqrt(Float64(1.0 / t))))); elseif (t_4 <= 2.00005) tmp = Float64(Float64(t_2 + Float64(1.0 / Float64(sqrt(y) + t_3))) + Float64(t_5 + Float64(t_6 - sqrt(t)))); else tmp = Float64(Float64(Float64(1.0 + t_3) + Float64(t_1 + Float64(1.0 / Float64(t_6 + sqrt(t))))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((x + 1.0)) - sqrt(x);
t_3 = sqrt((1.0 + y));
t_4 = (t_2 + (t_3 - sqrt(y))) + (t_1 - sqrt(z));
t_5 = 0.5 * sqrt((1.0 / z));
t_6 = sqrt((1.0 + t));
tmp = 0.0;
if (t_4 <= 5e-6)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + (t_5 + (0.5 * sqrt((1.0 / t))));
elseif (t_4 <= 2.00005)
tmp = (t_2 + (1.0 / (sqrt(y) + t_3))) + (t_5 + (t_6 - sqrt(t)));
else
tmp = ((1.0 + t_3) + (t_1 + (1.0 / (t_6 + sqrt(t))))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $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 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$2 + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$4, 5e-6], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2.00005], N[(N[(t$95$2 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 + N[(t$95$6 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$3), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(t$95$6 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{x + 1} - \sqrt{x}\\
t_3 := \sqrt{1 + y}\\
t_4 := \left(t\_2 + \left(t\_3 - \sqrt{y}\right)\right) + \left(t\_1 - \sqrt{z}\right)\\
t_5 := 0.5 \cdot \sqrt{\frac{1}{z}}\\
t_6 := \sqrt{1 + t}\\
\mathbf{if}\;t\_4 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(t\_5 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{elif}\;t\_4 \leq 2.00005:\\
\;\;\;\;\left(t\_2 + \frac{1}{\sqrt{y} + t\_3}\right) + \left(t\_5 + \left(t\_6 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t\_3\right) + \left(t\_1 + \frac{1}{t\_6 + \sqrt{t}}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\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))) < 5.00000000000000041e-6Initial program 55.0%
associate-+l+55.0%
sub-neg55.0%
sub-neg55.0%
+-commutative55.0%
+-commutative55.0%
+-commutative55.0%
Simplified55.0%
Taylor expanded in x around inf 65.3%
Taylor expanded in y around inf 79.2%
Taylor expanded in t around inf 39.9%
Taylor expanded in z around inf 48.7%
if 5.00000000000000041e-6 < (+.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.0000499999999999Initial program 96.2%
associate-+l+96.2%
sub-neg96.2%
sub-neg96.2%
+-commutative96.2%
+-commutative96.2%
+-commutative96.2%
Simplified96.2%
flip--96.2%
div-inv96.2%
add-sqr-sqrt74.8%
add-sqr-sqrt96.6%
Applied egg-rr96.6%
associate-*r/96.6%
*-rgt-identity96.6%
associate--l+96.8%
+-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in z around inf 49.3%
if 2.0000499999999999 < (+.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 98.4%
associate-+l+98.4%
sub-neg98.4%
sub-neg98.4%
+-commutative98.4%
+-commutative98.4%
+-commutative98.4%
Simplified98.4%
flip--98.4%
div-inv98.4%
add-sqr-sqrt85.0%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate--l+99.7%
+-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 94.7%
associate-+r+94.7%
+-commutative94.7%
Simplified94.7%
Final simplification54.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)) 0.0002)
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (* 0.5 (sqrt (/ 1.0 z))) (* 0.5 (sqrt (/ 1.0 t)))))
(+
(+ 1.0 (- (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y)))) (sqrt x)))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (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)) <= 0.0002) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
} else {
tmp = (1.0 + ((1.0 / (sqrt(y) + sqrt((1.0 + y)))) - sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) + (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)) <= 0.0002d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((0.5d0 * sqrt((1.0d0 / z))) + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = (1.0d0 + ((1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))) - sqrt(x))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (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)) <= 0.0002) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + ((0.5 * Math.sqrt((1.0 / z))) + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = (1.0 + ((1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)))) - Math.sqrt(x))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (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)) <= 0.0002: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + ((0.5 * math.sqrt((1.0 / z))) + (0.5 * math.sqrt((1.0 / t)))) else: tmp = (1.0 + ((1.0 / (math.sqrt(y) + math.sqrt((1.0 + y)))) - math.sqrt(x))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (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)) <= 0.0002) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(Float64(1.0 + Float64(Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))) - sqrt(x))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 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)) <= 0.0002)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
else
tmp = (1.0 + ((1.0 / (sqrt(y) + sqrt((1.0 + y)))) - sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) + (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], 0.0002], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $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], N[(N[(1.0 + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $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 0.0002:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{1}{\sqrt{y} + \sqrt{1 + y}} - \sqrt{x}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2.0000000000000001e-4Initial program 85.0%
associate-+l+85.0%
sub-neg85.0%
sub-neg85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
Taylor expanded in x around inf 88.9%
Taylor expanded in y around inf 48.2%
Taylor expanded in t around inf 28.6%
Taylor expanded in z around inf 17.5%
if 2.0000000000000001e-4 < (-.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.4%
div-inv97.4%
add-sqr-sqrt74.2%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
associate-*r/97.7%
*-rgt-identity97.7%
associate--l+98.0%
+-inverses98.0%
metadata-eval98.0%
Simplified98.0%
Taylor expanded in x around 0 96.6%
associate--l+96.6%
Simplified96.6%
Final simplification56.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 (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.0002)
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (* 0.5 (sqrt (/ 1.0 z))) (* 0.5 (sqrt (/ 1.0 t)))))
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ 1.0 z)) (sqrt z)))
(+ (- (sqrt (+ 1.0 y)) (sqrt y)) (- 1.0 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0002) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
} else {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z))) + ((sqrt((1.0 + y)) - sqrt(y)) + (1.0 - sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.0002d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((0.5d0 * sqrt((1.0d0 / z))) + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - sqrt(z))) + ((sqrt((1.0d0 + y)) - sqrt(y)) + (1.0d0 - sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.0002) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + ((0.5 * Math.sqrt((1.0 / z))) + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z))) + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + (1.0 - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.0002: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + ((0.5 * math.sqrt((1.0 / z))) + (0.5 * math.sqrt((1.0 / t)))) else: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) + ((math.sqrt((1.0 + y)) - math.sqrt(y)) + (1.0 - math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.0002) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + Float64(1.0 - sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0002)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
else
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z))) + ((sqrt((1.0 + y)) - sqrt(y)) + (1.0 - sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.0002], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $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], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $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 0.0002:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2.0000000000000001e-4Initial program 85.0%
associate-+l+85.0%
sub-neg85.0%
sub-neg85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
Taylor expanded in x around inf 88.9%
Taylor expanded in y around inf 48.2%
Taylor expanded in t around inf 28.6%
Taylor expanded in z around inf 17.5%
if 2.0000000000000001e-4 < (-.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 96.0%
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
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.0002)
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (* 0.5 (sqrt (/ 1.0 z))) (* 0.5 (sqrt (/ 1.0 t)))))
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y)))) (+ 1.0 (- (* 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)) <= 0.0002) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
} else {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt(y) + sqrt((1.0 + y)))) + (1.0 + ((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)) <= 0.0002d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((0.5d0 * sqrt((1.0d0 / z))) + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))) + (1.0d0 + ((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)) <= 0.0002) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + ((0.5 * Math.sqrt((1.0 / z))) + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)))) + (1.0 + ((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)) <= 0.0002: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + ((0.5 * math.sqrt((1.0 / z))) + (0.5 * math.sqrt((1.0 / t)))) else: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 / (math.sqrt(y) + math.sqrt((1.0 + y)))) + (1.0 + ((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)) <= 0.0002) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))) + Float64(1.0 + Float64(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)) <= 0.0002)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
else
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt(y) + sqrt((1.0 + y)))) + (1.0 + ((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], 0.0002], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $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], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $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 0.0002:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\frac{1}{\sqrt{y} + \sqrt{1 + y}} + \left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2.0000000000000001e-4Initial program 85.0%
associate-+l+85.0%
sub-neg85.0%
sub-neg85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
Taylor expanded in x around inf 88.9%
Taylor expanded in y around inf 48.2%
Taylor expanded in t around inf 28.6%
Taylor expanded in z around inf 17.5%
if 2.0000000000000001e-4 < (-.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.4%
div-inv97.4%
add-sqr-sqrt74.2%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
associate-*r/97.7%
*-rgt-identity97.7%
associate--l+98.0%
+-inverses98.0%
metadata-eval98.0%
Simplified98.0%
Taylor expanded in x around 0 97.2%
associate--l+97.2%
*-commutative97.2%
Simplified97.2%
Taylor expanded in t around inf 54.9%
Final simplification35.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= x 2.3e-162)
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) t_1)
(+ 1.0 (- (/ 1.0 (+ 1.0 (sqrt y))) (sqrt x))))
(if (<= x 21.0)
(+
t_1
(+
(/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y))))
(+ 1.0 (- (* x 0.5) (sqrt x)))))
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (* 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 t_1 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (x <= 2.3e-162) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (1.0 + ((1.0 / (1.0 + sqrt(y))) - sqrt(x)));
} else if (x <= 21.0) {
tmp = t_1 + ((1.0 / (sqrt(y) + sqrt((1.0 + y)))) + (1.0 + ((x * 0.5) - sqrt(x))));
} else {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
if (x <= 2.3d-162) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + t_1) + (1.0d0 + ((1.0d0 / (1.0d0 + sqrt(y))) - sqrt(x)))
else if (x <= 21.0d0) then
tmp = t_1 + ((1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))) + (1.0d0 + ((x * 0.5d0) - sqrt(x))))
else
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((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 t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (x <= 2.3e-162) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + t_1) + (1.0 + ((1.0 / (1.0 + Math.sqrt(y))) - Math.sqrt(x)));
} else if (x <= 21.0) {
tmp = t_1 + ((1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)))) + (1.0 + ((x * 0.5) - Math.sqrt(x))));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + ((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): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if x <= 2.3e-162: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + t_1) + (1.0 + ((1.0 / (1.0 + math.sqrt(y))) - math.sqrt(x))) elif x <= 21.0: tmp = t_1 + ((1.0 / (math.sqrt(y) + math.sqrt((1.0 + y)))) + (1.0 + ((x * 0.5) - math.sqrt(x)))) else: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + ((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) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (x <= 2.3e-162) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + t_1) + Float64(1.0 + Float64(Float64(1.0 / Float64(1.0 + sqrt(y))) - sqrt(x)))); elseif (x <= 21.0) tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))) + Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + 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)
t_1 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (x <= 2.3e-162)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (1.0 + ((1.0 / (1.0 + sqrt(y))) - sqrt(x)));
elseif (x <= 21.0)
tmp = t_1 + ((1.0 / (sqrt(y) + sqrt((1.0 + y)))) + (1.0 + ((x * 0.5) - sqrt(x))));
else
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((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_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.3e-162], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(1.0 + N[(N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 21.0], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $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}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;x \leq 2.3 \cdot 10^{-162}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + t\_1\right) + \left(1 + \left(\frac{1}{1 + \sqrt{y}} - \sqrt{x}\right)\right)\\
\mathbf{elif}\;x \leq 21:\\
\;\;\;\;t\_1 + \left(\frac{1}{\sqrt{y} + \sqrt{1 + y}} + \left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\end{array}
\end{array}
if x < 2.2999999999999998e-162Initial program 98.2%
associate-+l+98.2%
sub-neg98.2%
sub-neg98.2%
+-commutative98.2%
+-commutative98.2%
+-commutative98.2%
Simplified98.2%
flip--98.2%
div-inv98.2%
add-sqr-sqrt77.9%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in y around 0 96.0%
associate--l+96.0%
Simplified96.0%
Taylor expanded in x around 0 96.0%
associate--l+96.0%
Simplified96.0%
if 2.2999999999999998e-162 < x < 21Initial program 96.6%
associate-+l+96.6%
sub-neg96.6%
sub-neg96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
flip--96.5%
div-inv96.5%
add-sqr-sqrt69.9%
add-sqr-sqrt96.9%
Applied egg-rr96.9%
associate-*r/96.9%
*-rgt-identity96.9%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
Simplified97.5%
Taylor expanded in x around 0 97.2%
associate--l+97.2%
*-commutative97.2%
Simplified97.2%
Taylor expanded in t around inf 49.2%
if 21 < x Initial program 85.1%
associate-+l+85.1%
sub-neg85.1%
sub-neg85.1%
+-commutative85.1%
+-commutative85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in x around inf 88.6%
Taylor expanded in y around inf 47.9%
Taylor expanded in t around inf 28.4%
Taylor expanded in z around inf 17.4%
Final simplification44.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 (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.0002) (/ (+ (* (sqrt (/ 1.0 x)) -0.125) (* (sqrt x) 0.5)) x) (+ 1.0 (- (hypot 1.0 (sqrt 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)) <= 0.0002) {
tmp = ((sqrt((1.0 / x)) * -0.125) + (sqrt(x) * 0.5)) / x;
} else {
tmp = 1.0 + (hypot(1.0, sqrt(y)) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
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)) <= 0.0002) {
tmp = ((Math.sqrt((1.0 / x)) * -0.125) + (Math.sqrt(x) * 0.5)) / x;
} else {
tmp = 1.0 + (Math.hypot(1.0, Math.sqrt(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)) <= 0.0002: tmp = ((math.sqrt((1.0 / x)) * -0.125) + (math.sqrt(x) * 0.5)) / x else: tmp = 1.0 + (math.hypot(1.0, math.sqrt(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)) <= 0.0002) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / x)) * -0.125) + Float64(sqrt(x) * 0.5)) / x); else tmp = Float64(1.0 + Float64(hypot(1.0, sqrt(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)) <= 0.0002)
tmp = ((sqrt((1.0 / x)) * -0.125) + (sqrt(x) * 0.5)) / x;
else
tmp = 1.0 + (hypot(1.0, sqrt(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], 0.0002], N[(N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * -0.125), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(1.0 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $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}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.0002:\\
\;\;\;\;\frac{\sqrt{\frac{1}{x}} \cdot -0.125 + \sqrt{x} \cdot 0.5}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2.0000000000000001e-4Initial program 85.0%
associate-+l+85.0%
sub-neg85.0%
sub-neg85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
Taylor expanded in t around inf 5.8%
associate--l+7.9%
Simplified7.9%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.1%
if 2.0000000000000001e-4 < (-.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 t around inf 18.4%
associate--l+37.3%
Simplified37.3%
Taylor expanded in x around 0 17.6%
associate-+r+17.6%
Simplified17.6%
Taylor expanded in z around inf 19.2%
associate--l+34.6%
metadata-eval34.6%
rem-square-sqrt34.6%
hypot-undefine34.6%
Simplified34.6%
Final simplification21.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 (<= z 33000000.0)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
(sqrt (+ x 1.0))
(- (+ (* 0.5 (sqrt (/ 1.0 z))) (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 (z <= 33000000.0) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = sqrt((x + 1.0)) + (((0.5 * sqrt((1.0 / z))) + 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 (z <= 33000000.0d0) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = sqrt((x + 1.0d0)) + (((0.5d0 * sqrt((1.0d0 / z))) + 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 (z <= 33000000.0) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = Math.sqrt((x + 1.0)) + (((0.5 * Math.sqrt((1.0 / z))) + 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 z <= 33000000.0: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = math.sqrt((x + 1.0)) + (((0.5 * math.sqrt((1.0 / z))) + 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 (z <= 33000000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + 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 (z <= 33000000.0)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = sqrt((x + 1.0)) + (((0.5 * sqrt((1.0 / z))) + 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[z, 33000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 + y), $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}
\mathbf{if}\;z \leq 33000000:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(0.5 \cdot \sqrt{\frac{1}{z}} + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 3.3e7Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in t around inf 17.6%
associate--l+22.2%
Simplified22.2%
Taylor expanded in x around 0 14.2%
associate-+r+14.2%
Simplified14.2%
Taylor expanded in y around 0 13.1%
associate--l+13.1%
+-commutative13.1%
Simplified13.1%
if 3.3e7 < z Initial program 84.8%
associate-+l+84.8%
sub-neg84.8%
sub-neg84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
Simplified84.8%
Taylor expanded in t around inf 5.8%
associate--l+22.6%
Simplified22.6%
Taylor expanded in z around inf 31.3%
Final simplification21.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.0002) (/ (+ (* (sqrt (/ 1.0 x)) -0.125) (* (sqrt x) 0.5)) x) (+ 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)) <= 0.0002) {
tmp = ((sqrt((1.0 / x)) * -0.125) + (sqrt(x) * 0.5)) / x;
} else {
tmp = 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)) <= 0.0002d0) then
tmp = ((sqrt((1.0d0 / x)) * (-0.125d0)) + (sqrt(x) * 0.5d0)) / x
else
tmp = 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)) <= 0.0002) {
tmp = ((Math.sqrt((1.0 / x)) * -0.125) + (Math.sqrt(x) * 0.5)) / x;
} else {
tmp = 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)) <= 0.0002: tmp = ((math.sqrt((1.0 / x)) * -0.125) + (math.sqrt(x) * 0.5)) / x else: tmp = 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)) <= 0.0002) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / x)) * -0.125) + Float64(sqrt(x) * 0.5)) / x); else tmp = 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)) <= 0.0002)
tmp = ((sqrt((1.0 / x)) * -0.125) + (sqrt(x) * 0.5)) / x;
else
tmp = 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], 0.0002], N[(N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * -0.125), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.0002:\\
\;\;\;\;\frac{\sqrt{\frac{1}{x}} \cdot -0.125 + \sqrt{x} \cdot 0.5}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2.0000000000000001e-4Initial program 85.0%
associate-+l+85.0%
sub-neg85.0%
sub-neg85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
Taylor expanded in t around inf 5.8%
associate--l+7.9%
Simplified7.9%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.1%
if 2.0000000000000001e-4 < (-.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 t around inf 18.4%
associate--l+37.3%
Simplified37.3%
Taylor expanded in x around 0 17.6%
associate-+r+17.6%
Simplified17.6%
Taylor expanded in z around inf 19.2%
associate--l+34.6%
Simplified34.6%
Final simplification21.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 (<= z 33000000.0)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
1.0
(- (+ (* 0.5 (sqrt (/ 1.0 z))) (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 (z <= 33000000.0) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = 1.0 + (((0.5 * sqrt((1.0 / z))) + 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 (z <= 33000000.0d0) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = 1.0d0 + (((0.5d0 * sqrt((1.0d0 / z))) + 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 (z <= 33000000.0) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = 1.0 + (((0.5 * Math.sqrt((1.0 / z))) + 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 z <= 33000000.0: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = 1.0 + (((0.5 * math.sqrt((1.0 / z))) + 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 (z <= 33000000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(1.0 + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + 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 (z <= 33000000.0)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = 1.0 + (((0.5 * sqrt((1.0 / z))) + 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[z, 33000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 + y), $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}
\mathbf{if}\;z \leq 33000000:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(0.5 \cdot \sqrt{\frac{1}{z}} + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 3.3e7Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in t around inf 17.6%
associate--l+22.2%
Simplified22.2%
Taylor expanded in x around 0 14.2%
associate-+r+14.2%
Simplified14.2%
Taylor expanded in y around 0 13.1%
associate--l+13.1%
+-commutative13.1%
Simplified13.1%
if 3.3e7 < z Initial program 84.8%
associate-+l+84.8%
sub-neg84.8%
sub-neg84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
Simplified84.8%
Taylor expanded in t around inf 5.8%
associate--l+22.6%
Simplified22.6%
Taylor expanded in x around 0 4.7%
associate-+r+4.7%
Simplified4.7%
Taylor expanded in z around inf 16.1%
associate--l+34.9%
Simplified34.9%
Final simplification23.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 (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.0002) (/ (+ (* (sqrt (/ 1.0 x)) -0.125) (* (sqrt x) 0.5)) x) (+ 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 tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0002) {
tmp = ((sqrt((1.0 / x)) * -0.125) + (sqrt(x) * 0.5)) / x;
} else {
tmp = 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) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.0002d0) then
tmp = ((sqrt((1.0d0 / x)) * (-0.125d0)) + (sqrt(x) * 0.5d0)) / x
else
tmp = 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 tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.0002) {
tmp = ((Math.sqrt((1.0 / x)) * -0.125) + (Math.sqrt(x) * 0.5)) / x;
} else {
tmp = 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): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.0002: tmp = ((math.sqrt((1.0 / x)) * -0.125) + (math.sqrt(x) * 0.5)) / x else: tmp = 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) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.0002) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / x)) * -0.125) + Float64(sqrt(x) * 0.5)) / x); else tmp = 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)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0002)
tmp = ((sqrt((1.0 / x)) * -0.125) + (sqrt(x) * 0.5)) / x;
else
tmp = 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_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.0002], N[(N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * -0.125), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $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 0.0002:\\
\;\;\;\;\frac{\sqrt{\frac{1}{x}} \cdot -0.125 + \sqrt{x} \cdot 0.5}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2.0000000000000001e-4Initial program 85.0%
associate-+l+85.0%
sub-neg85.0%
sub-neg85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
Taylor expanded in t around inf 5.8%
associate--l+7.9%
Simplified7.9%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.1%
if 2.0000000000000001e-4 < (-.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 t around inf 18.4%
associate--l+37.3%
Simplified37.3%
Taylor expanded in x around 0 17.6%
associate-+r+17.6%
Simplified17.6%
Taylor expanded in z around inf 19.2%
associate--l+34.6%
Simplified34.6%
Taylor expanded in y around inf 34.8%
Final simplification21.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 2.3e+14) (+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))) (+ 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 tmp;
if (z <= 2.3e+14) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = 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) :: tmp
if (z <= 2.3d+14) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = 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 tmp;
if (z <= 2.3e+14) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = 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): tmp = 0 if z <= 2.3e+14: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = 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) tmp = 0.0 if (z <= 2.3e+14) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = 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)
tmp = 0.0;
if (z <= 2.3e+14)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = 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_] := If[LessEqual[z, 2.3e+14], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.3 \cdot 10^{+14}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 2.3e14Initial program 96.1%
associate-+l+96.1%
sub-neg96.1%
sub-neg96.1%
+-commutative96.1%
+-commutative96.1%
+-commutative96.1%
Simplified96.1%
Taylor expanded in t around inf 18.3%
associate--l+22.7%
Simplified22.7%
Taylor expanded in x around 0 15.0%
associate-+r+15.0%
Simplified15.0%
Taylor expanded in y around 0 13.8%
associate--l+13.8%
+-commutative13.8%
Simplified13.8%
if 2.3e14 < z Initial program 85.3%
associate-+l+85.3%
sub-neg85.3%
sub-neg85.3%
+-commutative85.3%
+-commutative85.3%
+-commutative85.3%
Simplified85.3%
Taylor expanded in t around inf 4.7%
associate--l+21.9%
Simplified21.9%
Taylor expanded in x around 0 3.6%
associate-+r+3.6%
Simplified3.6%
Taylor expanded in z around inf 14.7%
associate--l+33.9%
Simplified33.9%
Taylor expanded in y around inf 53.4%
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 (if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.0002) (* 0.5 (sqrt (/ 1.0 x))) (+ 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 tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0002) {
tmp = 0.5 * sqrt((1.0 / x));
} else {
tmp = 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) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.0002d0) then
tmp = 0.5d0 * sqrt((1.0d0 / x))
else
tmp = 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 tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.0002) {
tmp = 0.5 * Math.sqrt((1.0 / x));
} else {
tmp = 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): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.0002: tmp = 0.5 * math.sqrt((1.0 / x)) else: tmp = 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) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.0002) tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); else tmp = 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)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0002)
tmp = 0.5 * sqrt((1.0 / x));
else
tmp = 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_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.0002], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $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 0.0002:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2.0000000000000001e-4Initial program 85.0%
associate-+l+85.0%
sub-neg85.0%
sub-neg85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
Taylor expanded in t around inf 5.8%
associate--l+7.9%
Simplified7.9%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.1%
if 2.0000000000000001e-4 < (-.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 t around inf 18.4%
associate--l+37.3%
Simplified37.3%
Taylor expanded in x around 0 17.6%
associate-+r+17.6%
Simplified17.6%
Taylor expanded in z around inf 19.2%
associate--l+34.6%
Simplified34.6%
Taylor expanded in y around inf 34.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 (<= t_1 5e-6) (* 0.5 (sqrt (/ 1.0 x))) 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 (t_1 <= 5e-6) {
tmp = 0.5 * sqrt((1.0 / x));
} 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 (t_1 <= 5d-6) then
tmp = 0.5d0 * sqrt((1.0d0 / x))
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 (t_1 <= 5e-6) {
tmp = 0.5 * Math.sqrt((1.0 / x));
} 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 t_1 <= 5e-6: tmp = 0.5 * math.sqrt((1.0 / x)) 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 (t_1 <= 5e-6) tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); 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 (t_1 <= 5e-6)
tmp = 0.5 * sqrt((1.0 / x));
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[t$95$1, 5e-6], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $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}\;t\_1 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 5.00000000000000041e-6Initial program 85.2%
associate-+l+85.2%
sub-neg85.2%
sub-neg85.2%
+-commutative85.2%
+-commutative85.2%
+-commutative85.2%
Simplified85.2%
Taylor expanded in t around inf 5.9%
associate--l+7.8%
Simplified7.8%
Taylor expanded in x around inf 3.4%
mul-1-neg3.4%
Simplified3.4%
Taylor expanded in x around inf 9.1%
if 5.00000000000000041e-6 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in t around inf 18.2%
associate--l+37.1%
Simplified37.1%
Taylor expanded in x around inf 26.0%
mul-1-neg26.0%
Simplified26.0%
+-commutative26.0%
sub-neg26.0%
Applied egg-rr26.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 1.0) (- (- 2.0 (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 <= 1.0) {
tmp = (2.0 - 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 <= 1.0d0) then
tmp = (2.0d0 - 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 <= 1.0) {
tmp = (2.0 - 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 <= 1.0: tmp = (2.0 - 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 <= 1.0) tmp = Float64(Float64(2.0 - 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 <= 1.0)
tmp = (2.0 - 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, 1.0], N[(N[(2.0 - N[Sqrt[x], $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 1:\\
\;\;\;\;\left(2 - \sqrt{x}\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 1Initial 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 20.9%
associate--l+25.0%
Simplified25.0%
Taylor expanded in x around 0 16.9%
associate-+r+16.9%
Simplified16.9%
Taylor expanded in z around inf 17.8%
associate--l+17.8%
Simplified17.8%
Taylor expanded in y around 0 17.0%
associate--r+17.0%
Simplified17.0%
if 1 < y Initial program 86.1%
associate-+l+86.1%
sub-neg86.1%
sub-neg86.1%
+-commutative86.1%
+-commutative86.1%
+-commutative86.1%
Simplified86.1%
Taylor expanded in t around inf 4.0%
associate--l+20.0%
Simplified20.0%
Taylor expanded in x around inf 18.4%
mul-1-neg18.4%
Simplified18.4%
+-commutative18.4%
sub-neg18.4%
Applied egg-rr18.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 1.05) (- (+ 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 <= 1.05) {
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 <= 1.05d0) 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 <= 1.05) {
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 <= 1.05: 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 <= 1.05) tmp = Float64(Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * -0.125)))) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.05)
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, 1.05], N[(N[(1.0 + N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.05:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot -0.125\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.05000000000000004Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in t around inf 17.7%
associate--l+36.9%
Simplified36.9%
Taylor expanded in x around inf 26.2%
mul-1-neg26.2%
Simplified26.2%
Taylor expanded in x around 0 26.2%
if 1.05000000000000004 < x Initial program 85.1%
associate-+l+85.1%
sub-neg85.1%
sub-neg85.1%
+-commutative85.1%
+-commutative85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in t around inf 6.5%
associate--l+8.5%
Simplified8.5%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.1%
Final simplification17.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 0.7) (- (+ 1.0 (* x 0.5)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.7) {
tmp = (1.0 + (x * 0.5)) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 0.7d0) then
tmp = (1.0d0 + (x * 0.5d0)) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.7) {
tmp = (1.0 + (x * 0.5)) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.7: tmp = (1.0 + (x * 0.5)) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.7) tmp = Float64(Float64(1.0 + Float64(x * 0.5)) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 0.7)
tmp = (1.0 + (x * 0.5)) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.7], N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.69999999999999996Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in t around inf 17.7%
associate--l+36.9%
Simplified36.9%
Taylor expanded in x around inf 26.2%
mul-1-neg26.2%
Simplified26.2%
Taylor expanded in x around 0 26.2%
if 0.69999999999999996 < x Initial program 85.1%
associate-+l+85.1%
sub-neg85.1%
sub-neg85.1%
+-commutative85.1%
+-commutative85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in t around inf 6.5%
associate--l+8.5%
Simplified8.5%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.1%
Final simplification17.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.0) (+ 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 <= 1.0) {
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 <= 1.0d0) 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 <= 1.0) {
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 <= 1.0: 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 <= 1.0) 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 <= 1.0)
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, 1.0], 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 1:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in t around inf 17.7%
associate--l+36.9%
Simplified36.9%
Taylor expanded in x around inf 26.2%
mul-1-neg26.2%
Simplified26.2%
Taylor expanded in x around 0 26.2%
associate--l+26.2%
*-commutative26.2%
Simplified26.2%
if 1 < x Initial program 85.1%
associate-+l+85.1%
sub-neg85.1%
sub-neg85.1%
+-commutative85.1%
+-commutative85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in t around inf 6.5%
associate--l+8.5%
Simplified8.5%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.039) (- 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.039) {
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.039d0) 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.039) {
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.039: 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.039) 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.039)
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.039], 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.039:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.0389999999999999999Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in t around inf 17.7%
associate--l+36.9%
Simplified36.9%
Taylor expanded in x around inf 26.2%
mul-1-neg26.2%
Simplified26.2%
Taylor expanded in x around 0 26.2%
if 0.0389999999999999999 < x Initial program 85.1%
associate-+l+85.1%
sub-neg85.1%
sub-neg85.1%
+-commutative85.1%
+-commutative85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in t around inf 6.5%
associate--l+8.5%
Simplified8.5%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (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 12.0%
associate--l+22.4%
Simplified22.4%
Taylor expanded in x around inf 14.6%
mul-1-neg14.6%
Simplified14.6%
Taylor expanded in x around 0 13.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 91.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 12.0%
associate--l+22.4%
Simplified22.4%
Taylor expanded in x around inf 14.6%
mul-1-neg14.6%
Simplified14.6%
Taylor expanded in x around 0 13.5%
Taylor expanded in x around inf 1.6%
neg-mul-11.6%
Simplified1.6%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024165
(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))))