
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 25 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= (- t_1 (sqrt y)) 0.0)
(+
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (- t_2 (sqrt z)) t_3))
(+
(+ (- 1.0 (sqrt x)) (/ 1.0 (+ (sqrt y) t_1)))
(+ t_3 (/ 1.0 (+ t_2 (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if ((t_1 - sqrt(y)) <= 0.0) {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
} else {
tmp = ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + t_1))) + (t_3 + (1.0 / (t_2 + 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) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if ((t_1 - sqrt(y)) <= 0.0d0) then
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((t_2 - sqrt(z)) + t_3)
else
tmp = ((1.0d0 - sqrt(x)) + (1.0d0 / (sqrt(y) + t_1))) + (t_3 + (1.0d0 / (t_2 + 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((y + 1.0));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if ((t_1 - Math.sqrt(y)) <= 0.0) {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)))) + ((t_2 - Math.sqrt(z)) + t_3);
} else {
tmp = ((1.0 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + t_1))) + (t_3 + (1.0 / (t_2 + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if (t_1 - math.sqrt(y)) <= 0.0: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y)))) + ((t_2 - math.sqrt(z)) + t_3) else: tmp = ((1.0 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + t_1))) + (t_3 + (1.0 / (t_2 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (Float64(t_1 - sqrt(y)) <= 0.0) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(t_2 - sqrt(z)) + t_3)); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + t_1))) + Float64(t_3 + Float64(1.0 / Float64(t_2 + 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((y + 1.0));
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if ((t_1 - sqrt(y)) <= 0.0)
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
else
tmp = ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + t_1))) + (t_3 + (1.0 / (t_2 + 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[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_1 - \sqrt{y} \leq 0:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(\left(t\_2 - \sqrt{z}\right) + t\_3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + t\_1}\right) + \left(t\_3 + \frac{1}{t\_2 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 0.0Initial program 83.6%
associate-+l+83.6%
sub-neg83.6%
sub-neg83.6%
+-commutative83.6%
+-commutative83.6%
+-commutative83.6%
Simplified83.6%
flip--84.0%
div-inv84.0%
add-sqr-sqrt68.8%
+-commutative68.8%
add-sqr-sqrt84.6%
+-commutative84.6%
Applied egg-rr84.6%
associate--l+87.1%
+-inverses87.1%
metadata-eval87.1%
*-lft-identity87.1%
+-commutative87.1%
Simplified87.1%
Taylor expanded in y around inf 92.0%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) Initial program 96.3%
associate-+l+96.3%
sub-neg96.3%
sub-neg96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 50.9%
flip--50.9%
div-inv50.9%
add-sqr-sqrt38.7%
add-sqr-sqrt51.1%
associate--l+51.3%
Applied egg-rr51.3%
+-inverses51.3%
metadata-eval51.3%
*-lft-identity51.3%
+-commutative51.3%
Simplified51.3%
flip--51.5%
div-inv51.5%
add-sqr-sqrt51.4%
add-sqr-sqrt51.7%
associate--l+51.7%
Applied egg-rr51.7%
+-inverses51.7%
metadata-eval51.7%
*-lft-identity51.7%
+-commutative51.7%
Simplified51.7%
Final simplification69.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 (+ 1.0 x)) (sqrt x)) 0.2)
(+
(+
(* 0.5 (sqrt (/ 1.0 y)))
(/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x))
(* 0.5 (sqrt (/ 1.0 z))))
(+
(+ (- 1.0 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0)))))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 0.2) {
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
} else {
tmp = ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((1.0d0 + x)) - sqrt(x)) <= 0.2d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + ((((-0.125d0) * sqrt((1.0d0 / x))) + (sqrt(x) * 0.5d0)) / x)) + (0.5d0 * sqrt((1.0d0 / z)))
else
tmp = ((1.0d0 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0))))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((1.0 + x)) - Math.sqrt(x)) <= 0.2) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x)) + (0.5 * Math.sqrt((1.0 / z)));
} else {
tmp = ((1.0 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0))))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((1.0 + x)) - math.sqrt(x)) <= 0.2: tmp = ((0.5 * math.sqrt((1.0 / y))) + (((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x)) + (0.5 * math.sqrt((1.0 / z))) else: tmp = ((1.0 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0))))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) <= 0.2) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x)) + Float64(0.5 * sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0))))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 0.2)
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
else
tmp = ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.2], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{1 + x} - \sqrt{x} \leq 0.2:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.20000000000000001Initial program 83.7%
associate-+l+83.7%
sub-neg83.7%
sub-neg83.7%
+-commutative83.7%
+-commutative83.7%
+-commutative83.7%
Simplified83.7%
Taylor expanded in x around inf 87.6%
Taylor expanded in t around inf 43.2%
Taylor expanded in y around inf 23.1%
Taylor expanded in z around inf 17.3%
if 0.20000000000000001 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 94.5%
flip--94.5%
div-inv94.5%
add-sqr-sqrt72.8%
add-sqr-sqrt94.7%
associate--l+95.1%
Applied egg-rr95.1%
+-inverses95.1%
metadata-eval95.1%
*-lft-identity95.1%
+-commutative95.1%
Simplified95.1%
flip--95.3%
div-inv95.3%
add-sqr-sqrt75.1%
add-sqr-sqrt95.4%
associate--l+96.0%
Applied egg-rr96.0%
+-inverses96.0%
metadata-eval96.0%
*-lft-identity96.0%
+-commutative96.0%
Simplified96.0%
Final simplification59.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 (+ 1.0 x)) (sqrt x)) 0.2)
(+
(+
(* 0.5 (sqrt (/ 1.0 y)))
(/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x))
(* 0.5 (sqrt (/ 1.0 z))))
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 0.2) {
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
} else {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((1.0d0 + x)) - sqrt(x)) <= 0.2d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + ((((-0.125d0) * sqrt((1.0d0 / x))) + (sqrt(x) * 0.5d0)) / x)) + (0.5d0 * sqrt((1.0d0 / z)))
else
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((1.0 + x)) - Math.sqrt(x)) <= 0.2) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x)) + (0.5 * Math.sqrt((1.0 / z)));
} else {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((1.0 + x)) - math.sqrt(x)) <= 0.2: tmp = ((0.5 * math.sqrt((1.0 / y))) + (((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x)) + (0.5 * math.sqrt((1.0 / z))) else: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) <= 0.2) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x)) + Float64(0.5 * sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 0.2)
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
else
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.2], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{1 + x} - \sqrt{x} \leq 0.2:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.20000000000000001Initial program 83.7%
associate-+l+83.7%
sub-neg83.7%
sub-neg83.7%
+-commutative83.7%
+-commutative83.7%
+-commutative83.7%
Simplified83.7%
Taylor expanded in x around inf 87.6%
Taylor expanded in t around inf 43.2%
Taylor expanded in y around inf 23.1%
Taylor expanded in z around inf 17.3%
if 0.20000000000000001 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 94.5%
flip--94.5%
div-inv94.5%
add-sqr-sqrt72.8%
add-sqr-sqrt94.7%
associate--l+95.1%
Applied egg-rr95.1%
+-inverses95.1%
metadata-eval95.1%
*-lft-identity95.1%
+-commutative95.1%
Simplified95.1%
Final simplification58.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 (+ 1.0 x)) (sqrt x)) 0.2)
(+
(+
(* 0.5 (sqrt (/ 1.0 y)))
(/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x))
(* 0.5 (sqrt (/ 1.0 z))))
(+
(+ (- 1.0 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0)))))
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 0.2) {
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
} else {
tmp = ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((1.0d0 + x)) - sqrt(x)) <= 0.2d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + ((((-0.125d0) * sqrt((1.0d0 / x))) + (sqrt(x) * 0.5d0)) / x)) + (0.5d0 * sqrt((1.0d0 / z)))
else
tmp = ((1.0d0 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0))))) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((1.0 + x)) - Math.sqrt(x)) <= 0.2) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x)) + (0.5 * Math.sqrt((1.0 / z)));
} else {
tmp = ((1.0 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0))))) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((1.0 + x)) - math.sqrt(x)) <= 0.2: tmp = ((0.5 * math.sqrt((1.0 / y))) + (((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x)) + (0.5 * math.sqrt((1.0 / z))) else: tmp = ((1.0 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0))))) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) <= 0.2) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x)) + Float64(0.5 * sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0))))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 0.2)
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
else
tmp = ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.2], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / 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{1 + x} - \sqrt{x} \leq 0.2:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.20000000000000001Initial program 83.7%
associate-+l+83.7%
sub-neg83.7%
sub-neg83.7%
+-commutative83.7%
+-commutative83.7%
+-commutative83.7%
Simplified83.7%
Taylor expanded in x around inf 87.6%
Taylor expanded in t around inf 43.2%
Taylor expanded in y around inf 23.1%
Taylor expanded in z around inf 17.3%
if 0.20000000000000001 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 94.5%
flip--94.5%
div-inv94.5%
add-sqr-sqrt72.8%
add-sqr-sqrt94.7%
associate--l+95.1%
Applied egg-rr95.1%
+-inverses95.1%
metadata-eval95.1%
*-lft-identity95.1%
+-commutative95.1%
Simplified95.1%
flip--95.3%
div-inv95.3%
add-sqr-sqrt75.1%
add-sqr-sqrt95.4%
associate--l+96.0%
Applied egg-rr96.0%
+-inverses96.0%
metadata-eval96.0%
*-lft-identity96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in t around inf 55.1%
Final simplification37.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (- t_1 (sqrt z)))
(t_3 (- 1.0 (sqrt x)))
(t_4 (sqrt (+ y 1.0)))
(t_5 (- t_4 (sqrt y))))
(if (<= z 70.0)
(+ (+ t_3 t_5) (+ t_2 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(if (<= z 5e+117)
(+ (+ t_3 (/ 1.0 (+ (sqrt y) t_4))) (/ 1.0 (+ t_1 (sqrt z))))
(+ t_2 (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) t_5))))))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 = t_1 - sqrt(z);
double t_3 = 1.0 - sqrt(x);
double t_4 = sqrt((y + 1.0));
double t_5 = t_4 - sqrt(y);
double tmp;
if (z <= 70.0) {
tmp = (t_3 + t_5) + (t_2 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
} else if (z <= 5e+117) {
tmp = (t_3 + (1.0 / (sqrt(y) + t_4))) + (1.0 / (t_1 + sqrt(z)));
} else {
tmp = t_2 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + t_5);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = t_1 - sqrt(z)
t_3 = 1.0d0 - sqrt(x)
t_4 = sqrt((y + 1.0d0))
t_5 = t_4 - sqrt(y)
if (z <= 70.0d0) then
tmp = (t_3 + t_5) + (t_2 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
else if (z <= 5d+117) then
tmp = (t_3 + (1.0d0 / (sqrt(y) + t_4))) + (1.0d0 / (t_1 + sqrt(z)))
else
tmp = t_2 + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + t_5)
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 = t_1 - Math.sqrt(z);
double t_3 = 1.0 - Math.sqrt(x);
double t_4 = Math.sqrt((y + 1.0));
double t_5 = t_4 - Math.sqrt(y);
double tmp;
if (z <= 70.0) {
tmp = (t_3 + t_5) + (t_2 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
} else if (z <= 5e+117) {
tmp = (t_3 + (1.0 / (Math.sqrt(y) + t_4))) + (1.0 / (t_1 + Math.sqrt(z)));
} else {
tmp = t_2 + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + t_5);
}
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 = t_1 - math.sqrt(z) t_3 = 1.0 - math.sqrt(x) t_4 = math.sqrt((y + 1.0)) t_5 = t_4 - math.sqrt(y) tmp = 0 if z <= 70.0: tmp = (t_3 + t_5) + (t_2 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) elif z <= 5e+117: tmp = (t_3 + (1.0 / (math.sqrt(y) + t_4))) + (1.0 / (t_1 + math.sqrt(z))) else: tmp = t_2 + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + t_5) 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(t_1 - sqrt(z)) t_3 = Float64(1.0 - sqrt(x)) t_4 = sqrt(Float64(y + 1.0)) t_5 = Float64(t_4 - sqrt(y)) tmp = 0.0 if (z <= 70.0) tmp = Float64(Float64(t_3 + t_5) + Float64(t_2 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); elseif (z <= 5e+117) tmp = Float64(Float64(t_3 + Float64(1.0 / Float64(sqrt(y) + t_4))) + Float64(1.0 / Float64(t_1 + sqrt(z)))); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + t_5)); 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 = t_1 - sqrt(z);
t_3 = 1.0 - sqrt(x);
t_4 = sqrt((y + 1.0));
t_5 = t_4 - sqrt(y);
tmp = 0.0;
if (z <= 70.0)
tmp = (t_3 + t_5) + (t_2 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
elseif (z <= 5e+117)
tmp = (t_3 + (1.0 / (sqrt(y) + t_4))) + (1.0 / (t_1 + sqrt(z)));
else
tmp = t_2 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + t_5);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 70.0], N[(N[(t$95$3 + t$95$5), $MachinePrecision] + N[(t$95$2 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+117], N[(N[(t$95$3 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$5), $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 := t\_1 - \sqrt{z}\\
t_3 := 1 - \sqrt{x}\\
t_4 := \sqrt{y + 1}\\
t_5 := t\_4 - \sqrt{y}\\
\mathbf{if}\;z \leq 70:\\
\;\;\;\;\left(t\_3 + t\_5\right) + \left(t\_2 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+117}:\\
\;\;\;\;\left(t\_3 + \frac{1}{\sqrt{y} + t\_4}\right) + \frac{1}{t\_1 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + t\_5\right)\\
\end{array}
\end{array}
if z < 70Initial program 96.6%
associate-+l+96.6%
sub-neg96.6%
sub-neg96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 55.6%
flip--55.8%
div-inv55.8%
add-sqr-sqrt44.5%
+-commutative44.5%
add-sqr-sqrt55.9%
associate--l+55.9%
Applied egg-rr55.9%
associate-*r/55.9%
*-rgt-identity55.9%
associate-+r-55.9%
+-commutative55.9%
associate-+r-56.6%
+-inverses56.6%
metadata-eval56.6%
+-commutative56.6%
Simplified56.6%
if 70 < z < 4.99999999999999983e117Initial program 85.7%
associate-+l+85.7%
sub-neg85.7%
sub-neg85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
Simplified85.7%
Taylor expanded in x around 0 47.0%
flip--47.0%
div-inv47.0%
add-sqr-sqrt26.8%
add-sqr-sqrt47.7%
associate--l+48.8%
Applied egg-rr48.8%
+-inverses48.8%
metadata-eval48.8%
*-lft-identity48.8%
+-commutative48.8%
Simplified48.8%
flip--48.8%
div-inv48.8%
add-sqr-sqrt41.4%
add-sqr-sqrt49.2%
associate--l+49.2%
Applied egg-rr49.2%
+-inverses49.2%
metadata-eval49.2%
*-lft-identity49.2%
+-commutative49.2%
Simplified49.2%
Taylor expanded in t around inf 27.5%
if 4.99999999999999983e117 < z Initial program 84.0%
associate-+l+84.0%
sub-neg84.0%
sub-neg84.0%
+-commutative84.0%
+-commutative84.0%
+-commutative84.0%
Simplified84.0%
flip--84.4%
div-inv84.4%
add-sqr-sqrt64.7%
+-commutative64.7%
add-sqr-sqrt84.9%
+-commutative84.9%
Applied egg-rr84.9%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
*-lft-identity88.3%
+-commutative88.3%
Simplified88.3%
Taylor expanded in t around inf 39.7%
Final simplification45.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 (+ y 1.0)))
(t_2 (- 1.0 (sqrt x)))
(t_3 (sqrt (+ 1.0 z)))
(t_4 (- t_3 (sqrt z))))
(if (<= z 1.7e-12)
(+ (+ t_4 (- (sqrt (+ 1.0 t)) (sqrt t))) (+ t_2 (- 1.0 (sqrt y))))
(if (<= z 4.6e+117)
(+ (+ t_2 (/ 1.0 (+ (sqrt y) t_1))) (/ 1.0 (+ t_3 (sqrt z))))
(+ t_4 (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (- t_1 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = 1.0 - sqrt(x);
double t_3 = sqrt((1.0 + z));
double t_4 = t_3 - sqrt(z);
double tmp;
if (z <= 1.7e-12) {
tmp = (t_4 + (sqrt((1.0 + t)) - sqrt(t))) + (t_2 + (1.0 - sqrt(y)));
} else if (z <= 4.6e+117) {
tmp = (t_2 + (1.0 / (sqrt(y) + t_1))) + (1.0 / (t_3 + sqrt(z)));
} else {
tmp = t_4 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (t_1 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = 1.0d0 - sqrt(x)
t_3 = sqrt((1.0d0 + z))
t_4 = t_3 - sqrt(z)
if (z <= 1.7d-12) then
tmp = (t_4 + (sqrt((1.0d0 + t)) - sqrt(t))) + (t_2 + (1.0d0 - sqrt(y)))
else if (z <= 4.6d+117) then
tmp = (t_2 + (1.0d0 / (sqrt(y) + t_1))) + (1.0d0 / (t_3 + sqrt(z)))
else
tmp = t_4 + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (t_1 - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0));
double t_2 = 1.0 - Math.sqrt(x);
double t_3 = Math.sqrt((1.0 + z));
double t_4 = t_3 - Math.sqrt(z);
double tmp;
if (z <= 1.7e-12) {
tmp = (t_4 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (t_2 + (1.0 - Math.sqrt(y)));
} else if (z <= 4.6e+117) {
tmp = (t_2 + (1.0 / (Math.sqrt(y) + t_1))) + (1.0 / (t_3 + Math.sqrt(z)));
} else {
tmp = t_4 + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (t_1 - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = 1.0 - math.sqrt(x) t_3 = math.sqrt((1.0 + z)) t_4 = t_3 - math.sqrt(z) tmp = 0 if z <= 1.7e-12: tmp = (t_4 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (t_2 + (1.0 - math.sqrt(y))) elif z <= 4.6e+117: tmp = (t_2 + (1.0 / (math.sqrt(y) + t_1))) + (1.0 / (t_3 + math.sqrt(z))) else: tmp = t_4 + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (t_1 - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = Float64(1.0 - sqrt(x)) t_3 = sqrt(Float64(1.0 + z)) t_4 = Float64(t_3 - sqrt(z)) tmp = 0.0 if (z <= 1.7e-12) tmp = Float64(Float64(t_4 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(t_2 + Float64(1.0 - sqrt(y)))); elseif (z <= 4.6e+117) tmp = Float64(Float64(t_2 + Float64(1.0 / Float64(sqrt(y) + t_1))) + Float64(1.0 / Float64(t_3 + sqrt(z)))); else tmp = Float64(t_4 + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(t_1 - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
t_2 = 1.0 - sqrt(x);
t_3 = sqrt((1.0 + z));
t_4 = t_3 - sqrt(z);
tmp = 0.0;
if (z <= 1.7e-12)
tmp = (t_4 + (sqrt((1.0 + t)) - sqrt(t))) + (t_2 + (1.0 - sqrt(y)));
elseif (z <= 4.6e+117)
tmp = (t_2 + (1.0 / (sqrt(y) + t_1))) + (1.0 / (t_3 + sqrt(z)));
else
tmp = t_4 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (t_1 - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.7e-12], N[(N[(t$95$4 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e+117], N[(N[(t$95$2 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := 1 - \sqrt{x}\\
t_3 := \sqrt{1 + z}\\
t_4 := t\_3 - \sqrt{z}\\
\mathbf{if}\;z \leq 1.7 \cdot 10^{-12}:\\
\;\;\;\;\left(t\_4 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(t\_2 + \left(1 - \sqrt{y}\right)\right)\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+117}:\\
\;\;\;\;\left(t\_2 + \frac{1}{\sqrt{y} + t\_1}\right) + \frac{1}{t\_3 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_4 + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(t\_1 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1.7e-12Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 57.3%
Taylor expanded in y around 0 31.5%
if 1.7e-12 < z < 4.59999999999999976e117Initial program 86.8%
associate-+l+86.9%
sub-neg86.9%
sub-neg86.9%
+-commutative86.9%
+-commutative86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in x around 0 44.7%
flip--44.8%
div-inv44.8%
add-sqr-sqrt27.6%
add-sqr-sqrt45.3%
associate--l+46.2%
Applied egg-rr46.2%
+-inverses46.2%
metadata-eval46.2%
*-lft-identity46.2%
+-commutative46.2%
Simplified46.2%
flip--46.2%
div-inv46.2%
add-sqr-sqrt40.0%
add-sqr-sqrt46.5%
associate--l+46.5%
Applied egg-rr46.5%
+-inverses46.5%
metadata-eval46.5%
*-lft-identity46.5%
+-commutative46.5%
Simplified46.5%
Taylor expanded in t around inf 25.5%
if 4.59999999999999976e117 < z Initial program 84.0%
associate-+l+84.0%
sub-neg84.0%
sub-neg84.0%
+-commutative84.0%
+-commutative84.0%
+-commutative84.0%
Simplified84.0%
flip--84.4%
div-inv84.4%
add-sqr-sqrt64.7%
+-commutative64.7%
add-sqr-sqrt84.9%
+-commutative84.9%
Applied egg-rr84.9%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
*-lft-identity88.3%
+-commutative88.3%
Simplified88.3%
Taylor expanded in t around inf 39.7%
Final simplification32.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (sqrt x))) (t_2 (sqrt (+ 1.0 z))))
(if (<= z 1.7e-12)
(+
(+ (- t_2 (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ t_1 (- 1.0 (sqrt y))))
(+
(+ t_1 (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0)))))
(/ 1.0 (+ t_2 (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - sqrt(x);
double t_2 = sqrt((1.0 + z));
double tmp;
if (z <= 1.7e-12) {
tmp = ((t_2 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + (1.0 - sqrt(y)));
} else {
tmp = (t_1 + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) + (1.0 / (t_2 + 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) :: tmp
t_1 = 1.0d0 - sqrt(x)
t_2 = sqrt((1.0d0 + z))
if (z <= 1.7d-12) then
tmp = ((t_2 - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (t_1 + (1.0d0 - sqrt(y)))
else
tmp = (t_1 + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0))))) + (1.0d0 / (t_2 + 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 = 1.0 - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if (z <= 1.7e-12) {
tmp = ((t_2 - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (t_1 + (1.0 - Math.sqrt(y)));
} else {
tmp = (t_1 + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0))))) + (1.0 / (t_2 + Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 - math.sqrt(x) t_2 = math.sqrt((1.0 + z)) tmp = 0 if z <= 1.7e-12: tmp = ((t_2 - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (t_1 + (1.0 - math.sqrt(y))) else: tmp = (t_1 + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0))))) + (1.0 / (t_2 + math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - sqrt(x)) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (z <= 1.7e-12) tmp = Float64(Float64(Float64(t_2 - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(t_1 + Float64(1.0 - sqrt(y)))); else tmp = Float64(Float64(t_1 + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0))))) + Float64(1.0 / Float64(t_2 + 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 = 1.0 - sqrt(x);
t_2 = sqrt((1.0 + z));
tmp = 0.0;
if (z <= 1.7e-12)
tmp = ((t_2 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + (1.0 - sqrt(y)));
else
tmp = (t_1 + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) + (1.0 / (t_2 + 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[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.7e-12], N[(N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + 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 := 1 - \sqrt{x}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;z \leq 1.7 \cdot 10^{-12}:\\
\;\;\;\;\left(\left(t\_2 - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(t\_1 + \left(1 - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right) + \frac{1}{t\_2 + \sqrt{z}}\\
\end{array}
\end{array}
if z < 1.7e-12Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 57.3%
Taylor expanded in y around 0 31.5%
if 1.7e-12 < z Initial program 85.2%
associate-+l+85.2%
sub-neg85.2%
sub-neg85.2%
+-commutative85.2%
+-commutative85.2%
+-commutative85.2%
Simplified85.2%
Taylor expanded in x around 0 45.0%
flip--45.0%
div-inv45.0%
add-sqr-sqrt23.6%
add-sqr-sqrt45.2%
associate--l+45.7%
Applied egg-rr45.7%
+-inverses45.7%
metadata-eval45.7%
*-lft-identity45.7%
+-commutative45.7%
Simplified45.7%
flip--45.8%
div-inv45.8%
add-sqr-sqrt35.0%
add-sqr-sqrt46.0%
associate--l+46.1%
Applied egg-rr46.1%
+-inverses46.1%
metadata-eval46.1%
*-lft-identity46.1%
+-commutative46.1%
Simplified46.1%
Taylor expanded in t around inf 25.4%
Final simplification28.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 3.5)
(+
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))
(+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))))
(+
(+
(* 0.5 (sqrt (/ 1.0 y)))
(/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x))
(* 0.5 (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.5) {
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 3.5d0) then
tmp = (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y)))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + ((((-0.125d0) * sqrt((1.0d0 / x))) + (sqrt(x) * 0.5d0)) / x)) + (0.5d0 * sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.5) {
tmp = (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x)) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 3.5: tmp = (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x)) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 3.5) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x)) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 3.5)
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 3.5], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5:\\
\;\;\;\;\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if x < 3.5Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 94.5%
flip--94.5%
div-inv94.5%
add-sqr-sqrt72.8%
add-sqr-sqrt94.7%
associate--l+95.1%
Applied egg-rr95.1%
+-inverses95.1%
metadata-eval95.1%
*-lft-identity95.1%
+-commutative95.1%
Simplified95.1%
Taylor expanded in t around inf 54.6%
if 3.5 < x Initial program 83.7%
associate-+l+83.7%
sub-neg83.7%
sub-neg83.7%
+-commutative83.7%
+-commutative83.7%
+-commutative83.7%
Simplified83.7%
Taylor expanded in x around inf 87.6%
Taylor expanded in t around inf 43.2%
Taylor expanded in y around inf 23.1%
Taylor expanded in z around inf 17.3%
Final simplification37.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 4.0)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x)))))
(+
(+
(* 0.5 (sqrt (/ 1.0 y)))
(/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x))
(* 0.5 (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.0) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x))));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 4.0d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x))))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + ((((-0.125d0) * sqrt((1.0d0 / x))) + (sqrt(x) * 0.5d0)) / x)) + (0.5d0 * sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.0) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x))));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x)) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 4.0: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x)))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x)) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 4.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x))))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x)) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 4.0)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x))));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 4.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if x < 4Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 94.5%
Taylor expanded in t around inf 54.3%
Taylor expanded in x around 0 37.9%
associate--l+53.6%
Simplified53.6%
if 4 < x Initial program 83.7%
associate-+l+83.7%
sub-neg83.7%
sub-neg83.7%
+-commutative83.7%
+-commutative83.7%
+-commutative83.7%
Simplified83.7%
Taylor expanded in x around inf 87.6%
Taylor expanded in t around inf 43.2%
Taylor expanded in y around inf 23.1%
Taylor expanded in z around inf 17.3%
Final simplification36.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 (<= x 2.0)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))))
(+
(+
(* 0.5 (sqrt (/ 1.0 y)))
(/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x))
(* 0.5 (sqrt (/ 1.0 z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2.0) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y)))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + ((((-0.125d0) * sqrt((1.0d0 / x))) + (sqrt(x) * 0.5d0)) / x)) + (0.5d0 * sqrt((1.0d0 / z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2.0) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x)) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 2.0: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x)) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x)) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 2.0)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x)) + (0.5 * sqrt((1.0 / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 2.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if x < 2Initial program 96.8%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 95.0%
Taylor expanded in t around inf 54.6%
if 2 < x Initial program 83.8%
associate-+l+83.8%
sub-neg83.8%
sub-neg83.8%
+-commutative83.8%
+-commutative83.8%
+-commutative83.8%
Simplified83.8%
Taylor expanded in x around inf 87.2%
Taylor expanded in t around inf 43.0%
Taylor expanded in y around inf 22.9%
Taylor expanded in z around inf 17.2%
Final simplification36.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 2.65e-8)
(+
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))
(+ (- 1.0 (sqrt x)) (- (+ 1.0 (* y 0.5)) (sqrt y))))
(+
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (+ 1.0 (- (* x 0.5) (sqrt x))))
(* 0.5 (sqrt (/ 1.0 t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.65e-8) {
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + ((1.0 - sqrt(x)) + ((1.0 + (y * 0.5)) - sqrt(y)));
} else {
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 + ((x * 0.5) - sqrt(x)))) + (0.5 * sqrt((1.0 / t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.65d-8) then
tmp = (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + ((1.0d0 - sqrt(x)) + ((1.0d0 + (y * 0.5d0)) - sqrt(y)))
else
tmp = ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 + ((x * 0.5d0) - sqrt(x)))) + (0.5d0 * sqrt((1.0d0 / t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.65e-8) {
tmp = (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + ((1.0 - Math.sqrt(x)) + ((1.0 + (y * 0.5)) - Math.sqrt(y)));
} else {
tmp = ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 + ((x * 0.5) - Math.sqrt(x)))) + (0.5 * Math.sqrt((1.0 / t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.65e-8: tmp = (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + ((1.0 - math.sqrt(x)) + ((1.0 + (y * 0.5)) - math.sqrt(y))) else: tmp = ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 + ((x * 0.5) - math.sqrt(x)))) + (0.5 * math.sqrt((1.0 / t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.65e-8) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(Float64(1.0 - sqrt(x)) + Float64(Float64(1.0 + Float64(y * 0.5)) - sqrt(y)))); else tmp = Float64(Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x)))) + Float64(0.5 * sqrt(Float64(1.0 / t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.65e-8)
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + ((1.0 - sqrt(x)) + ((1.0 + (y * 0.5)) - sqrt(y)));
else
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 + ((x * 0.5) - sqrt(x)))) + (0.5 * sqrt((1.0 / t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.65e-8], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.65 \cdot 10^{-8}:\\
\;\;\;\;\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\left(1 - \sqrt{x}\right) + \left(\left(1 + y \cdot 0.5\right) - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right)\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\\
\end{array}
\end{array}
if y < 2.6499999999999999e-8Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in x around 0 50.9%
Taylor expanded in t around inf 30.8%
Taylor expanded in y around 0 30.8%
flip--50.9%
div-inv50.9%
add-sqr-sqrt39.8%
add-sqr-sqrt51.1%
associate--l+51.3%
Applied egg-rr31.1%
+-inverses51.3%
metadata-eval51.3%
*-lft-identity51.3%
+-commutative51.3%
Simplified31.1%
if 2.6499999999999999e-8 < y Initial program 83.8%
associate-+l+83.9%
sub-neg83.9%
sub-neg83.9%
+-commutative83.9%
+-commutative83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in t around inf 38.9%
Taylor expanded in x around 0 27.3%
associate--l+27.3%
Simplified27.3%
Taylor expanded in z around inf 16.3%
Final simplification24.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 (<= z 15000.0)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (- 2.0 (sqrt x)) (sqrt y)))
(+
(* 0.5 (sqrt (/ 1.0 z)))
(+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 15000.0) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((2.0 - sqrt(x)) - sqrt(y));
} else {
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 15000.0d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((2.0d0 - sqrt(x)) - sqrt(y))
else
tmp = (0.5d0 * sqrt((1.0d0 / z))) + ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 15000.0) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((2.0 - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = (0.5 * Math.sqrt((1.0 / z))) + ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 15000.0: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((2.0 - math.sqrt(x)) - math.sqrt(y)) else: tmp = (0.5 * math.sqrt((1.0 / z))) + ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 15000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(2.0 - sqrt(x)) - sqrt(y))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 15000.0)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((2.0 - sqrt(x)) - sqrt(y));
else
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 15000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 15000:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{z}} + \left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 15000Initial program 96.6%
associate-+l+96.6%
sub-neg96.6%
sub-neg96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 55.9%
Taylor expanded in t around inf 33.6%
Taylor expanded in y around 0 19.3%
associate--r+19.3%
Simplified19.3%
if 15000 < z Initial program 84.6%
associate-+l+84.6%
sub-neg84.6%
sub-neg84.6%
+-commutative84.6%
+-commutative84.6%
+-commutative84.6%
Simplified84.6%
Taylor expanded in x around 0 45.5%
Taylor expanded in t around inf 25.1%
Taylor expanded in z around inf 25.4%
Final simplification22.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 1.0)
(+ t_1 (- (- 2.0 (sqrt x)) (sqrt y)))
(+ t_1 (- 1.0 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (y <= 1.0) {
tmp = t_1 + ((2.0 - sqrt(x)) - sqrt(y));
} else {
tmp = t_1 + (1.0 - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
if (y <= 1.0d0) then
tmp = t_1 + ((2.0d0 - sqrt(x)) - sqrt(y))
else
tmp = t_1 + (1.0d0 - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (y <= 1.0) {
tmp = t_1 + ((2.0 - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = t_1 + (1.0 - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if y <= 1.0: tmp = t_1 + ((2.0 - math.sqrt(x)) - math.sqrt(y)) else: tmp = t_1 + (1.0 - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (y <= 1.0) tmp = Float64(t_1 + Float64(Float64(2.0 - sqrt(x)) - sqrt(y))); else tmp = Float64(t_1 + Float64(1.0 - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (y <= 1.0)
tmp = t_1 + ((2.0 - sqrt(x)) - sqrt(y));
else
tmp = t_1 + (1.0 - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.0], N[(t$95$1 + N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;y \leq 1:\\
\;\;\;\;t\_1 + \left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(1 - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 1Initial program 96.5%
associate-+l+96.6%
sub-neg96.6%
sub-neg96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 50.5%
Taylor expanded in t around inf 30.6%
Taylor expanded in y around 0 30.6%
associate--r+30.6%
Simplified30.6%
if 1 < y Initial program 83.9%
associate-+l+84.0%
sub-neg84.0%
sub-neg84.0%
+-commutative84.0%
+-commutative84.0%
+-commutative84.0%
Simplified84.0%
Taylor expanded in x around 0 51.1%
Taylor expanded in t around inf 28.1%
Taylor expanded in y around inf 27.3%
Final simplification29.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (sqrt x))) (t_2 (+ t_1 (- (+ 1.0 (* y 0.5)) (sqrt y)))))
(if (<= z 1.85)
(+ t_2 (- 1.0 (sqrt z)))
(if (or (<= z 1.62e+109)
(and (not (<= z 9.4e+145))
(or (<= z 1e+177) (not (<= z 3.5e+199)))))
(+ t_2 (* (sqrt (/ 1.0 z)) -0.5))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - sqrt(x);
double t_2 = t_1 + ((1.0 + (y * 0.5)) - sqrt(y));
double tmp;
if (z <= 1.85) {
tmp = t_2 + (1.0 - sqrt(z));
} else if ((z <= 1.62e+109) || (!(z <= 9.4e+145) && ((z <= 1e+177) || !(z <= 3.5e+199)))) {
tmp = t_2 + (sqrt((1.0 / z)) * -0.5);
} else {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 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) :: t_2
real(8) :: tmp
t_1 = 1.0d0 - sqrt(x)
t_2 = t_1 + ((1.0d0 + (y * 0.5d0)) - sqrt(y))
if (z <= 1.85d0) then
tmp = t_2 + (1.0d0 - sqrt(z))
else if ((z <= 1.62d+109) .or. (.not. (z <= 9.4d+145)) .and. (z <= 1d+177) .or. (.not. (z <= 3.5d+199))) then
tmp = t_2 + (sqrt((1.0d0 / z)) * (-0.5d0))
else
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 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 = 1.0 - Math.sqrt(x);
double t_2 = t_1 + ((1.0 + (y * 0.5)) - Math.sqrt(y));
double tmp;
if (z <= 1.85) {
tmp = t_2 + (1.0 - Math.sqrt(z));
} else if ((z <= 1.62e+109) || (!(z <= 9.4e+145) && ((z <= 1e+177) || !(z <= 3.5e+199)))) {
tmp = t_2 + (Math.sqrt((1.0 / z)) * -0.5);
} else {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 - math.sqrt(x) t_2 = t_1 + ((1.0 + (y * 0.5)) - math.sqrt(y)) tmp = 0 if z <= 1.85: tmp = t_2 + (1.0 - math.sqrt(z)) elif (z <= 1.62e+109) or (not (z <= 9.4e+145) and ((z <= 1e+177) or not (z <= 3.5e+199))): tmp = t_2 + (math.sqrt((1.0 / z)) * -0.5) else: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - sqrt(x)) t_2 = Float64(t_1 + Float64(Float64(1.0 + Float64(y * 0.5)) - sqrt(y))) tmp = 0.0 if (z <= 1.85) tmp = Float64(t_2 + Float64(1.0 - sqrt(z))); elseif ((z <= 1.62e+109) || (!(z <= 9.4e+145) && ((z <= 1e+177) || !(z <= 3.5e+199)))) tmp = Float64(t_2 + Float64(sqrt(Float64(1.0 / z)) * -0.5)); else tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 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 = 1.0 - sqrt(x);
t_2 = t_1 + ((1.0 + (y * 0.5)) - sqrt(y));
tmp = 0.0;
if (z <= 1.85)
tmp = t_2 + (1.0 - sqrt(z));
elseif ((z <= 1.62e+109) || (~((z <= 9.4e+145)) && ((z <= 1e+177) || ~((z <= 3.5e+199)))))
tmp = t_2 + (sqrt((1.0 / z)) * -0.5);
else
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 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[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.85], N[(t$95$2 + N[(1.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 1.62e+109], And[N[Not[LessEqual[z, 9.4e+145]], $MachinePrecision], Or[LessEqual[z, 1e+177], N[Not[LessEqual[z, 3.5e+199]], $MachinePrecision]]]], N[(t$95$2 + N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 1 - \sqrt{x}\\
t_2 := t\_1 + \left(\left(1 + y \cdot 0.5\right) - \sqrt{y}\right)\\
\mathbf{if}\;z \leq 1.85:\\
\;\;\;\;t\_2 + \left(1 - \sqrt{z}\right)\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{+109} \lor \neg \left(z \leq 9.4 \cdot 10^{+145}\right) \land \left(z \leq 10^{+177} \lor \neg \left(z \leq 3.5 \cdot 10^{+199}\right)\right):\\
\;\;\;\;t\_2 + \sqrt{\frac{1}{z}} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + t\_1\\
\end{array}
\end{array}
if z < 1.8500000000000001Initial program 96.7%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in x around 0 56.0%
Taylor expanded in t around inf 33.4%
Taylor expanded in y around 0 21.1%
Taylor expanded in z around 0 21.1%
if 1.8500000000000001 < z < 1.62e109 or 9.4000000000000004e145 < z < 1e177 or 3.49999999999999981e199 < z Initial 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 0 47.5%
Taylor expanded in t around inf 26.6%
Taylor expanded in y around 0 17.6%
Taylor expanded in z around -inf 17.4%
if 1.62e109 < z < 9.4000000000000004e145 or 1e177 < z < 3.49999999999999981e199Initial program 83.4%
associate-+l+83.4%
sub-neg83.4%
sub-neg83.4%
+-commutative83.4%
+-commutative83.4%
+-commutative83.4%
Simplified83.4%
Taylor expanded in x around 0 39.6%
Taylor expanded in t around inf 22.0%
Taylor expanded in y around inf 15.2%
Final simplification19.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (sqrt x)))
(t_2 (+ t_1 (- (+ 1.0 (* y 0.5)) (sqrt y))))
(t_3 (sqrt (/ 1.0 z))))
(if (<= z 0.43)
(+ t_2 (- 1.0 (sqrt z)))
(if (<= z 1.62e+109)
(+ (* 0.5 t_3) t_2)
(if (or (<= z 9e+146) (and (not (<= z 1e+177)) (<= z 3.5e+199)))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) t_1)
(+ t_2 (* t_3 -0.5)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - sqrt(x);
double t_2 = t_1 + ((1.0 + (y * 0.5)) - sqrt(y));
double t_3 = sqrt((1.0 / z));
double tmp;
if (z <= 0.43) {
tmp = t_2 + (1.0 - sqrt(z));
} else if (z <= 1.62e+109) {
tmp = (0.5 * t_3) + t_2;
} else if ((z <= 9e+146) || (!(z <= 1e+177) && (z <= 3.5e+199))) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + t_1;
} else {
tmp = t_2 + (t_3 * -0.5);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = 1.0d0 - sqrt(x)
t_2 = t_1 + ((1.0d0 + (y * 0.5d0)) - sqrt(y))
t_3 = sqrt((1.0d0 / z))
if (z <= 0.43d0) then
tmp = t_2 + (1.0d0 - sqrt(z))
else if (z <= 1.62d+109) then
tmp = (0.5d0 * t_3) + t_2
else if ((z <= 9d+146) .or. (.not. (z <= 1d+177)) .and. (z <= 3.5d+199)) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + t_1
else
tmp = t_2 + (t_3 * (-0.5d0))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - Math.sqrt(x);
double t_2 = t_1 + ((1.0 + (y * 0.5)) - Math.sqrt(y));
double t_3 = Math.sqrt((1.0 / z));
double tmp;
if (z <= 0.43) {
tmp = t_2 + (1.0 - Math.sqrt(z));
} else if (z <= 1.62e+109) {
tmp = (0.5 * t_3) + t_2;
} else if ((z <= 9e+146) || (!(z <= 1e+177) && (z <= 3.5e+199))) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + t_1;
} else {
tmp = t_2 + (t_3 * -0.5);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 - math.sqrt(x) t_2 = t_1 + ((1.0 + (y * 0.5)) - math.sqrt(y)) t_3 = math.sqrt((1.0 / z)) tmp = 0 if z <= 0.43: tmp = t_2 + (1.0 - math.sqrt(z)) elif z <= 1.62e+109: tmp = (0.5 * t_3) + t_2 elif (z <= 9e+146) or (not (z <= 1e+177) and (z <= 3.5e+199)): tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + t_1 else: tmp = t_2 + (t_3 * -0.5) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - sqrt(x)) t_2 = Float64(t_1 + Float64(Float64(1.0 + Float64(y * 0.5)) - sqrt(y))) t_3 = sqrt(Float64(1.0 / z)) tmp = 0.0 if (z <= 0.43) tmp = Float64(t_2 + Float64(1.0 - sqrt(z))); elseif (z <= 1.62e+109) tmp = Float64(Float64(0.5 * t_3) + t_2); elseif ((z <= 9e+146) || (!(z <= 1e+177) && (z <= 3.5e+199))) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + t_1); else tmp = Float64(t_2 + Float64(t_3 * -0.5)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 - sqrt(x);
t_2 = t_1 + ((1.0 + (y * 0.5)) - sqrt(y));
t_3 = sqrt((1.0 / z));
tmp = 0.0;
if (z <= 0.43)
tmp = t_2 + (1.0 - sqrt(z));
elseif (z <= 1.62e+109)
tmp = (0.5 * t_3) + t_2;
elseif ((z <= 9e+146) || (~((z <= 1e+177)) && (z <= 3.5e+199)))
tmp = (sqrt((1.0 + z)) - sqrt(z)) + t_1;
else
tmp = t_2 + (t_3 * -0.5);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.43], N[(t$95$2 + N[(1.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.62e+109], N[(N[(0.5 * t$95$3), $MachinePrecision] + t$95$2), $MachinePrecision], If[Or[LessEqual[z, 9e+146], And[N[Not[LessEqual[z, 1e+177]], $MachinePrecision], LessEqual[z, 3.5e+199]]], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$2 + N[(t$95$3 * -0.5), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 1 - \sqrt{x}\\
t_2 := t\_1 + \left(\left(1 + y \cdot 0.5\right) - \sqrt{y}\right)\\
t_3 := \sqrt{\frac{1}{z}}\\
\mathbf{if}\;z \leq 0.43:\\
\;\;\;\;t\_2 + \left(1 - \sqrt{z}\right)\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{+109}:\\
\;\;\;\;0.5 \cdot t\_3 + t\_2\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+146} \lor \neg \left(z \leq 10^{+177}\right) \land z \leq 3.5 \cdot 10^{+199}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2 + t\_3 \cdot -0.5\\
\end{array}
\end{array}
if z < 0.429999999999999993Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in x around 0 56.4%
Taylor expanded in t around inf 33.6%
Taylor expanded in y around 0 21.3%
Taylor expanded in z around 0 21.2%
if 0.429999999999999993 < z < 1.62e109Initial program 86.2%
associate-+l+86.2%
sub-neg86.2%
sub-neg86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in x around 0 48.8%
Taylor expanded in t around inf 28.7%
Taylor expanded in y around 0 21.4%
Taylor expanded in z around inf 22.2%
if 1.62e109 < z < 9.00000000000000051e146 or 1e177 < z < 3.49999999999999981e199Initial program 83.4%
associate-+l+83.4%
sub-neg83.4%
sub-neg83.4%
+-commutative83.4%
+-commutative83.4%
+-commutative83.4%
Simplified83.4%
Taylor expanded in x around 0 39.6%
Taylor expanded in t around inf 22.0%
Taylor expanded in y around inf 15.2%
if 9.00000000000000051e146 < z < 1e177 or 3.49999999999999981e199 < z Initial program 84.3%
associate-+l+84.3%
sub-neg84.3%
sub-neg84.3%
+-commutative84.3%
+-commutative84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in x around 0 45.4%
Taylor expanded in t around inf 24.5%
Taylor expanded in y around 0 14.0%
Taylor expanded in z around -inf 14.0%
Final simplification19.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (sqrt x)))
(t_2 (+ t_1 (- (+ 1.0 (* y 0.5)) (sqrt y))))
(t_3 (sqrt (/ 1.0 z))))
(if (<= z 1.0)
(+ t_2 (+ 1.0 (- (* 0.5 z) (sqrt z))))
(if (<= z 1.62e+109)
(+ (* 0.5 t_3) t_2)
(if (or (<= z 9.4e+145) (and (not (<= z 1e+177)) (<= z 3.5e+199)))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) t_1)
(+ t_2 (* t_3 -0.5)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - sqrt(x);
double t_2 = t_1 + ((1.0 + (y * 0.5)) - sqrt(y));
double t_3 = sqrt((1.0 / z));
double tmp;
if (z <= 1.0) {
tmp = t_2 + (1.0 + ((0.5 * z) - sqrt(z)));
} else if (z <= 1.62e+109) {
tmp = (0.5 * t_3) + t_2;
} else if ((z <= 9.4e+145) || (!(z <= 1e+177) && (z <= 3.5e+199))) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + t_1;
} else {
tmp = t_2 + (t_3 * -0.5);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = 1.0d0 - sqrt(x)
t_2 = t_1 + ((1.0d0 + (y * 0.5d0)) - sqrt(y))
t_3 = sqrt((1.0d0 / z))
if (z <= 1.0d0) then
tmp = t_2 + (1.0d0 + ((0.5d0 * z) - sqrt(z)))
else if (z <= 1.62d+109) then
tmp = (0.5d0 * t_3) + t_2
else if ((z <= 9.4d+145) .or. (.not. (z <= 1d+177)) .and. (z <= 3.5d+199)) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + t_1
else
tmp = t_2 + (t_3 * (-0.5d0))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - Math.sqrt(x);
double t_2 = t_1 + ((1.0 + (y * 0.5)) - Math.sqrt(y));
double t_3 = Math.sqrt((1.0 / z));
double tmp;
if (z <= 1.0) {
tmp = t_2 + (1.0 + ((0.5 * z) - Math.sqrt(z)));
} else if (z <= 1.62e+109) {
tmp = (0.5 * t_3) + t_2;
} else if ((z <= 9.4e+145) || (!(z <= 1e+177) && (z <= 3.5e+199))) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + t_1;
} else {
tmp = t_2 + (t_3 * -0.5);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 - math.sqrt(x) t_2 = t_1 + ((1.0 + (y * 0.5)) - math.sqrt(y)) t_3 = math.sqrt((1.0 / z)) tmp = 0 if z <= 1.0: tmp = t_2 + (1.0 + ((0.5 * z) - math.sqrt(z))) elif z <= 1.62e+109: tmp = (0.5 * t_3) + t_2 elif (z <= 9.4e+145) or (not (z <= 1e+177) and (z <= 3.5e+199)): tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + t_1 else: tmp = t_2 + (t_3 * -0.5) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - sqrt(x)) t_2 = Float64(t_1 + Float64(Float64(1.0 + Float64(y * 0.5)) - sqrt(y))) t_3 = sqrt(Float64(1.0 / z)) tmp = 0.0 if (z <= 1.0) tmp = Float64(t_2 + Float64(1.0 + Float64(Float64(0.5 * z) - sqrt(z)))); elseif (z <= 1.62e+109) tmp = Float64(Float64(0.5 * t_3) + t_2); elseif ((z <= 9.4e+145) || (!(z <= 1e+177) && (z <= 3.5e+199))) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + t_1); else tmp = Float64(t_2 + Float64(t_3 * -0.5)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 - sqrt(x);
t_2 = t_1 + ((1.0 + (y * 0.5)) - sqrt(y));
t_3 = sqrt((1.0 / z));
tmp = 0.0;
if (z <= 1.0)
tmp = t_2 + (1.0 + ((0.5 * z) - sqrt(z)));
elseif (z <= 1.62e+109)
tmp = (0.5 * t_3) + t_2;
elseif ((z <= 9.4e+145) || (~((z <= 1e+177)) && (z <= 3.5e+199)))
tmp = (sqrt((1.0 + z)) - sqrt(z)) + t_1;
else
tmp = t_2 + (t_3 * -0.5);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.0], N[(t$95$2 + N[(1.0 + N[(N[(0.5 * z), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.62e+109], N[(N[(0.5 * t$95$3), $MachinePrecision] + t$95$2), $MachinePrecision], If[Or[LessEqual[z, 9.4e+145], And[N[Not[LessEqual[z, 1e+177]], $MachinePrecision], LessEqual[z, 3.5e+199]]], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$2 + N[(t$95$3 * -0.5), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 1 - \sqrt{x}\\
t_2 := t\_1 + \left(\left(1 + y \cdot 0.5\right) - \sqrt{y}\right)\\
t_3 := \sqrt{\frac{1}{z}}\\
\mathbf{if}\;z \leq 1:\\
\;\;\;\;t\_2 + \left(1 + \left(0.5 \cdot z - \sqrt{z}\right)\right)\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{+109}:\\
\;\;\;\;0.5 \cdot t\_3 + t\_2\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{+145} \lor \neg \left(z \leq 10^{+177}\right) \land z \leq 3.5 \cdot 10^{+199}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2 + t\_3 \cdot -0.5\\
\end{array}
\end{array}
if z < 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 x around 0 56.4%
Taylor expanded in t around inf 33.6%
Taylor expanded in y around 0 21.3%
Taylor expanded in z around 0 21.3%
associate--l+21.3%
Simplified21.3%
if 1 < z < 1.62e109Initial program 86.2%
associate-+l+86.2%
sub-neg86.2%
sub-neg86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in x around 0 48.8%
Taylor expanded in t around inf 28.7%
Taylor expanded in y around 0 21.4%
Taylor expanded in z around inf 22.2%
if 1.62e109 < z < 9.4000000000000004e145 or 1e177 < z < 3.49999999999999981e199Initial program 83.4%
associate-+l+83.4%
sub-neg83.4%
sub-neg83.4%
+-commutative83.4%
+-commutative83.4%
+-commutative83.4%
Simplified83.4%
Taylor expanded in x around 0 39.6%
Taylor expanded in t around inf 22.0%
Taylor expanded in y around inf 15.2%
if 9.4000000000000004e145 < z < 1e177 or 3.49999999999999981e199 < z Initial program 84.3%
associate-+l+84.3%
sub-neg84.3%
sub-neg84.3%
+-commutative84.3%
+-commutative84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in x around 0 45.4%
Taylor expanded in t around inf 24.5%
Taylor expanded in y around 0 14.0%
Taylor expanded in z around -inf 14.0%
Final simplification19.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (/ 1.0 z)))
(t_2 (- 1.0 (sqrt x)))
(t_3 (+ t_2 (- (+ 1.0 (* y 0.5)) (sqrt y)))))
(if (<= z 1.2)
(+ t_3 (- (+ 1.0 (* z (+ 0.5 (* z -0.125)))) (sqrt z)))
(if (<= z 1.62e+109)
(+ (* 0.5 t_1) t_3)
(if (or (<= z 9.4e+145) (and (not (<= z 9.8e+176)) (<= z 3.5e+199)))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) t_2)
(+ t_3 (* t_1 -0.5)))))))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 = 1.0 - sqrt(x);
double t_3 = t_2 + ((1.0 + (y * 0.5)) - sqrt(y));
double tmp;
if (z <= 1.2) {
tmp = t_3 + ((1.0 + (z * (0.5 + (z * -0.125)))) - sqrt(z));
} else if (z <= 1.62e+109) {
tmp = (0.5 * t_1) + t_3;
} else if ((z <= 9.4e+145) || (!(z <= 9.8e+176) && (z <= 3.5e+199))) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + t_2;
} else {
tmp = t_3 + (t_1 * -0.5);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 / z))
t_2 = 1.0d0 - sqrt(x)
t_3 = t_2 + ((1.0d0 + (y * 0.5d0)) - sqrt(y))
if (z <= 1.2d0) then
tmp = t_3 + ((1.0d0 + (z * (0.5d0 + (z * (-0.125d0))))) - sqrt(z))
else if (z <= 1.62d+109) then
tmp = (0.5d0 * t_1) + t_3
else if ((z <= 9.4d+145) .or. (.not. (z <= 9.8d+176)) .and. (z <= 3.5d+199)) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + t_2
else
tmp = t_3 + (t_1 * (-0.5d0))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 / z));
double t_2 = 1.0 - Math.sqrt(x);
double t_3 = t_2 + ((1.0 + (y * 0.5)) - Math.sqrt(y));
double tmp;
if (z <= 1.2) {
tmp = t_3 + ((1.0 + (z * (0.5 + (z * -0.125)))) - Math.sqrt(z));
} else if (z <= 1.62e+109) {
tmp = (0.5 * t_1) + t_3;
} else if ((z <= 9.4e+145) || (!(z <= 9.8e+176) && (z <= 3.5e+199))) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + t_2;
} else {
tmp = t_3 + (t_1 * -0.5);
}
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 = 1.0 - math.sqrt(x) t_3 = t_2 + ((1.0 + (y * 0.5)) - math.sqrt(y)) tmp = 0 if z <= 1.2: tmp = t_3 + ((1.0 + (z * (0.5 + (z * -0.125)))) - math.sqrt(z)) elif z <= 1.62e+109: tmp = (0.5 * t_1) + t_3 elif (z <= 9.4e+145) or (not (z <= 9.8e+176) and (z <= 3.5e+199)): tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + t_2 else: tmp = t_3 + (t_1 * -0.5) 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(1.0 - sqrt(x)) t_3 = Float64(t_2 + Float64(Float64(1.0 + Float64(y * 0.5)) - sqrt(y))) tmp = 0.0 if (z <= 1.2) tmp = Float64(t_3 + Float64(Float64(1.0 + Float64(z * Float64(0.5 + Float64(z * -0.125)))) - sqrt(z))); elseif (z <= 1.62e+109) tmp = Float64(Float64(0.5 * t_1) + t_3); elseif ((z <= 9.4e+145) || (!(z <= 9.8e+176) && (z <= 3.5e+199))) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + t_2); else tmp = Float64(t_3 + Float64(t_1 * -0.5)); 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 = 1.0 - sqrt(x);
t_3 = t_2 + ((1.0 + (y * 0.5)) - sqrt(y));
tmp = 0.0;
if (z <= 1.2)
tmp = t_3 + ((1.0 + (z * (0.5 + (z * -0.125)))) - sqrt(z));
elseif (z <= 1.62e+109)
tmp = (0.5 * t_1) + t_3;
elseif ((z <= 9.4e+145) || (~((z <= 9.8e+176)) && (z <= 3.5e+199)))
tmp = (sqrt((1.0 + z)) - sqrt(z)) + t_2;
else
tmp = t_3 + (t_1 * -0.5);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 + N[(N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.2], N[(t$95$3 + N[(N[(1.0 + N[(z * N[(0.5 + N[(z * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.62e+109], N[(N[(0.5 * t$95$1), $MachinePrecision] + t$95$3), $MachinePrecision], If[Or[LessEqual[z, 9.4e+145], And[N[Not[LessEqual[z, 9.8e+176]], $MachinePrecision], LessEqual[z, 3.5e+199]]], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], N[(t$95$3 + N[(t$95$1 * -0.5), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{\frac{1}{z}}\\
t_2 := 1 - \sqrt{x}\\
t_3 := t\_2 + \left(\left(1 + y \cdot 0.5\right) - \sqrt{y}\right)\\
\mathbf{if}\;z \leq 1.2:\\
\;\;\;\;t\_3 + \left(\left(1 + z \cdot \left(0.5 + z \cdot -0.125\right)\right) - \sqrt{z}\right)\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{+109}:\\
\;\;\;\;0.5 \cdot t\_1 + t\_3\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{+145} \lor \neg \left(z \leq 9.8 \cdot 10^{+176}\right) \land z \leq 3.5 \cdot 10^{+199}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3 + t\_1 \cdot -0.5\\
\end{array}
\end{array}
if z < 1.19999999999999996Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in x around 0 56.4%
Taylor expanded in t around inf 33.6%
Taylor expanded in y around 0 21.3%
Taylor expanded in z around 0 21.3%
if 1.19999999999999996 < z < 1.62e109Initial program 86.2%
associate-+l+86.2%
sub-neg86.2%
sub-neg86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in x around 0 48.8%
Taylor expanded in t around inf 28.7%
Taylor expanded in y around 0 21.4%
Taylor expanded in z around inf 22.2%
if 1.62e109 < z < 9.4000000000000004e145 or 9.8e176 < z < 3.49999999999999981e199Initial program 83.4%
associate-+l+83.4%
sub-neg83.4%
sub-neg83.4%
+-commutative83.4%
+-commutative83.4%
+-commutative83.4%
Simplified83.4%
Taylor expanded in x around 0 39.6%
Taylor expanded in t around inf 22.0%
Taylor expanded in y around inf 15.2%
if 9.4000000000000004e145 < z < 9.8e176 or 3.49999999999999981e199 < z Initial program 84.3%
associate-+l+84.3%
sub-neg84.3%
sub-neg84.3%
+-commutative84.3%
+-commutative84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in x around 0 45.4%
Taylor expanded in t around inf 24.5%
Taylor expanded in y around 0 14.0%
Taylor expanded in z around -inf 14.0%
Final simplification19.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (/ 1.0 z)))
(t_2 (- 1.0 (sqrt x)))
(t_3 (+ t_2 (- (+ 1.0 (* y 0.5)) (sqrt y)))))
(if (<= z 1.3)
(+ t_3 (- (+ 1.0 (* z (+ 0.5 (* z (- (* z 0.0625) 0.125))))) (sqrt z)))
(if (<= z 1.62e+109)
(+ (* 0.5 t_1) t_3)
(if (or (<= z 9.4e+145) (and (not (<= z 1e+177)) (<= z 3.5e+199)))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) t_2)
(+ t_3 (* t_1 -0.5)))))))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 = 1.0 - sqrt(x);
double t_3 = t_2 + ((1.0 + (y * 0.5)) - sqrt(y));
double tmp;
if (z <= 1.3) {
tmp = t_3 + ((1.0 + (z * (0.5 + (z * ((z * 0.0625) - 0.125))))) - sqrt(z));
} else if (z <= 1.62e+109) {
tmp = (0.5 * t_1) + t_3;
} else if ((z <= 9.4e+145) || (!(z <= 1e+177) && (z <= 3.5e+199))) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + t_2;
} else {
tmp = t_3 + (t_1 * -0.5);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 / z))
t_2 = 1.0d0 - sqrt(x)
t_3 = t_2 + ((1.0d0 + (y * 0.5d0)) - sqrt(y))
if (z <= 1.3d0) then
tmp = t_3 + ((1.0d0 + (z * (0.5d0 + (z * ((z * 0.0625d0) - 0.125d0))))) - sqrt(z))
else if (z <= 1.62d+109) then
tmp = (0.5d0 * t_1) + t_3
else if ((z <= 9.4d+145) .or. (.not. (z <= 1d+177)) .and. (z <= 3.5d+199)) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + t_2
else
tmp = t_3 + (t_1 * (-0.5d0))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 / z));
double t_2 = 1.0 - Math.sqrt(x);
double t_3 = t_2 + ((1.0 + (y * 0.5)) - Math.sqrt(y));
double tmp;
if (z <= 1.3) {
tmp = t_3 + ((1.0 + (z * (0.5 + (z * ((z * 0.0625) - 0.125))))) - Math.sqrt(z));
} else if (z <= 1.62e+109) {
tmp = (0.5 * t_1) + t_3;
} else if ((z <= 9.4e+145) || (!(z <= 1e+177) && (z <= 3.5e+199))) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + t_2;
} else {
tmp = t_3 + (t_1 * -0.5);
}
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 = 1.0 - math.sqrt(x) t_3 = t_2 + ((1.0 + (y * 0.5)) - math.sqrt(y)) tmp = 0 if z <= 1.3: tmp = t_3 + ((1.0 + (z * (0.5 + (z * ((z * 0.0625) - 0.125))))) - math.sqrt(z)) elif z <= 1.62e+109: tmp = (0.5 * t_1) + t_3 elif (z <= 9.4e+145) or (not (z <= 1e+177) and (z <= 3.5e+199)): tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + t_2 else: tmp = t_3 + (t_1 * -0.5) 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(1.0 - sqrt(x)) t_3 = Float64(t_2 + Float64(Float64(1.0 + Float64(y * 0.5)) - sqrt(y))) tmp = 0.0 if (z <= 1.3) tmp = Float64(t_3 + Float64(Float64(1.0 + Float64(z * Float64(0.5 + Float64(z * Float64(Float64(z * 0.0625) - 0.125))))) - sqrt(z))); elseif (z <= 1.62e+109) tmp = Float64(Float64(0.5 * t_1) + t_3); elseif ((z <= 9.4e+145) || (!(z <= 1e+177) && (z <= 3.5e+199))) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + t_2); else tmp = Float64(t_3 + Float64(t_1 * -0.5)); 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 = 1.0 - sqrt(x);
t_3 = t_2 + ((1.0 + (y * 0.5)) - sqrt(y));
tmp = 0.0;
if (z <= 1.3)
tmp = t_3 + ((1.0 + (z * (0.5 + (z * ((z * 0.0625) - 0.125))))) - sqrt(z));
elseif (z <= 1.62e+109)
tmp = (0.5 * t_1) + t_3;
elseif ((z <= 9.4e+145) || (~((z <= 1e+177)) && (z <= 3.5e+199)))
tmp = (sqrt((1.0 + z)) - sqrt(z)) + t_2;
else
tmp = t_3 + (t_1 * -0.5);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 + N[(N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.3], N[(t$95$3 + N[(N[(1.0 + N[(z * N[(0.5 + N[(z * N[(N[(z * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.62e+109], N[(N[(0.5 * t$95$1), $MachinePrecision] + t$95$3), $MachinePrecision], If[Or[LessEqual[z, 9.4e+145], And[N[Not[LessEqual[z, 1e+177]], $MachinePrecision], LessEqual[z, 3.5e+199]]], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], N[(t$95$3 + N[(t$95$1 * -0.5), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{\frac{1}{z}}\\
t_2 := 1 - \sqrt{x}\\
t_3 := t\_2 + \left(\left(1 + y \cdot 0.5\right) - \sqrt{y}\right)\\
\mathbf{if}\;z \leq 1.3:\\
\;\;\;\;t\_3 + \left(\left(1 + z \cdot \left(0.5 + z \cdot \left(z \cdot 0.0625 - 0.125\right)\right)\right) - \sqrt{z}\right)\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{+109}:\\
\;\;\;\;0.5 \cdot t\_1 + t\_3\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{+145} \lor \neg \left(z \leq 10^{+177}\right) \land z \leq 3.5 \cdot 10^{+199}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3 + t\_1 \cdot -0.5\\
\end{array}
\end{array}
if z < 1.30000000000000004Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in x around 0 56.4%
Taylor expanded in t around inf 33.6%
Taylor expanded in y around 0 21.3%
Taylor expanded in z around 0 21.3%
if 1.30000000000000004 < z < 1.62e109Initial program 86.2%
associate-+l+86.2%
sub-neg86.2%
sub-neg86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in x around 0 48.8%
Taylor expanded in t around inf 28.7%
Taylor expanded in y around 0 21.4%
Taylor expanded in z around inf 22.2%
if 1.62e109 < z < 9.4000000000000004e145 or 1e177 < z < 3.49999999999999981e199Initial program 83.4%
associate-+l+83.4%
sub-neg83.4%
sub-neg83.4%
+-commutative83.4%
+-commutative83.4%
+-commutative83.4%
Simplified83.4%
Taylor expanded in x around 0 39.6%
Taylor expanded in t around inf 22.0%
Taylor expanded in y around inf 15.2%
if 9.4000000000000004e145 < z < 1e177 or 3.49999999999999981e199 < z Initial program 84.3%
associate-+l+84.3%
sub-neg84.3%
sub-neg84.3%
+-commutative84.3%
+-commutative84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in x around 0 45.4%
Taylor expanded in t around inf 24.5%
Taylor expanded in y around 0 14.0%
Taylor expanded in z around -inf 14.0%
Final simplification19.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (sqrt x))))
(if (<= z 1.56)
(+ (+ t_1 (- (+ 1.0 (* y 0.5)) (sqrt y))) (- 1.0 (sqrt z)))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) t_1))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - sqrt(x);
double tmp;
if (z <= 1.56) {
tmp = (t_1 + ((1.0 + (y * 0.5)) - sqrt(y))) + (1.0 - sqrt(z));
} else {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 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 = 1.0d0 - sqrt(x)
if (z <= 1.56d0) then
tmp = (t_1 + ((1.0d0 + (y * 0.5d0)) - sqrt(y))) + (1.0d0 - sqrt(z))
else
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 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 = 1.0 - Math.sqrt(x);
double tmp;
if (z <= 1.56) {
tmp = (t_1 + ((1.0 + (y * 0.5)) - Math.sqrt(y))) + (1.0 - Math.sqrt(z));
} else {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 - math.sqrt(x) tmp = 0 if z <= 1.56: tmp = (t_1 + ((1.0 + (y * 0.5)) - math.sqrt(y))) + (1.0 - math.sqrt(z)) else: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - sqrt(x)) tmp = 0.0 if (z <= 1.56) tmp = Float64(Float64(t_1 + Float64(Float64(1.0 + Float64(y * 0.5)) - sqrt(y))) + Float64(1.0 - sqrt(z))); else tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 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 = 1.0 - sqrt(x);
tmp = 0.0;
if (z <= 1.56)
tmp = (t_1 + ((1.0 + (y * 0.5)) - sqrt(y))) + (1.0 - sqrt(z));
else
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 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[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.56], N[(N[(t$95$1 + N[(N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 1 - \sqrt{x}\\
\mathbf{if}\;z \leq 1.56:\\
\;\;\;\;\left(t\_1 + \left(\left(1 + y \cdot 0.5\right) - \sqrt{y}\right)\right) + \left(1 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + t\_1\\
\end{array}
\end{array}
if z < 1.5600000000000001Initial program 96.7%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in x around 0 56.0%
Taylor expanded in t around inf 33.4%
Taylor expanded in y around 0 21.1%
Taylor expanded in z around 0 21.1%
if 1.5600000000000001 < z Initial program 84.6%
associate-+l+84.6%
sub-neg84.6%
sub-neg84.6%
+-commutative84.6%
+-commutative84.6%
+-commutative84.6%
Simplified84.6%
Taylor expanded in x around 0 45.6%
Taylor expanded in t around inf 25.5%
Taylor expanded in y around inf 15.9%
Final simplification18.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 (+ 1.0 z)) (sqrt z)) (- 1.0 (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (sqrt((1.0 + z)) - sqrt(z)) + (1.0 - sqrt(x));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 - sqrt(x))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 - Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 - math.sqrt(x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 - sqrt(x))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 - sqrt(x));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(1 - \sqrt{x}\right)
\end{array}
Initial program 90.7%
associate-+l+90.7%
sub-neg90.7%
sub-neg90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in x around 0 50.8%
Taylor expanded in t around inf 29.5%
Taylor expanded in y around inf 18.4%
Final simplification18.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (sqrt x) (- (sqrt (+ 1.0 z)) (sqrt z))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt(x) + (sqrt((1.0 + z)) - sqrt(z));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt(x) + (sqrt((1.0d0 + z)) - sqrt(z))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt(x) + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt(x) + (math.sqrt((1.0 + z)) - math.sqrt(z))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(x) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt(x) + (sqrt((1.0 + z)) - sqrt(z));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x} + \left(\sqrt{1 + z} - \sqrt{z}\right)
\end{array}
Initial program 90.7%
associate-+l+90.7%
sub-neg90.7%
sub-neg90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in x around 0 50.8%
Taylor expanded in t around inf 29.5%
Taylor expanded in x around inf 6.3%
mul-1-neg6.3%
Simplified6.3%
*-un-lft-identity6.3%
add-sqr-sqrt0.0%
sqrt-unprod10.2%
sqr-neg10.2%
add-sqr-sqrt10.2%
Applied egg-rr10.2%
Final simplification10.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 (<= z 0.0038) (- (- 1.0 (sqrt x)) (sqrt z)) (- (* 0.5 (sqrt (/ 1.0 z))) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.0038) {
tmp = (1.0 - sqrt(x)) - sqrt(z);
} else {
tmp = (0.5 * sqrt((1.0 / z))) - 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 (z <= 0.0038d0) then
tmp = (1.0d0 - sqrt(x)) - sqrt(z)
else
tmp = (0.5d0 * sqrt((1.0d0 / z))) - 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 (z <= 0.0038) {
tmp = (1.0 - Math.sqrt(x)) - Math.sqrt(z);
} else {
tmp = (0.5 * Math.sqrt((1.0 / z))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.0038: tmp = (1.0 - math.sqrt(x)) - math.sqrt(z) else: tmp = (0.5 * math.sqrt((1.0 / z))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.0038) tmp = Float64(Float64(1.0 - sqrt(x)) - sqrt(z)); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) - 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 (z <= 0.0038)
tmp = (1.0 - sqrt(x)) - sqrt(z);
else
tmp = (0.5 * sqrt((1.0 / z))) - 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[z, 0.0038], N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.0038:\\
\;\;\;\;\left(1 - \sqrt{x}\right) - \sqrt{z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{z}} - \sqrt{x}\\
\end{array}
\end{array}
if z < 0.00379999999999999999Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 56.9%
Taylor expanded in t around inf 33.9%
Taylor expanded in x around inf 11.0%
mul-1-neg11.0%
Simplified11.0%
Taylor expanded in z around 0 11.0%
associate--r+11.0%
Simplified11.0%
if 0.00379999999999999999 < z Initial program 84.7%
associate-+l+84.7%
sub-neg84.7%
sub-neg84.7%
+-commutative84.7%
+-commutative84.7%
+-commutative84.7%
Simplified84.7%
Taylor expanded in x around 0 44.9%
Taylor expanded in t around inf 25.2%
Taylor expanded in x around inf 1.7%
mul-1-neg1.7%
Simplified1.7%
Taylor expanded in z around inf 2.7%
Final simplification6.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (- (* 0.5 z) (+ (sqrt x) (sqrt z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((0.5 * z) - (sqrt(x) + sqrt(z)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 + ((0.5d0 * z) - (sqrt(x) + sqrt(z)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + ((0.5 * z) - (Math.sqrt(x) + Math.sqrt(z)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((0.5 * z) - (math.sqrt(x) + math.sqrt(z)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(0.5 * z) - Float64(sqrt(x) + sqrt(z)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((0.5 * z) - (sqrt(x) + sqrt(z)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(N[(0.5 * z), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(0.5 \cdot z - \left(\sqrt{x} + \sqrt{z}\right)\right)
\end{array}
Initial program 90.7%
associate-+l+90.7%
sub-neg90.7%
sub-neg90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in x around 0 50.8%
Taylor expanded in t around inf 29.5%
Taylor expanded in x around inf 6.3%
mul-1-neg6.3%
Simplified6.3%
Taylor expanded in z around 0 7.6%
associate--l+7.6%
Simplified7.6%
Final simplification7.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (- 1.0 (sqrt x)) (sqrt z)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 - sqrt(x)) - sqrt(z);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (1.0d0 - sqrt(x)) - sqrt(z)
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)) - Math.sqrt(z);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 - math.sqrt(x)) - math.sqrt(z)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 - sqrt(x)) - sqrt(z)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 - sqrt(x)) - sqrt(z);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(1 - \sqrt{x}\right) - \sqrt{z}
\end{array}
Initial program 90.7%
associate-+l+90.7%
sub-neg90.7%
sub-neg90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in x around 0 50.8%
Taylor expanded in t around inf 29.5%
Taylor expanded in x around inf 6.3%
mul-1-neg6.3%
Simplified6.3%
Taylor expanded in z around 0 6.1%
associate--r+6.1%
Simplified6.1%
Final simplification6.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 90.7%
associate-+l+90.7%
sub-neg90.7%
sub-neg90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in x around 0 50.8%
Taylor expanded in t around inf 29.5%
Taylor expanded in x around inf 6.3%
mul-1-neg6.3%
Simplified6.3%
Taylor expanded in x around inf 1.6%
mul-1-neg1.6%
Simplified1.6%
Final simplification1.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 2024080
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))