
(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 t)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (+ (sqrt x) t_3))
(t_5 (+ (sqrt y) t_1)))
(if (<= z 62000000.0)
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (+ (- t_1 (sqrt y)) (- t_3 (sqrt x))))
(/ (- (+ 1.0 t) t) (+ t_2 (sqrt t))))
(+
(- t_2 (sqrt t))
(+ (/ (+ t_5 t_4) (* t_5 t_4)) (* 0.5 (sqrt (/ 1.0 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 + t));
double t_3 = sqrt((1.0 + x));
double t_4 = sqrt(x) + t_3;
double t_5 = sqrt(y) + t_1;
double tmp;
if (z <= 62000000.0) {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + ((t_1 - sqrt(y)) + (t_3 - sqrt(x)))) + (((1.0 + t) - t) / (t_2 + sqrt(t)));
} else {
tmp = (t_2 - sqrt(t)) + (((t_5 + t_4) / (t_5 * t_4)) + (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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt((1.0d0 + t))
t_3 = sqrt((1.0d0 + x))
t_4 = sqrt(x) + t_3
t_5 = sqrt(y) + t_1
if (z <= 62000000.0d0) then
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + ((t_1 - sqrt(y)) + (t_3 - sqrt(x)))) + (((1.0d0 + t) - t) / (t_2 + sqrt(t)))
else
tmp = (t_2 - sqrt(t)) + (((t_5 + t_4) / (t_5 * t_4)) + (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 t_1 = Math.sqrt((y + 1.0));
double t_2 = Math.sqrt((1.0 + t));
double t_3 = Math.sqrt((1.0 + x));
double t_4 = Math.sqrt(x) + t_3;
double t_5 = Math.sqrt(y) + t_1;
double tmp;
if (z <= 62000000.0) {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((t_1 - Math.sqrt(y)) + (t_3 - Math.sqrt(x)))) + (((1.0 + t) - t) / (t_2 + Math.sqrt(t)));
} else {
tmp = (t_2 - Math.sqrt(t)) + (((t_5 + t_4) / (t_5 * t_4)) + (0.5 * Math.sqrt((1.0 / 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 + t)) t_3 = math.sqrt((1.0 + x)) t_4 = math.sqrt(x) + t_3 t_5 = math.sqrt(y) + t_1 tmp = 0 if z <= 62000000.0: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + ((t_1 - math.sqrt(y)) + (t_3 - math.sqrt(x)))) + (((1.0 + t) - t) / (t_2 + math.sqrt(t))) else: tmp = (t_2 - math.sqrt(t)) + (((t_5 + t_4) / (t_5 * t_4)) + (0.5 * math.sqrt((1.0 / 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 + t)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(sqrt(x) + t_3) t_5 = Float64(sqrt(y) + t_1) tmp = 0.0 if (z <= 62000000.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(t_1 - sqrt(y)) + Float64(t_3 - sqrt(x)))) + Float64(Float64(Float64(1.0 + t) - t) / Float64(t_2 + sqrt(t)))); else tmp = Float64(Float64(t_2 - sqrt(t)) + Float64(Float64(Float64(t_5 + t_4) / Float64(t_5 * t_4)) + 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)
t_1 = sqrt((y + 1.0));
t_2 = sqrt((1.0 + t));
t_3 = sqrt((1.0 + x));
t_4 = sqrt(x) + t_3;
t_5 = sqrt(y) + t_1;
tmp = 0.0;
if (z <= 62000000.0)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + ((t_1 - sqrt(y)) + (t_3 - sqrt(x)))) + (((1.0 + t) - t) / (t_2 + sqrt(t)));
else
tmp = (t_2 - sqrt(t)) + (((t_5 + t_4) / (t_5 * t_4)) + (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_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[z, 62000000.0], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t), $MachinePrecision] - t), $MachinePrecision] / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$5 + t$95$4), $MachinePrecision] / N[(t$95$5 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{1 + t}\\
t_3 := \sqrt{1 + x}\\
t_4 := \sqrt{x} + t\_3\\
t_5 := \sqrt{y} + t\_1\\
\mathbf{if}\;z \leq 62000000:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(t\_1 - \sqrt{y}\right) + \left(t\_3 - \sqrt{x}\right)\right)\right) + \frac{\left(1 + t\right) - t}{t\_2 + \sqrt{t}}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 - \sqrt{t}\right) + \left(\frac{t\_5 + t\_4}{t\_5 \cdot t\_4} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\\
\end{array}
\end{array}
if z < 6.2e7Initial program 96.8%
flip--96.8%
add-sqr-sqrt77.8%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
if 6.2e7 < z Initial program 83.8%
+-commutative83.8%
flip--83.8%
flip--84.0%
frac-add84.0%
Applied egg-rr84.1%
Simplified91.7%
Taylor expanded in z around inf 97.0%
Final simplification97.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (/ 1.0 (+ (sqrt z) t_2)))
(t_4 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_5 (sqrt (+ y 1.0)))
(t_6 (+ (sqrt y) t_5)))
(if (<=
(+ (- t_2 (sqrt z)) (+ (- t_5 (sqrt y)) (- t_1 (sqrt x))))
0.99999999999995)
(+ t_4 (+ t_3 (+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_1)))))
(+ t_4 (+ t_3 (/ (+ 1.0 (+ t_6 (sqrt x))) (* t_6 (+ 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 + x));
double t_2 = sqrt((1.0 + z));
double t_3 = 1.0 / (sqrt(z) + t_2);
double t_4 = sqrt((1.0 + t)) - sqrt(t);
double t_5 = sqrt((y + 1.0));
double t_6 = sqrt(y) + t_5;
double tmp;
if (((t_2 - sqrt(z)) + ((t_5 - sqrt(y)) + (t_1 - sqrt(x)))) <= 0.99999999999995) {
tmp = t_4 + (t_3 + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_1))));
} else {
tmp = t_4 + (t_3 + ((1.0 + (t_6 + sqrt(x))) / (t_6 * (1.0 + sqrt(x)))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + z))
t_3 = 1.0d0 / (sqrt(z) + t_2)
t_4 = sqrt((1.0d0 + t)) - sqrt(t)
t_5 = sqrt((y + 1.0d0))
t_6 = sqrt(y) + t_5
if (((t_2 - sqrt(z)) + ((t_5 - sqrt(y)) + (t_1 - sqrt(x)))) <= 0.99999999999995d0) then
tmp = t_4 + (t_3 + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_1))))
else
tmp = t_4 + (t_3 + ((1.0d0 + (t_6 + sqrt(x))) / (t_6 * (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 + x));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = 1.0 / (Math.sqrt(z) + t_2);
double t_4 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_5 = Math.sqrt((y + 1.0));
double t_6 = Math.sqrt(y) + t_5;
double tmp;
if (((t_2 - Math.sqrt(z)) + ((t_5 - Math.sqrt(y)) + (t_1 - Math.sqrt(x)))) <= 0.99999999999995) {
tmp = t_4 + (t_3 + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_1))));
} else {
tmp = t_4 + (t_3 + ((1.0 + (t_6 + Math.sqrt(x))) / (t_6 * (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 + x)) t_2 = math.sqrt((1.0 + z)) t_3 = 1.0 / (math.sqrt(z) + t_2) t_4 = math.sqrt((1.0 + t)) - math.sqrt(t) t_5 = math.sqrt((y + 1.0)) t_6 = math.sqrt(y) + t_5 tmp = 0 if ((t_2 - math.sqrt(z)) + ((t_5 - math.sqrt(y)) + (t_1 - math.sqrt(x)))) <= 0.99999999999995: tmp = t_4 + (t_3 + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_1)))) else: tmp = t_4 + (t_3 + ((1.0 + (t_6 + math.sqrt(x))) / (t_6 * (1.0 + math.sqrt(x))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(1.0 / Float64(sqrt(z) + t_2)) t_4 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_5 = sqrt(Float64(y + 1.0)) t_6 = Float64(sqrt(y) + t_5) tmp = 0.0 if (Float64(Float64(t_2 - sqrt(z)) + Float64(Float64(t_5 - sqrt(y)) + Float64(t_1 - sqrt(x)))) <= 0.99999999999995) tmp = Float64(t_4 + Float64(t_3 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_1))))); else tmp = Float64(t_4 + Float64(t_3 + Float64(Float64(1.0 + Float64(t_6 + sqrt(x))) / Float64(t_6 * 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 + x));
t_2 = sqrt((1.0 + z));
t_3 = 1.0 / (sqrt(z) + t_2);
t_4 = sqrt((1.0 + t)) - sqrt(t);
t_5 = sqrt((y + 1.0));
t_6 = sqrt(y) + t_5;
tmp = 0.0;
if (((t_2 - sqrt(z)) + ((t_5 - sqrt(y)) + (t_1 - sqrt(x)))) <= 0.99999999999995)
tmp = t_4 + (t_3 + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_1))));
else
tmp = t_4 + (t_3 + ((1.0 + (t_6 + sqrt(x))) / (t_6 * (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[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[Sqrt[y], $MachinePrecision] + t$95$5), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$5 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.99999999999995], N[(t$95$4 + N[(t$95$3 + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 + N[(t$95$3 + N[(N[(1.0 + N[(t$95$6 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$6 * N[(1.0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z}\\
t_3 := \frac{1}{\sqrt{z} + t\_2}\\
t_4 := \sqrt{1 + t} - \sqrt{t}\\
t_5 := \sqrt{y + 1}\\
t_6 := \sqrt{y} + t\_5\\
\mathbf{if}\;\left(t\_2 - \sqrt{z}\right) + \left(\left(t\_5 - \sqrt{y}\right) + \left(t\_1 - \sqrt{x}\right)\right) \leq 0.99999999999995:\\
\;\;\;\;t\_4 + \left(t\_3 + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4 + \left(t\_3 + \frac{1 + \left(t\_6 + \sqrt{x}\right)}{t\_6 \cdot \left(1 + \sqrt{x}\right)}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.99999999999995004Initial program 61.2%
+-commutative61.2%
flip--61.3%
flip--61.7%
frac-add61.7%
Applied egg-rr61.9%
Simplified80.2%
flip--84.6%
div-inv84.6%
add-sqr-sqrt50.6%
+-commutative50.6%
add-sqr-sqrt85.8%
+-commutative85.8%
Applied egg-rr85.8%
associate-*r/85.8%
*-rgt-identity85.8%
associate--l+94.5%
+-inverses94.5%
metadata-eval94.5%
+-commutative94.5%
Simplified94.5%
Taylor expanded in y around inf 92.7%
if 0.99999999999995004 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 97.2%
+-commutative97.2%
flip--97.3%
flip--97.4%
frac-add97.4%
Applied egg-rr97.9%
Simplified99.1%
flip--99.1%
div-inv99.1%
add-sqr-sqrt82.9%
+-commutative82.9%
add-sqr-sqrt99.1%
+-commutative99.1%
Applied egg-rr99.1%
associate-*r/99.1%
*-rgt-identity99.1%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 95.5%
*-commutative95.5%
Simplified95.5%
Final simplification95.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (+ (- (sqrt (+ y 1.0)) (sqrt y)) (- t_2 (sqrt x))))
(t_4 (sqrt (+ 1.0 z)))
(t_5 (/ 1.0 (+ (sqrt z) t_4))))
(if (<= (+ t_1 (+ (- t_4 (sqrt z)) t_3)) 1.0002)
(+ t_1 (+ t_5 (+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_2)))))
(+ t_1 (+ t_5 t_3)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + x));
double t_3 = (sqrt((y + 1.0)) - sqrt(y)) + (t_2 - sqrt(x));
double t_4 = sqrt((1.0 + z));
double t_5 = 1.0 / (sqrt(z) + t_4);
double tmp;
if ((t_1 + ((t_4 - sqrt(z)) + t_3)) <= 1.0002) {
tmp = t_1 + (t_5 + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))));
} else {
tmp = t_1 + (t_5 + t_3);
}
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 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + x))
t_3 = (sqrt((y + 1.0d0)) - sqrt(y)) + (t_2 - sqrt(x))
t_4 = sqrt((1.0d0 + z))
t_5 = 1.0d0 / (sqrt(z) + t_4)
if ((t_1 + ((t_4 - sqrt(z)) + t_3)) <= 1.0002d0) then
tmp = t_1 + (t_5 + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_2))))
else
tmp = t_1 + (t_5 + t_3)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + x));
double t_3 = (Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (t_2 - Math.sqrt(x));
double t_4 = Math.sqrt((1.0 + z));
double t_5 = 1.0 / (Math.sqrt(z) + t_4);
double tmp;
if ((t_1 + ((t_4 - Math.sqrt(z)) + t_3)) <= 1.0002) {
tmp = t_1 + (t_5 + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_2))));
} else {
tmp = t_1 + (t_5 + t_3);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + x)) t_3 = (math.sqrt((y + 1.0)) - math.sqrt(y)) + (t_2 - math.sqrt(x)) t_4 = math.sqrt((1.0 + z)) t_5 = 1.0 / (math.sqrt(z) + t_4) tmp = 0 if (t_1 + ((t_4 - math.sqrt(z)) + t_3)) <= 1.0002: tmp = t_1 + (t_5 + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_2)))) else: tmp = t_1 + (t_5 + t_3) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(t_2 - sqrt(x))) t_4 = sqrt(Float64(1.0 + z)) t_5 = Float64(1.0 / Float64(sqrt(z) + t_4)) tmp = 0.0 if (Float64(t_1 + Float64(Float64(t_4 - sqrt(z)) + t_3)) <= 1.0002) tmp = Float64(t_1 + Float64(t_5 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_2))))); else tmp = Float64(t_1 + Float64(t_5 + t_3)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
t_2 = sqrt((1.0 + x));
t_3 = (sqrt((y + 1.0)) - sqrt(y)) + (t_2 - sqrt(x));
t_4 = sqrt((1.0 + z));
t_5 = 1.0 / (sqrt(z) + t_4);
tmp = 0.0;
if ((t_1 + ((t_4 - sqrt(z)) + t_3)) <= 1.0002)
tmp = t_1 + (t_5 + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))));
else
tmp = t_1 + (t_5 + t_3);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 + N[(N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], 1.0002], N[(t$95$1 + N[(t$95$5 + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$5 + t$95$3), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + x}\\
t_3 := \left(\sqrt{y + 1} - \sqrt{y}\right) + \left(t\_2 - \sqrt{x}\right)\\
t_4 := \sqrt{1 + z}\\
t_5 := \frac{1}{\sqrt{z} + t\_4}\\
\mathbf{if}\;t\_1 + \left(\left(t\_4 - \sqrt{z}\right) + t\_3\right) \leq 1.0002:\\
\;\;\;\;t\_1 + \left(t\_5 + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_5 + t\_3\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 1.0002Initial program 75.3%
+-commutative75.3%
flip--75.3%
flip--75.5%
frac-add75.5%
Applied egg-rr76.0%
Simplified87.6%
flip--90.2%
div-inv90.2%
add-sqr-sqrt60.5%
+-commutative60.5%
add-sqr-sqrt91.0%
+-commutative91.0%
Applied egg-rr91.0%
associate-*r/91.0%
*-rgt-identity91.0%
associate--l+96.4%
+-inverses96.4%
metadata-eval96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in y around inf 80.7%
if 1.0002 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) Initial program 97.5%
flip--99.2%
div-inv99.2%
add-sqr-sqrt84.5%
+-commutative84.5%
add-sqr-sqrt99.2%
+-commutative99.2%
Applied egg-rr97.5%
associate-*r/99.2%
*-rgt-identity99.2%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified97.5%
Final simplification92.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- t_2 (sqrt z)))
(t_4 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_5 (- (sqrt (+ y 1.0)) (sqrt y))))
(if (<= (+ t_3 (+ t_5 (- t_1 (sqrt x)))) 1.0)
(+ t_4 (+ (/ 1.0 (+ (sqrt z) t_2)) (/ 1.0 (+ (sqrt x) t_1))))
(+ t_4 (+ t_3 (+ t_5 (- 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 + x));
double t_2 = sqrt((1.0 + z));
double t_3 = t_2 - sqrt(z);
double t_4 = sqrt((1.0 + t)) - sqrt(t);
double t_5 = sqrt((y + 1.0)) - sqrt(y);
double tmp;
if ((t_3 + (t_5 + (t_1 - sqrt(x)))) <= 1.0) {
tmp = t_4 + ((1.0 / (sqrt(z) + t_2)) + (1.0 / (sqrt(x) + t_1)));
} else {
tmp = t_4 + (t_3 + (t_5 + (1.0 - sqrt(x))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
t_4 = sqrt((1.0d0 + t)) - sqrt(t)
t_5 = sqrt((y + 1.0d0)) - sqrt(y)
if ((t_3 + (t_5 + (t_1 - sqrt(x)))) <= 1.0d0) then
tmp = t_4 + ((1.0d0 / (sqrt(z) + t_2)) + (1.0d0 / (sqrt(x) + t_1)))
else
tmp = t_4 + (t_3 + (t_5 + (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 + x));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = t_2 - Math.sqrt(z);
double t_4 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_5 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double tmp;
if ((t_3 + (t_5 + (t_1 - Math.sqrt(x)))) <= 1.0) {
tmp = t_4 + ((1.0 / (Math.sqrt(z) + t_2)) + (1.0 / (Math.sqrt(x) + t_1)));
} else {
tmp = t_4 + (t_3 + (t_5 + (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 + x)) t_2 = math.sqrt((1.0 + z)) t_3 = t_2 - math.sqrt(z) t_4 = math.sqrt((1.0 + t)) - math.sqrt(t) t_5 = math.sqrt((y + 1.0)) - math.sqrt(y) tmp = 0 if (t_3 + (t_5 + (t_1 - math.sqrt(x)))) <= 1.0: tmp = t_4 + ((1.0 / (math.sqrt(z) + t_2)) + (1.0 / (math.sqrt(x) + t_1))) else: tmp = t_4 + (t_3 + (t_5 + (1.0 - math.sqrt(x)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(t_2 - sqrt(z)) t_4 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_5 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) tmp = 0.0 if (Float64(t_3 + Float64(t_5 + Float64(t_1 - sqrt(x)))) <= 1.0) tmp = Float64(t_4 + Float64(Float64(1.0 / Float64(sqrt(z) + t_2)) + Float64(1.0 / Float64(sqrt(x) + t_1)))); else tmp = Float64(t_4 + Float64(t_3 + Float64(t_5 + 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 + x));
t_2 = sqrt((1.0 + z));
t_3 = t_2 - sqrt(z);
t_4 = sqrt((1.0 + t)) - sqrt(t);
t_5 = sqrt((y + 1.0)) - sqrt(y);
tmp = 0.0;
if ((t_3 + (t_5 + (t_1 - sqrt(x)))) <= 1.0)
tmp = t_4 + ((1.0 / (sqrt(z) + t_2)) + (1.0 / (sqrt(x) + t_1)));
else
tmp = t_4 + (t_3 + (t_5 + (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[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$3 + N[(t$95$5 + N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0], N[(t$95$4 + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 + N[(t$95$3 + N[(t$95$5 + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z}\\
t_3 := t\_2 - \sqrt{z}\\
t_4 := \sqrt{1 + t} - \sqrt{t}\\
t_5 := \sqrt{y + 1} - \sqrt{y}\\
\mathbf{if}\;t\_3 + \left(t\_5 + \left(t\_1 - \sqrt{x}\right)\right) \leq 1:\\
\;\;\;\;t\_4 + \left(\frac{1}{\sqrt{z} + t\_2} + \frac{1}{\sqrt{x} + t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4 + \left(t\_3 + \left(t\_5 + \left(1 - \sqrt{x}\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1Initial program 83.0%
+-commutative83.0%
flip--83.0%
flip--83.2%
frac-add83.2%
Applied egg-rr83.3%
Simplified91.4%
flip--93.1%
div-inv93.1%
add-sqr-sqrt63.6%
+-commutative63.6%
add-sqr-sqrt93.6%
+-commutative93.6%
Applied egg-rr93.6%
associate-*r/93.6%
*-rgt-identity93.6%
associate--l+97.3%
+-inverses97.3%
metadata-eval97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in y around inf 70.1%
+-commutative70.1%
Simplified70.1%
if 1 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 97.1%
Taylor expanded in x around 0 70.9%
Final simplification70.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt y) (sqrt (+ y 1.0))))
(t_2 (+ (sqrt x) (sqrt (+ 1.0 x)))))
(+
(+ (/ (+ t_1 t_2) (* t_1 t_2)) (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))))
(- (sqrt (+ 1.0 t)) (sqrt t)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(y) + sqrt((y + 1.0));
double t_2 = sqrt(x) + sqrt((1.0 + x));
return (((t_1 + t_2) / (t_1 * t_2)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) + (sqrt((1.0 + t)) - sqrt(t));
}
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
t_1 = sqrt(y) + sqrt((y + 1.0d0))
t_2 = sqrt(x) + sqrt((1.0d0 + x))
code = (((t_1 + t_2) / (t_1 * t_2)) + (1.0d0 / (sqrt(z) + sqrt((1.0d0 + z))))) + (sqrt((1.0d0 + t)) - sqrt(t))
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) + Math.sqrt((y + 1.0));
double t_2 = Math.sqrt(x) + Math.sqrt((1.0 + x));
return (((t_1 + t_2) / (t_1 * t_2)) + (1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z))))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(y) + math.sqrt((y + 1.0)) t_2 = math.sqrt(x) + math.sqrt((1.0 + x)) return (((t_1 + t_2) / (t_1 * t_2)) + (1.0 / (math.sqrt(z) + math.sqrt((1.0 + z))))) + (math.sqrt((1.0 + t)) - math.sqrt(t))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(y) + sqrt(Float64(y + 1.0))) t_2 = Float64(sqrt(x) + sqrt(Float64(1.0 + x))) return Float64(Float64(Float64(Float64(t_1 + t_2) / Float64(t_1 * t_2)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z))))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
t_1 = sqrt(y) + sqrt((y + 1.0));
t_2 = sqrt(x) + sqrt((1.0 + x));
tmp = (((t_1 + t_2) / (t_1 * t_2)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) + (sqrt((1.0 + t)) - sqrt(t));
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[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(t$95$1 + t$95$2), $MachinePrecision] / N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y} + \sqrt{y + 1}\\
t_2 := \sqrt{x} + \sqrt{1 + x}\\
\left(\frac{t\_1 + t\_2}{t\_1 \cdot t\_2} + \frac{1}{\sqrt{z} + \sqrt{1 + z}}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)
\end{array}
\end{array}
Initial program 90.5%
+-commutative90.5%
flip--90.5%
flip--90.7%
frac-add90.7%
Applied egg-rr91.1%
Simplified95.5%
flip--96.4%
div-inv96.4%
add-sqr-sqrt76.9%
+-commutative76.9%
add-sqr-sqrt96.6%
+-commutative96.6%
Applied egg-rr96.6%
associate-*r/96.6%
*-rgt-identity96.6%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
+-commutative98.3%
Simplified98.3%
Final simplification98.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 x) (sqrt (+ 1.0 x))))
(t_2 (+ (sqrt y) (sqrt (+ y 1.0)))))
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+ (/ (+ t_2 t_1) (* t_2 t_1)) (- (sqrt (+ 1.0 z)) (sqrt z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt((1.0 + x));
double t_2 = sqrt(y) + sqrt((y + 1.0));
return (sqrt((1.0 + t)) - sqrt(t)) + (((t_2 + t_1) / (t_2 * t_1)) + (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
real(8) :: t_1
real(8) :: t_2
t_1 = sqrt(x) + sqrt((1.0d0 + x))
t_2 = sqrt(y) + sqrt((y + 1.0d0))
code = (sqrt((1.0d0 + t)) - sqrt(t)) + (((t_2 + t_1) / (t_2 * t_1)) + (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) {
double t_1 = Math.sqrt(x) + Math.sqrt((1.0 + x));
double t_2 = Math.sqrt(y) + Math.sqrt((y + 1.0));
return (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((t_2 + t_1) / (t_2 * t_1)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt((1.0 + x)) t_2 = math.sqrt(y) + math.sqrt((y + 1.0)) return (math.sqrt((1.0 + t)) - math.sqrt(t)) + (((t_2 + t_1) / (t_2 * t_1)) + (math.sqrt((1.0 + z)) - math.sqrt(z)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(Float64(1.0 + x))) t_2 = Float64(sqrt(y) + sqrt(Float64(y + 1.0))) return Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(t_2 + t_1) / Float64(t_2 * t_1)) + 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)
t_1 = sqrt(x) + sqrt((1.0 + x));
t_2 = sqrt(y) + sqrt((y + 1.0));
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (((t_2 + t_1) / (t_2 * t_1)) + (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_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$2 + t$95$1), $MachinePrecision] / N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{1 + x}\\
t_2 := \sqrt{y} + \sqrt{y + 1}\\
\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\frac{t\_2 + t\_1}{t\_2 \cdot t\_1} + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)
\end{array}
\end{array}
Initial program 90.5%
+-commutative90.5%
flip--90.5%
flip--90.7%
frac-add90.7%
Applied egg-rr91.1%
Simplified95.5%
Final simplification95.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_1 2e-7)
(+
t_3
(+
(/ 1.0 (+ (sqrt z) t_2))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))))
(+ t_3 (+ (- t_2 (sqrt z)) (+ t_1 (- 1.0 (sqrt x))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_1 <= 2e-7) {
tmp = t_3 + ((1.0 / (sqrt(z) + t_2)) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))));
} else {
tmp = t_3 + ((t_2 - sqrt(z)) + (t_1 + (1.0 - sqrt(x))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_1 <= 2d-7) then
tmp = t_3 + ((1.0d0 / (sqrt(z) + t_2)) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x))))))
else
tmp = t_3 + ((t_2 - sqrt(z)) + (t_1 + (1.0d0 - sqrt(x))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_1 <= 2e-7) {
tmp = t_3 + ((1.0 / (Math.sqrt(z) + t_2)) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x))))));
} else {
tmp = t_3 + ((t_2 - Math.sqrt(z)) + (t_1 + (1.0 - Math.sqrt(x))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_1 <= 2e-7: tmp = t_3 + ((1.0 / (math.sqrt(z) + t_2)) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))))) else: tmp = t_3 + ((t_2 - math.sqrt(z)) + (t_1 + (1.0 - math.sqrt(x)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_1 <= 2e-7) tmp = Float64(t_3 + Float64(Float64(1.0 / Float64(sqrt(z) + t_2)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x))))))); else tmp = Float64(t_3 + Float64(Float64(t_2 - sqrt(z)) + Float64(t_1 + Float64(1.0 - sqrt(x))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_1 <= 2e-7)
tmp = t_3 + ((1.0 / (sqrt(z) + t_2)) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))));
else
tmp = t_3 + ((t_2 - sqrt(z)) + (t_1 + (1.0 - sqrt(x))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-7], N[(t$95$3 + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-7}:\\
\;\;\;\;t\_3 + \left(\frac{1}{\sqrt{z} + t\_2} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(\left(t\_2 - \sqrt{z}\right) + \left(t\_1 + \left(1 - \sqrt{x}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 1.9999999999999999e-7Initial program 83.2%
+-commutative83.2%
flip--83.2%
flip--83.4%
frac-add83.4%
Applied egg-rr83.7%
Simplified91.8%
flip--93.5%
div-inv93.5%
add-sqr-sqrt75.8%
+-commutative75.8%
add-sqr-sqrt94.0%
+-commutative94.0%
Applied egg-rr94.0%
associate-*r/94.0%
*-rgt-identity94.0%
associate--l+97.3%
+-inverses97.3%
metadata-eval97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in y around inf 97.3%
if 1.9999999999999999e-7 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 97.4%
Taylor expanded in x around 0 49.7%
Final simplification72.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z)))
(t_2 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_2 2e-7)
(+
t_3
(+
t_1
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))))
(+ t_3 (+ t_1 (+ t_2 (- 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 t_2 = sqrt((y + 1.0)) - sqrt(y);
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_2 <= 2e-7) {
tmp = t_3 + (t_1 + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))));
} else {
tmp = t_3 + (t_1 + (t_2 + (1.0 - sqrt(x))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_2 <= 2d-7) then
tmp = t_3 + (t_1 + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x))))))
else
tmp = t_3 + (t_1 + (t_2 + (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 t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_2 <= 2e-7) {
tmp = t_3 + (t_1 + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x))))));
} else {
tmp = t_3 + (t_1 + (t_2 + (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) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_2 <= 2e-7: tmp = t_3 + (t_1 + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))))) else: tmp = t_3 + (t_1 + (t_2 + (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)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_2 <= 2e-7) tmp = Float64(t_3 + Float64(t_1 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x))))))); else tmp = Float64(t_3 + Float64(t_1 + Float64(t_2 + 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);
t_2 = sqrt((y + 1.0)) - sqrt(y);
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_2 <= 2e-7)
tmp = t_3 + (t_1 + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))));
else
tmp = t_3 + (t_1 + (t_2 + (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]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 2e-7], N[(t$95$3 + N[(t$95$1 + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(t$95$1 + N[(t$95$2 + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{y + 1} - \sqrt{y}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-7}:\\
\;\;\;\;t\_3 + \left(t\_1 + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(t\_1 + \left(t\_2 + \left(1 - \sqrt{x}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 1.9999999999999999e-7Initial program 83.2%
flip--83.4%
div-inv83.4%
add-sqr-sqrt65.9%
+-commutative65.9%
add-sqr-sqrt83.7%
+-commutative83.7%
Applied egg-rr83.7%
associate-*r/83.7%
*-rgt-identity83.7%
associate--l+86.6%
+-inverses86.6%
metadata-eval86.6%
+-commutative86.6%
Simplified86.6%
Taylor expanded in y around inf 91.8%
if 1.9999999999999999e-7 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 97.4%
Taylor expanded in x around 0 49.7%
Final simplification70.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))))
(if (<= (- t_1 (sqrt z)) 0.0001)
(+
(sqrt (+ 1.0 x))
(- (+ (sqrt (+ y 1.0)) (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt y) (sqrt x))))
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(- (+ t_1 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if ((t_1 - sqrt(z)) <= 0.0001) {
tmp = sqrt((1.0 + x)) + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
} else {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((t_1 + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if ((t_1 - sqrt(z)) <= 0.0001d0) then
tmp = sqrt((1.0d0 + x)) + ((sqrt((y + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(y) + sqrt(x)))
else
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + ((t_1 + 2.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if ((t_1 - Math.sqrt(z)) <= 0.0001) {
tmp = Math.sqrt((1.0 + x)) + ((Math.sqrt((y + 1.0)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((t_1 + 2.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if (t_1 - math.sqrt(z)) <= 0.0001: tmp = math.sqrt((1.0 + x)) + ((math.sqrt((y + 1.0)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(y) + math.sqrt(x))) else: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((t_1 + 2.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(t_1 - sqrt(z)) <= 0.0001) tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(t_1 + 2.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if ((t_1 - sqrt(z)) <= 0.0001)
tmp = sqrt((1.0 + x)) + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
else
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((t_1 + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 0.0001], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $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}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t\_1 - \sqrt{z} \leq 0.0001:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(\sqrt{y + 1} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(t\_1 + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) < 1.00000000000000005e-4Initial program 83.8%
Taylor expanded in t around inf 3.9%
associate--l+15.4%
+-commutative15.4%
Simplified15.4%
Taylor expanded in z around inf 30.6%
if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) Initial program 96.8%
Taylor expanded in x around 0 28.5%
associate--l+36.8%
+-commutative36.8%
Simplified36.8%
Taylor expanded in y around 0 21.4%
Final simplification25.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 (sqrt (+ 1.0 z))))
(if (<= (- t_2 (sqrt z)) 2e-7)
(+
(sqrt (+ 1.0 x))
(- (+ t_1 (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt y) (sqrt x))))
(- (+ 1.0 (+ t_1 t_2)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt((1.0 + z));
double tmp;
if ((t_2 - sqrt(z)) <= 2e-7) {
tmp = sqrt((1.0 + x)) + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
} else {
tmp = (1.0 + (t_1 + t_2)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt((1.0d0 + z))
if ((t_2 - sqrt(z)) <= 2d-7) then
tmp = sqrt((1.0d0 + x)) + ((t_1 + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(y) + sqrt(x)))
else
tmp = (1.0d0 + (t_1 + t_2)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0));
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if ((t_2 - Math.sqrt(z)) <= 2e-7) {
tmp = Math.sqrt((1.0 + x)) + ((t_1 + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = (1.0 + (t_1 + t_2)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = math.sqrt((1.0 + z)) tmp = 0 if (t_2 - math.sqrt(z)) <= 2e-7: tmp = math.sqrt((1.0 + x)) + ((t_1 + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(y) + math.sqrt(x))) else: tmp = (1.0 + (t_1 + t_2)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(t_2 - sqrt(z)) <= 2e-7) tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(Float64(1.0 + Float64(t_1 + t_2)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
t_2 = sqrt((1.0 + z));
tmp = 0.0;
if ((t_2 - sqrt(z)) <= 2e-7)
tmp = sqrt((1.0 + x)) + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
else
tmp = (1.0 + (t_1 + t_2)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 2e-7], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$1 + t$95$2), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;t\_2 - \sqrt{z} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(t\_1 + t\_2\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) < 1.9999999999999999e-7Initial program 84.4%
Taylor expanded in t around inf 3.9%
associate--l+15.6%
+-commutative15.6%
Simplified15.6%
Taylor expanded in z around inf 31.1%
if 1.9999999999999999e-7 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) Initial program 96.0%
Taylor expanded in t around inf 14.9%
associate--l+18.3%
+-commutative18.3%
Simplified18.3%
Taylor expanded in x around 0 12.0%
Final simplification21.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))))
(if (<= t 1100.0)
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(- (+ t_1 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
(+
(- t_1 (sqrt z))
(+
(- (sqrt (+ y 1.0)) (sqrt y))
(+ 1.0 (- (* x (+ 0.5 (* x -0.125))) (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 t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 1100.0) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((t_1 + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = ((t_1 - sqrt(z)) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 + ((x * (0.5 + (x * -0.125))) - 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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 1100.0d0) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + ((t_1 + 2.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = ((t_1 - sqrt(z)) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 + ((x * (0.5d0 + (x * (-0.125d0)))) - 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 t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 1100.0) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((t_1 + 2.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = ((t_1 - Math.sqrt(z)) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 + ((x * (0.5 + (x * -0.125))) - 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): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 1100.0: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((t_1 + 2.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = ((t_1 - math.sqrt(z)) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 + ((x * (0.5 + (x * -0.125))) - 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) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 1100.0) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(t_1 + 2.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - 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)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 1100.0)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((t_1 + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = ((t_1 - sqrt(z)) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 + ((x * (0.5 + (x * -0.125))) - 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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1100.0], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $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}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 1100:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(t\_1 + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{z}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\right)\right)\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\\
\end{array}
\end{array}
if t < 1100Initial program 97.5%
Taylor expanded in x around 0 33.5%
associate--l+38.6%
+-commutative38.6%
Simplified38.6%
Taylor expanded in y around 0 21.6%
if 1100 < t Initial program 83.0%
Taylor expanded in t around inf 85.0%
Taylor expanded in x around 0 44.5%
associate--l+44.5%
Simplified44.5%
Final simplification32.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0))))
(if (<= z 26000000.0)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+ 1.0 (- (+ t_1 (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt y) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double tmp;
if (z <= 26000000.0) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = 1.0 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + 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((y + 1.0d0))
if (z <= 26000000.0d0) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = 1.0d0 + ((t_1 + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(y) + sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 26000000.0) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 1.0 + ((t_1 + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 26000000.0: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = 1.0 + ((t_1 + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 26000000.0) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(1.0 + Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 26000000.0)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = 1.0 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 26000000.0], N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $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}\\
\mathbf{if}\;z \leq 26000000:\\
\;\;\;\;\left(1 + \left(t\_1 + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 2.6e7Initial program 96.8%
Taylor expanded in t around inf 15.1%
associate--l+18.5%
+-commutative18.5%
Simplified18.5%
Taylor expanded in x around 0 12.2%
if 2.6e7 < z Initial program 83.8%
Taylor expanded in t around inf 3.9%
associate--l+15.4%
+-commutative15.4%
Simplified15.4%
Taylor expanded in x around 0 27.4%
Taylor expanded in z around inf 34.8%
Final simplification23.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 280000.0)
(- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
1.0
(- (+ (sqrt (+ y 1.0)) (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt y) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 280000.0) {
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = 1.0 + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + 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 <= 280000.0d0) then
tmp = (sqrt((1.0d0 + z)) + 2.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = 1.0d0 + ((sqrt((y + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(y) + 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 <= 280000.0) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 1.0 + ((Math.sqrt((y + 1.0)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 280000.0: tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = 1.0 + ((math.sqrt((y + 1.0)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(y) + 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 <= 280000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(y) + 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 <= 280000.0)
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = 1.0 + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + 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, 280000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 280000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(\sqrt{y + 1} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 2.8e5Initial program 96.8%
Taylor expanded in t around inf 15.1%
associate--l+18.5%
+-commutative18.5%
Simplified18.5%
Taylor expanded in x around 0 21.0%
Taylor expanded in y around 0 9.8%
if 2.8e5 < z Initial program 83.8%
Taylor expanded in t around inf 3.9%
associate--l+15.4%
+-commutative15.4%
Simplified15.4%
Taylor expanded in x around 0 27.4%
Taylor expanded in z around inf 34.8%
Final simplification22.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 25500000.0) (- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z)))) (+ (sqrt (+ 1.0 x)) (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 25500000.0) {
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = sqrt((1.0 + x)) + (sqrt((y + 1.0)) - (sqrt(y) + 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 <= 25500000.0d0) then
tmp = (sqrt((1.0d0 + z)) + 2.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = sqrt((1.0d0 + x)) + (sqrt((y + 1.0d0)) - (sqrt(y) + 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 <= 25500000.0) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = Math.sqrt((1.0 + x)) + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 25500000.0: tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = math.sqrt((1.0 + x)) + (math.sqrt((y + 1.0)) - (math.sqrt(y) + 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 <= 25500000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + 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 <= 25500000.0)
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = sqrt((1.0 + x)) + (sqrt((y + 1.0)) - (sqrt(y) + 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, 25500000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 25500000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 2.55e7Initial program 96.8%
Taylor expanded in t around inf 15.1%
associate--l+18.5%
+-commutative18.5%
Simplified18.5%
Taylor expanded in x around 0 21.0%
Taylor expanded in y around 0 9.8%
if 2.55e7 < z Initial program 83.8%
Taylor expanded in t around inf 3.9%
associate--l+15.4%
+-commutative15.4%
Simplified15.4%
Taylor expanded in z around inf 30.6%
Final simplification19.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 (<= x 1.0) (+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x)))) (/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
} else {
tmp = ((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.0d0) then
tmp = 1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
else
tmp = (((-0.125d0) * sqrt((1.0d0 / x))) + (sqrt(x) * 0.5d0)) / x
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = ((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.0: tmp = 1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = ((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.0)
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
else
tmp = ((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.0], N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}\\
\end{array}
\end{array}
if x < 1Initial program 98.1%
Taylor expanded in t around inf 15.4%
associate--l+29.9%
+-commutative29.9%
Simplified29.9%
Taylor expanded in x around 0 29.4%
Taylor expanded in z around inf 38.6%
if 1 < x Initial program 84.1%
Taylor expanded in t around inf 4.8%
associate--l+6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 4.6%
mul-1-neg4.6%
Simplified4.6%
Taylor expanded in x around inf 9.7%
Final simplification23.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 110000.0) (- (hypot 1.0 (sqrt x)) (sqrt x)) (/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 110000.0) {
tmp = hypot(1.0, sqrt(x)) - sqrt(x);
} else {
tmp = ((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x;
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 110000.0) {
tmp = Math.hypot(1.0, Math.sqrt(x)) - Math.sqrt(x);
} else {
tmp = ((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 110000.0: tmp = math.hypot(1.0, math.sqrt(x)) - math.sqrt(x) else: tmp = ((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 110000.0) tmp = Float64(hypot(1.0, sqrt(x)) - sqrt(x)); else tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 110000.0)
tmp = hypot(1.0, sqrt(x)) - sqrt(x);
else
tmp = ((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 110000.0], N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[x], $MachinePrecision] ^ 2], $MachinePrecision] - N[Sqrt[x], $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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 110000:\\
\;\;\;\;\mathsf{hypot}\left(1, \sqrt{x}\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}\\
\end{array}
\end{array}
if x < 1.1e5Initial program 97.9%
Taylor expanded in t around inf 15.2%
associate--l+29.5%
+-commutative29.5%
Simplified29.5%
Taylor expanded in x around inf 23.0%
mul-1-neg23.0%
Simplified23.0%
add-sqr-sqrt23.0%
hypot-1-def23.0%
Applied egg-rr23.0%
if 1.1e5 < x Initial program 83.8%
Taylor expanded in t around inf 4.7%
associate--l+5.9%
+-commutative5.9%
Simplified5.9%
Taylor expanded in x around inf 3.8%
mul-1-neg3.8%
Simplified3.8%
Taylor expanded in x around inf 9.5%
Final simplification15.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 (<= x 110000.0) (- (sqrt (+ 1.0 x)) (sqrt x)) (/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 110000.0) {
tmp = sqrt((1.0 + x)) - sqrt(x);
} else {
tmp = ((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 110000.0d0) then
tmp = sqrt((1.0d0 + x)) - sqrt(x)
else
tmp = (((-0.125d0) * sqrt((1.0d0 / x))) + (sqrt(x) * 0.5d0)) / x
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 110000.0) {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
} else {
tmp = ((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 110000.0: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) else: tmp = ((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 110000.0) tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); else tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 110000.0)
tmp = sqrt((1.0 + x)) - sqrt(x);
else
tmp = ((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 110000.0], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 110000:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}\\
\end{array}
\end{array}
if x < 1.1e5Initial program 97.9%
Taylor expanded in t around inf 15.2%
associate--l+29.5%
+-commutative29.5%
Simplified29.5%
Taylor expanded in x around inf 23.0%
mul-1-neg23.0%
Simplified23.0%
unsub-neg23.0%
Applied egg-rr23.0%
if 1.1e5 < x Initial program 83.8%
Taylor expanded in t around inf 4.7%
associate--l+5.9%
+-commutative5.9%
Simplified5.9%
Taylor expanded in x around inf 3.8%
mul-1-neg3.8%
Simplified3.8%
Taylor expanded in x around inf 9.5%
Final simplification15.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 (<= x 75000000.0) (- (sqrt (+ 1.0 x)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 75000000.0) {
tmp = sqrt((1.0 + x)) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 75000000.0d0) then
tmp = sqrt((1.0d0 + x)) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 75000000.0) {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 75000000.0: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 75000000.0) tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 75000000.0)
tmp = sqrt((1.0 + x)) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 75000000.0], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 75000000:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 7.5e7Initial program 97.9%
Taylor expanded in t around inf 15.2%
associate--l+29.5%
+-commutative29.5%
Simplified29.5%
Taylor expanded in x around inf 23.0%
mul-1-neg23.0%
Simplified23.0%
unsub-neg23.0%
Applied egg-rr23.0%
if 7.5e7 < x Initial program 83.8%
Taylor expanded in t around inf 4.7%
associate--l+5.9%
+-commutative5.9%
Simplified5.9%
Taylor expanded in x around inf 3.8%
mul-1-neg3.8%
Simplified3.8%
Taylor expanded in x around inf 9.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 1.32) (- (+ 1.0 (* x (+ 0.5 (* x (- (* x 0.0625) 0.125))))) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.32) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.32d0) then
tmp = (1.0d0 + (x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0))))) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.32) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.32: tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.32) tmp = Float64(Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.0625) - 0.125))))) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.32)
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.32], N[(N[(1.0 + N[(x * N[(0.5 + N[(x * N[(N[(x * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.32:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.32000000000000006Initial program 98.1%
Taylor expanded in t around inf 15.4%
associate--l+29.9%
+-commutative29.9%
Simplified29.9%
Taylor expanded in x around inf 22.6%
mul-1-neg22.6%
Simplified22.6%
Taylor expanded in x around 0 22.6%
if 1.32000000000000006 < x Initial program 84.1%
Taylor expanded in t around inf 4.8%
associate--l+6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 4.6%
mul-1-neg4.6%
Simplified4.6%
Taylor expanded in x around inf 9.7%
Final simplification15.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 1.05) (+ 1.0 (- (* x (+ 0.5 (* x -0.125))) (sqrt x))) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.05) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.05d0) then
tmp = 1.0d0 + ((x * (0.5d0 + (x * (-0.125d0)))) - sqrt(x))
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.05) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.05: tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - math.sqrt(x)) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.05) tmp = Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - sqrt(x))); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.05)
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.05], N[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.05:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.05000000000000004Initial program 98.1%
Taylor expanded in t around inf 15.4%
associate--l+29.9%
+-commutative29.9%
Simplified29.9%
Taylor expanded in x around inf 22.6%
mul-1-neg22.6%
Simplified22.6%
Taylor expanded in x around 0 22.6%
associate--l+22.6%
Simplified22.6%
if 1.05000000000000004 < x Initial program 84.1%
Taylor expanded in t around inf 4.8%
associate--l+6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 4.6%
mul-1-neg4.6%
Simplified4.6%
Taylor expanded in x around inf 9.7%
Final simplification15.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 1.0) (- (+ 1.0 (* x 0.5)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = (1.0 + (x * 0.5)) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.0d0) then
tmp = (1.0d0 + (x * 0.5d0)) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = (1.0 + (x * 0.5)) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.0: tmp = (1.0 + (x * 0.5)) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(1.0 + Float64(x * 0.5)) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.0)
tmp = (1.0 + (x * 0.5)) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.0], N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1Initial program 98.1%
Taylor expanded in t around inf 15.4%
associate--l+29.9%
+-commutative29.9%
Simplified29.9%
Taylor expanded in x around inf 22.6%
mul-1-neg22.6%
Simplified22.6%
Taylor expanded in x around 0 22.6%
if 1 < x Initial program 84.1%
Taylor expanded in t around inf 4.8%
associate--l+6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 4.6%
mul-1-neg4.6%
Simplified4.6%
Taylor expanded in x around inf 9.7%
Final simplification15.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 1.0) (+ 1.0 (- (* x 0.5) (sqrt x))) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 + ((x * 0.5) - sqrt(x));
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.0d0) then
tmp = 1.0d0 + ((x * 0.5d0) - sqrt(x))
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 + ((x * 0.5) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.0: tmp = 1.0 + ((x * 0.5) - math.sqrt(x)) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.0)
tmp = 1.0 + ((x * 0.5) - sqrt(x));
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.0], N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1Initial program 98.1%
Taylor expanded in t around inf 15.4%
associate--l+29.9%
+-commutative29.9%
Simplified29.9%
Taylor expanded in x around inf 22.6%
mul-1-neg22.6%
Simplified22.6%
Taylor expanded in x around 0 22.6%
associate--l+22.6%
Simplified22.6%
if 1 < x Initial program 84.1%
Taylor expanded in t around inf 4.8%
associate--l+6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 4.6%
mul-1-neg4.6%
Simplified4.6%
Taylor expanded in x around inf 9.7%
Final simplification15.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 0.22) (- 1.0 (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.22) {
tmp = 1.0 - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 0.22d0) then
tmp = 1.0d0 - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.22) {
tmp = 1.0 - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.22: tmp = 1.0 - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.22) tmp = Float64(1.0 - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 0.22)
tmp = 1.0 - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.22], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.22:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.220000000000000001Initial program 98.1%
Taylor expanded in t around inf 15.4%
associate--l+29.9%
+-commutative29.9%
Simplified29.9%
Taylor expanded in x around inf 22.6%
mul-1-neg22.6%
Simplified22.6%
Taylor expanded in x around 0 22.6%
if 0.220000000000000001 < x Initial program 84.1%
Taylor expanded in t around inf 4.8%
associate--l+6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 4.6%
mul-1-neg4.6%
Simplified4.6%
Taylor expanded in x around inf 9.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Initial program 90.5%
Taylor expanded in t around inf 9.6%
associate--l+17.0%
+-commutative17.0%
Simplified17.0%
Taylor expanded in x around inf 12.8%
mul-1-neg12.8%
Simplified12.8%
Taylor expanded in x around 0 11.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.5%
Taylor expanded in t around inf 9.6%
associate--l+17.0%
+-commutative17.0%
Simplified17.0%
Taylor expanded in x around inf 12.8%
mul-1-neg12.8%
Simplified12.8%
Taylor expanded in x around 0 11.1%
Taylor expanded in x around inf 1.6%
neg-mul-11.6%
Simplified1.6%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024131
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (sqrt t))))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))