
(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 31 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (+ (sqrt x) t_3)))
(if (<= (- t_2 (sqrt z)) 0.0001)
(+
(+
(/ 1.0 (+ (sqrt z) t_2))
(/ 1.0 (* (+ (sqrt y) t_1) (/ t_4 (+ (sqrt y) (+ t_1 t_4))))))
(* 0.5 (sqrt (/ 1.0 t))))
(-
(+ 1.0 (+ (+ t_3 t_2) (/ 1.0 (+ (sqrt t) (sqrt (+ 1.0 t))))))
(+ (sqrt x) (+ (sqrt y) (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + x));
double t_4 = sqrt(x) + t_3;
double tmp;
if ((t_2 - sqrt(z)) <= 0.0001) {
tmp = ((1.0 / (sqrt(z) + t_2)) + (1.0 / ((sqrt(y) + t_1) * (t_4 / (sqrt(y) + (t_1 + t_4)))))) + (0.5 * sqrt((1.0 / t)));
} else {
tmp = (1.0 + ((t_3 + t_2) + (1.0 / (sqrt(t) + sqrt((1.0 + t)))))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + x))
t_4 = sqrt(x) + t_3
if ((t_2 - sqrt(z)) <= 0.0001d0) then
tmp = ((1.0d0 / (sqrt(z) + t_2)) + (1.0d0 / ((sqrt(y) + t_1) * (t_4 / (sqrt(y) + (t_1 + t_4)))))) + (0.5d0 * sqrt((1.0d0 / t)))
else
tmp = (1.0d0 + ((t_3 + t_2) + (1.0d0 / (sqrt(t) + sqrt((1.0d0 + t)))))) - (sqrt(x) + (sqrt(y) + sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + x));
double t_4 = Math.sqrt(x) + t_3;
double tmp;
if ((t_2 - Math.sqrt(z)) <= 0.0001) {
tmp = ((1.0 / (Math.sqrt(z) + t_2)) + (1.0 / ((Math.sqrt(y) + t_1) * (t_4 / (Math.sqrt(y) + (t_1 + t_4)))))) + (0.5 * Math.sqrt((1.0 / t)));
} else {
tmp = (1.0 + ((t_3 + t_2) + (1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t)))))) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + x)) t_4 = math.sqrt(x) + t_3 tmp = 0 if (t_2 - math.sqrt(z)) <= 0.0001: tmp = ((1.0 / (math.sqrt(z) + t_2)) + (1.0 / ((math.sqrt(y) + t_1) * (t_4 / (math.sqrt(y) + (t_1 + t_4)))))) + (0.5 * math.sqrt((1.0 / t))) else: tmp = (1.0 + ((t_3 + t_2) + (1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))))) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(sqrt(x) + t_3) tmp = 0.0 if (Float64(t_2 - sqrt(z)) <= 0.0001) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(z) + t_2)) + Float64(1.0 / Float64(Float64(sqrt(y) + t_1) * Float64(t_4 / Float64(sqrt(y) + Float64(t_1 + t_4)))))) + Float64(0.5 * sqrt(Float64(1.0 / t)))); else tmp = Float64(Float64(1.0 + Float64(Float64(t_3 + t_2) + Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t)))))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + x));
t_4 = sqrt(x) + t_3;
tmp = 0.0;
if ((t_2 - sqrt(z)) <= 0.0001)
tmp = ((1.0 / (sqrt(z) + t_2)) + (1.0 / ((sqrt(y) + t_1) * (t_4 / (sqrt(y) + (t_1 + t_4)))))) + (0.5 * sqrt((1.0 / t)));
else
tmp = (1.0 + ((t_3 + t_2) + (1.0 / (sqrt(t) + sqrt((1.0 + t)))))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $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]}, If[LessEqual[N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 0.0001], N[(N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision] * N[(t$95$4 / N[(N[Sqrt[y], $MachinePrecision] + N[(t$95$1 + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(t$95$3 + t$95$2), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + x}\\
t_4 := \sqrt{x} + t\_3\\
\mathbf{if}\;t\_2 - \sqrt{z} \leq 0.0001:\\
\;\;\;\;\left(\frac{1}{\sqrt{z} + t\_2} + \frac{1}{\left(\sqrt{y} + t\_1\right) \cdot \frac{t\_4}{\sqrt{y} + \left(t\_1 + t\_4\right)}}\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\left(t\_3 + t\_2\right) + \frac{1}{\sqrt{t} + \sqrt{1 + t}}\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.00000000000000005e-4Initial program 83.8%
+-commutative83.8%
flip--83.8%
flip--84.0%
frac-add84.0%
Applied egg-rr84.1%
Simplified91.7%
flip--93.4%
div-inv93.4%
add-sqr-sqrt53.5%
+-commutative53.5%
add-sqr-sqrt93.8%
+-commutative93.8%
Applied egg-rr93.8%
associate-*r/93.8%
*-rgt-identity93.8%
associate--l+97.4%
+-inverses97.4%
metadata-eval97.4%
+-commutative97.4%
Simplified97.4%
clear-num97.4%
inv-pow97.4%
+-commutative97.4%
associate-+l+97.3%
+-commutative97.3%
Applied egg-rr97.3%
unpow-197.3%
associate-/l*97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in t around inf 55.8%
if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) Initial program 96.8%
flip--96.8%
add-sqr-sqrt77.8%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
Taylor expanded in y around 0 27.1%
associate-+r+27.1%
+-commutative27.1%
Simplified27.1%
Final simplification41.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 (+ y 1.0)) (sqrt y)))
(t_2 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (sqrt (+ 1.0 z)))
(t_5 (/ 1.0 (+ (sqrt z) t_4))))
(if (<= (+ t_2 (+ (- t_4 (sqrt z)) (+ t_1 (- t_3 (sqrt x))))) 1.0002)
(+ t_2 (+ t_5 (+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_3)))))
(+ t_2 (+ t_5 (+ 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 + t)) - sqrt(t);
double t_3 = sqrt((1.0 + x));
double t_4 = sqrt((1.0 + z));
double t_5 = 1.0 / (sqrt(z) + t_4);
double tmp;
if ((t_2 + ((t_4 - sqrt(z)) + (t_1 + (t_3 - sqrt(x))))) <= 1.0002) {
tmp = t_2 + (t_5 + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3))));
} else {
tmp = t_2 + (t_5 + (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) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
t_3 = sqrt((1.0d0 + x))
t_4 = sqrt((1.0d0 + z))
t_5 = 1.0d0 / (sqrt(z) + t_4)
if ((t_2 + ((t_4 - sqrt(z)) + (t_1 + (t_3 - sqrt(x))))) <= 1.0002d0) then
tmp = t_2 + (t_5 + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_3))))
else
tmp = t_2 + (t_5 + (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 + t)) - Math.sqrt(t);
double t_3 = Math.sqrt((1.0 + x));
double t_4 = Math.sqrt((1.0 + z));
double t_5 = 1.0 / (Math.sqrt(z) + t_4);
double tmp;
if ((t_2 + ((t_4 - Math.sqrt(z)) + (t_1 + (t_3 - Math.sqrt(x))))) <= 1.0002) {
tmp = t_2 + (t_5 + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_3))));
} else {
tmp = t_2 + (t_5 + (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 + t)) - math.sqrt(t) t_3 = math.sqrt((1.0 + x)) t_4 = math.sqrt((1.0 + z)) t_5 = 1.0 / (math.sqrt(z) + t_4) tmp = 0 if (t_2 + ((t_4 - math.sqrt(z)) + (t_1 + (t_3 - math.sqrt(x))))) <= 1.0002: tmp = t_2 + (t_5 + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_3)))) else: tmp = t_2 + (t_5 + (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 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_3 = sqrt(Float64(1.0 + x)) t_4 = sqrt(Float64(1.0 + z)) t_5 = Float64(1.0 / Float64(sqrt(z) + t_4)) tmp = 0.0 if (Float64(t_2 + Float64(Float64(t_4 - sqrt(z)) + Float64(t_1 + Float64(t_3 - sqrt(x))))) <= 1.0002) tmp = Float64(t_2 + Float64(t_5 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_3))))); else tmp = Float64(t_2 + Float64(t_5 + 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 + t)) - sqrt(t);
t_3 = sqrt((1.0 + x));
t_4 = sqrt((1.0 + z));
t_5 = 1.0 / (sqrt(z) + t_4);
tmp = 0.0;
if ((t_2 + ((t_4 - sqrt(z)) + (t_1 + (t_3 - sqrt(x))))) <= 1.0002)
tmp = t_2 + (t_5 + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_3))));
else
tmp = t_2 + (t_5 + (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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $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$2 + N[(N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0002], N[(t$95$2 + 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$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(t$95$5 + 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 + t} - \sqrt{t}\\
t_3 := \sqrt{1 + x}\\
t_4 := \sqrt{1 + z}\\
t_5 := \frac{1}{\sqrt{z} + t\_4}\\
\mathbf{if}\;t\_2 + \left(\left(t\_4 - \sqrt{z}\right) + \left(t\_1 + \left(t\_3 - \sqrt{x}\right)\right)\right) \leq 1.0002:\\
\;\;\;\;t\_2 + \left(t\_5 + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(t\_5 + \left(t\_1 + \left(1 - \sqrt{x}\right)\right)\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%
Taylor expanded in x around 0 60.9%
flip--99.2%
div-inv99.2%
add-sqr-sqrt84.5%
+-commutative84.5%
add-sqr-sqrt99.2%
+-commutative99.2%
Applied egg-rr60.9%
associate-*r/99.2%
*-rgt-identity99.2%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified60.9%
Final simplification67.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 y) (sqrt (+ y 1.0))))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (+ (sqrt x) t_3))
(t_5 (sqrt (+ 1.0 t))))
(if (<= (- t_2 (sqrt z)) 0.0001)
(+
(- t_5 (sqrt t))
(+ (/ (+ t_1 t_4) (* t_1 t_4)) (* 0.5 (sqrt (/ 1.0 z)))))
(-
(+ 1.0 (+ (+ t_3 t_2) (/ 1.0 (+ (sqrt t) t_5))))
(+ (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) + sqrt((y + 1.0));
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + x));
double t_4 = sqrt(x) + t_3;
double t_5 = sqrt((1.0 + t));
double tmp;
if ((t_2 - sqrt(z)) <= 0.0001) {
tmp = (t_5 - sqrt(t)) + (((t_1 + t_4) / (t_1 * t_4)) + (0.5 * sqrt((1.0 / z))));
} else {
tmp = (1.0 + ((t_3 + t_2) + (1.0 / (sqrt(t) + t_5)))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt(y) + sqrt((y + 1.0d0))
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + x))
t_4 = sqrt(x) + t_3
t_5 = sqrt((1.0d0 + t))
if ((t_2 - sqrt(z)) <= 0.0001d0) then
tmp = (t_5 - sqrt(t)) + (((t_1 + t_4) / (t_1 * t_4)) + (0.5d0 * sqrt((1.0d0 / z))))
else
tmp = (1.0d0 + ((t_3 + t_2) + (1.0d0 / (sqrt(t) + t_5)))) - (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) + Math.sqrt((y + 1.0));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + x));
double t_4 = Math.sqrt(x) + t_3;
double t_5 = Math.sqrt((1.0 + t));
double tmp;
if ((t_2 - Math.sqrt(z)) <= 0.0001) {
tmp = (t_5 - Math.sqrt(t)) + (((t_1 + t_4) / (t_1 * t_4)) + (0.5 * Math.sqrt((1.0 / z))));
} else {
tmp = (1.0 + ((t_3 + t_2) + (1.0 / (Math.sqrt(t) + t_5)))) - (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) + math.sqrt((y + 1.0)) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + x)) t_4 = math.sqrt(x) + t_3 t_5 = math.sqrt((1.0 + t)) tmp = 0 if (t_2 - math.sqrt(z)) <= 0.0001: tmp = (t_5 - math.sqrt(t)) + (((t_1 + t_4) / (t_1 * t_4)) + (0.5 * math.sqrt((1.0 / z)))) else: tmp = (1.0 + ((t_3 + t_2) + (1.0 / (math.sqrt(t) + t_5)))) - (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 = Float64(sqrt(y) + sqrt(Float64(y + 1.0))) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(sqrt(x) + t_3) t_5 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (Float64(t_2 - sqrt(z)) <= 0.0001) tmp = Float64(Float64(t_5 - sqrt(t)) + Float64(Float64(Float64(t_1 + t_4) / Float64(t_1 * t_4)) + Float64(0.5 * sqrt(Float64(1.0 / z))))); else tmp = Float64(Float64(1.0 + Float64(Float64(t_3 + t_2) + Float64(1.0 / Float64(sqrt(t) + t_5)))) - 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) + sqrt((y + 1.0));
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + x));
t_4 = sqrt(x) + t_3;
t_5 = sqrt((1.0 + t));
tmp = 0.0;
if ((t_2 - sqrt(z)) <= 0.0001)
tmp = (t_5 - sqrt(t)) + (((t_1 + t_4) / (t_1 * t_4)) + (0.5 * sqrt((1.0 / z))));
else
tmp = (1.0 + ((t_3 + t_2) + (1.0 / (sqrt(t) + t_5)))) - (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[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $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[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 0.0001], N[(N[(t$95$5 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 + t$95$4), $MachinePrecision] / N[(t$95$1 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(t$95$3 + t$95$2), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y} + \sqrt{y + 1}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + x}\\
t_4 := \sqrt{x} + t\_3\\
t_5 := \sqrt{1 + t}\\
\mathbf{if}\;t\_2 - \sqrt{z} \leq 0.0001:\\
\;\;\;\;\left(t\_5 - \sqrt{t}\right) + \left(\frac{t\_1 + t\_4}{t\_1 \cdot t\_4} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\left(t\_3 + t\_2\right) + \frac{1}{\sqrt{t} + t\_5}\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.00000000000000005e-4Initial 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%
if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) Initial program 96.8%
flip--96.8%
add-sqr-sqrt77.8%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
Taylor expanded in y around 0 27.1%
associate-+r+27.1%
+-commutative27.1%
Simplified27.1%
Final simplification61.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 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 (+ 1.0 t)) (sqrt t)))
(t_2 (sqrt (+ y 1.0)))
(t_3 (sqrt (+ 1.0 x))))
(if (<= (+ (- t_2 (sqrt y)) (- t_3 (sqrt x))) 0.999)
(+ t_1 (+ (/ 1.0 (+ (sqrt x) t_3)) (/ 1.0 (+ 1.0 (sqrt z)))))
(+
t_1
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (- 1.0 (sqrt x)) (/ 1.0 (+ (sqrt y) t_2))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((y + 1.0));
double t_3 = sqrt((1.0 + x));
double tmp;
if (((t_2 - sqrt(y)) + (t_3 - sqrt(x))) <= 0.999) {
tmp = t_1 + ((1.0 / (sqrt(x) + t_3)) + (1.0 / (1.0 + sqrt(z))));
} else {
tmp = t_1 + ((sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + t_2))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((y + 1.0d0))
t_3 = sqrt((1.0d0 + x))
if (((t_2 - sqrt(y)) + (t_3 - sqrt(x))) <= 0.999d0) then
tmp = t_1 + ((1.0d0 / (sqrt(x) + t_3)) + (1.0d0 / (1.0d0 + sqrt(z))))
else
tmp = t_1 + ((sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 - sqrt(x)) + (1.0d0 / (sqrt(y) + t_2))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((y + 1.0));
double t_3 = Math.sqrt((1.0 + x));
double tmp;
if (((t_2 - Math.sqrt(y)) + (t_3 - Math.sqrt(x))) <= 0.999) {
tmp = t_1 + ((1.0 / (Math.sqrt(x) + t_3)) + (1.0 / (1.0 + Math.sqrt(z))));
} else {
tmp = t_1 + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + t_2))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((y + 1.0)) t_3 = math.sqrt((1.0 + x)) tmp = 0 if ((t_2 - math.sqrt(y)) + (t_3 - math.sqrt(x))) <= 0.999: tmp = t_1 + ((1.0 / (math.sqrt(x) + t_3)) + (1.0 / (1.0 + math.sqrt(z)))) else: tmp = t_1 + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + t_2)))) 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(y + 1.0)) t_3 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(Float64(t_2 - sqrt(y)) + Float64(t_3 - sqrt(x))) <= 0.999) tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(1.0 / Float64(1.0 + sqrt(z))))); else tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + t_2))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
t_2 = sqrt((y + 1.0));
t_3 = sqrt((1.0 + x));
tmp = 0.0;
if (((t_2 - sqrt(y)) + (t_3 - sqrt(x))) <= 0.999)
tmp = t_1 + ((1.0 / (sqrt(x) + t_3)) + (1.0 / (1.0 + sqrt(z))));
else
tmp = t_1 + ((sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + t_2))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.999], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $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 + t} - \sqrt{t}\\
t_2 := \sqrt{y + 1}\\
t_3 := \sqrt{1 + x}\\
\mathbf{if}\;\left(t\_2 - \sqrt{y}\right) + \left(t\_3 - \sqrt{x}\right) \leq 0.999:\\
\;\;\;\;t\_1 + \left(\frac{1}{\sqrt{x} + t\_3} + \frac{1}{1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + t\_2}\right)\right)\\
\end{array}
\end{array}
if (+.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))) < 0.998999999999999999Initial program 74.4%
+-commutative74.4%
flip--74.4%
flip--74.7%
frac-add74.7%
Applied egg-rr75.3%
Simplified87.3%
flip--90.1%
div-inv90.1%
add-sqr-sqrt68.6%
+-commutative68.6%
add-sqr-sqrt90.8%
+-commutative90.8%
Applied egg-rr90.8%
associate-*r/90.8%
*-rgt-identity90.8%
associate--l+96.3%
+-inverses96.3%
metadata-eval96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in y around inf 87.8%
+-commutative87.8%
Simplified87.8%
Taylor expanded in z around 0 76.6%
if 0.998999999999999999 < (+.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))) Initial program 97.2%
Taylor expanded in x around 0 62.3%
flip--62.4%
div-inv62.4%
add-sqr-sqrt48.0%
+-commutative48.0%
add-sqr-sqrt62.4%
+-commutative62.4%
Applied egg-rr62.4%
associate-*r/62.4%
*-rgt-identity62.4%
associate--l+63.0%
+-inverses63.0%
metadata-eval63.0%
+-commutative63.0%
Simplified63.0%
Final simplification67.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 z))) (t_2 (- t_1 (sqrt z))) (t_3 (sqrt (+ 1.0 x))))
(if (<= t_2 0.0001)
(+
t_3
(- (+ (sqrt (+ y 1.0)) (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt y) (sqrt x))))
(if (<= t_2 0.99999998)
(+
(* 0.5 (sqrt (/ 1.0 t)))
(- (+ t_1 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(-
(+ 1.0 (+ (+ t_3 t_1) (/ 1.0 (+ (sqrt t) (sqrt (+ 1.0 t))))))
(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));
double t_2 = t_1 - sqrt(z);
double t_3 = sqrt((1.0 + x));
double tmp;
if (t_2 <= 0.0001) {
tmp = t_3 + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
} else if (t_2 <= 0.99999998) {
tmp = (0.5 * sqrt((1.0 / t))) + ((t_1 + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = (1.0 + ((t_3 + t_1) + (1.0 / (sqrt(t) + sqrt((1.0 + t)))))) - 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))
t_2 = t_1 - sqrt(z)
t_3 = sqrt((1.0d0 + x))
if (t_2 <= 0.0001d0) then
tmp = t_3 + ((sqrt((y + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(y) + sqrt(x)))
else if (t_2 <= 0.99999998d0) then
tmp = (0.5d0 * sqrt((1.0d0 / t))) + ((t_1 + 2.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = (1.0d0 + ((t_3 + t_1) + (1.0d0 / (sqrt(t) + sqrt((1.0d0 + t)))))) - 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));
double t_2 = t_1 - Math.sqrt(z);
double t_3 = Math.sqrt((1.0 + x));
double tmp;
if (t_2 <= 0.0001) {
tmp = t_3 + ((Math.sqrt((y + 1.0)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(y) + Math.sqrt(x)));
} else if (t_2 <= 0.99999998) {
tmp = (0.5 * Math.sqrt((1.0 / t))) + ((t_1 + 2.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = (1.0 + ((t_3 + t_1) + (1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t)))))) - 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)) t_2 = t_1 - math.sqrt(z) t_3 = math.sqrt((1.0 + x)) tmp = 0 if t_2 <= 0.0001: tmp = t_3 + ((math.sqrt((y + 1.0)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(y) + math.sqrt(x))) elif t_2 <= 0.99999998: tmp = (0.5 * math.sqrt((1.0 / t))) + ((t_1 + 2.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = (1.0 + ((t_3 + t_1) + (1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))))) - 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 + z)) t_2 = Float64(t_1 - sqrt(z)) t_3 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (t_2 <= 0.0001) tmp = Float64(t_3 + Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(y) + sqrt(x)))); elseif (t_2 <= 0.99999998) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(Float64(t_1 + 2.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(Float64(1.0 + Float64(Float64(t_3 + t_1) + Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t)))))) - 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));
t_2 = t_1 - sqrt(z);
t_3 = sqrt((1.0 + x));
tmp = 0.0;
if (t_2 <= 0.0001)
tmp = t_3 + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
elseif (t_2 <= 0.99999998)
tmp = (0.5 * sqrt((1.0 / t))) + ((t_1 + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = (1.0 + ((t_3 + t_1) + (1.0 / (sqrt(t) + sqrt((1.0 + t)))))) - 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 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 0.0001], N[(t$95$3 + 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], If[LessEqual[t$95$2, 0.99999998], N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $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[(1.0 + N[(N[(t$95$3 + t$95$1), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := t\_1 - \sqrt{z}\\
t_3 := \sqrt{1 + x}\\
\mathbf{if}\;t\_2 \leq 0.0001:\\
\;\;\;\;t\_3 + \left(\left(\sqrt{y + 1} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{elif}\;t\_2 \leq 0.99999998:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{t}} + \left(\left(t\_1 + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\left(t\_3 + t\_1\right) + \frac{1}{\sqrt{t} + \sqrt{1 + t}}\right)\right) - \sqrt{x}\\
\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)) < 0.999999980000000011Initial program 95.5%
Taylor expanded in x around 0 34.0%
Taylor expanded in t around inf 23.6%
Taylor expanded in y around 0 2.7%
if 0.999999980000000011 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) Initial program 96.9%
flip--96.9%
add-sqr-sqrt78.7%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
Taylor expanded in y around 0 28.0%
associate-+r+28.0%
+-commutative28.0%
Simplified28.0%
Taylor expanded in x around inf 32.6%
Final simplification30.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 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 (sqrt z))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))))
(+ t_3 (+ (/ 1.0 (+ (sqrt z) 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));
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 - sqrt(z)) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))));
} else {
tmp = t_3 + ((1.0 / (sqrt(z) + 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))
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 - sqrt(z)) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x))))))
else
tmp = t_3 + ((1.0d0 / (sqrt(z) + 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));
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 - Math.sqrt(z)) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x))))));
} else {
tmp = t_3 + ((1.0 / (Math.sqrt(z) + 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)) 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 - math.sqrt(z)) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))))) else: tmp = t_3 + ((1.0 / (math.sqrt(z) + 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 = sqrt(Float64(1.0 + 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(Float64(t_1 - sqrt(z)) + 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(1.0 / Float64(sqrt(z) + 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));
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 - sqrt(z)) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + sqrt((1.0 + x))))));
else
tmp = t_3 + ((1.0 / (sqrt(z) + 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[Sqrt[N[(1.0 + 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[(N[(t$95$1 - N[Sqrt[z], $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[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + 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}\\
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(\left(t\_1 - \sqrt{z}\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(\frac{1}{\sqrt{z} + 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%
+-commutative83.2%
flip--83.2%
flip--83.4%
frac-add83.4%
Applied egg-rr83.7%
Simplified91.8%
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%
flip--99.1%
div-inv99.1%
add-sqr-sqrt77.9%
+-commutative77.9%
add-sqr-sqrt99.1%
+-commutative99.1%
Applied egg-rr49.7%
associate-*r/99.1%
*-rgt-identity99.1%
associate--l+99.3%
+-inverses99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified49.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 (+ y 1.0)) (sqrt y)))
(t_2 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_1 2e-8)
(+ t_2 (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ 1.0 (sqrt z)))))
(+ t_2 (+ (- (sqrt (+ 1.0 z)) (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 + t)) - sqrt(t);
double tmp;
if (t_1 <= 2e-8) {
tmp = t_2 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + sqrt(z))));
} else {
tmp = t_2 + ((sqrt((1.0 + z)) - 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) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_1 <= 2d-8) then
tmp = t_2 + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (1.0d0 + sqrt(z))))
else
tmp = t_2 + ((sqrt((1.0d0 + z)) - 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 + t)) - Math.sqrt(t);
double tmp;
if (t_1 <= 2e-8) {
tmp = t_2 + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (1.0 + Math.sqrt(z))));
} else {
tmp = t_2 + ((Math.sqrt((1.0 + z)) - 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 + t)) - math.sqrt(t) tmp = 0 if t_1 <= 2e-8: tmp = t_2 + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (1.0 + math.sqrt(z)))) else: tmp = t_2 + ((math.sqrt((1.0 + z)) - 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 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_1 <= 2e-8) tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(1.0 + sqrt(z))))); else tmp = Float64(t_2 + Float64(Float64(sqrt(Float64(1.0 + z)) - 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 + t)) - sqrt(t);
tmp = 0.0;
if (t_1 <= 2e-8)
tmp = t_2 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + sqrt(z))));
else
tmp = t_2 + ((sqrt((1.0 + z)) - 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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-8], N[(t$95$2 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - 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 + t} - \sqrt{t}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-8}:\\
\;\;\;\;t\_2 + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(\left(\sqrt{1 + z} - \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)) < 2e-8Initial 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 91.3%
+-commutative91.3%
Simplified91.3%
Taylor expanded in z around 0 84.0%
if 2e-8 < (-.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 simplification66.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 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 46.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 (+ 1.0 t)) (sqrt t))))
(if (<= y 1.8e+15)
(+
t_1
(+
(/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z))))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- 1.0 (sqrt x)))))
(+
t_1
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ 1.0 (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 + t)) - sqrt(t);
double tmp;
if (y <= 1.8e+15) {
tmp = t_1 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))));
} else {
tmp = t_1 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + 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 + t)) - sqrt(t)
if (y <= 1.8d+15) then
tmp = t_1 + ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 - sqrt(x))))
else
tmp = t_1 + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (1.0d0 + 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 + t)) - Math.sqrt(t);
double tmp;
if (y <= 1.8e+15) {
tmp = t_1 + ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 - Math.sqrt(x))));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (1.0 + 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 + t)) - math.sqrt(t) tmp = 0 if y <= 1.8e+15: tmp = t_1 + ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 - math.sqrt(x)))) else: tmp = t_1 + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (1.0 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (y <= 1.8e+15) tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 - sqrt(x))))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(1.0 + 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 + t)) - sqrt(t);
tmp = 0.0;
if (y <= 1.8e+15)
tmp = t_1 + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))));
else
tmp = t_1 + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + 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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.8e+15], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + 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 + t} - \sqrt{t}\\
\mathbf{if}\;y \leq 1.8 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{1 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if y < 1.8e15Initial program 97.4%
Taylor expanded in x around 0 49.7%
flip--99.1%
div-inv99.1%
add-sqr-sqrt77.9%
+-commutative77.9%
add-sqr-sqrt99.1%
+-commutative99.1%
Applied egg-rr49.7%
associate-*r/99.1%
*-rgt-identity99.1%
associate--l+99.3%
+-inverses99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified49.7%
if 1.8e15 < y Initial 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 91.3%
+-commutative91.3%
Simplified91.3%
Taylor expanded in z around 0 84.0%
Final simplification66.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 1.2e-29)
(+
(* 0.5 (sqrt (/ 1.0 t)))
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (- 1.0 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0)))))))
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ 1.0 (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.2e-29) {
tmp = (0.5 * sqrt((1.0 / t))) + ((sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))))));
} else {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.2d-29) then
tmp = (0.5d0 * sqrt((1.0d0 / t))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0))))))
else
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (1.0d0 + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.2e-29) {
tmp = (0.5 * Math.sqrt((1.0 / t))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0))))));
} else {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (1.0 + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.2e-29: tmp = (0.5 * math.sqrt((1.0 / t))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0)))))) else: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (1.0 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.2e-29) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0))))))); else tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(1.0 + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.2e-29)
tmp = (0.5 * sqrt((1.0 / t))) + ((sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))))));
else
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.2e-29], N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.2 \cdot 10^{-29}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{t}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{1 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if x < 1.19999999999999996e-29Initial program 98.1%
Taylor expanded in x around 0 98.1%
Taylor expanded in t around inf 49.2%
flip--98.2%
div-inv98.2%
add-sqr-sqrt74.9%
+-commutative74.9%
add-sqr-sqrt98.2%
+-commutative98.2%
Applied egg-rr49.2%
associate-*r/98.2%
*-rgt-identity98.2%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified49.5%
if 1.19999999999999996e-29 < x Initial program 84.8%
+-commutative84.8%
flip--84.8%
flip--85.2%
frac-add85.1%
Applied egg-rr85.9%
Simplified92.9%
flip--94.3%
div-inv94.3%
add-sqr-sqrt72.8%
+-commutative72.8%
add-sqr-sqrt94.7%
+-commutative94.7%
Applied egg-rr94.7%
associate-*r/94.7%
*-rgt-identity94.7%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in y around inf 54.8%
+-commutative54.8%
Simplified54.8%
Taylor expanded in z around 0 49.0%
Final simplification49.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 (<= y 5.5e+14)
(+
(* 0.5 (sqrt (/ 1.0 t)))
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- 1.0 (sqrt x)))))
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ 1.0 (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.5e+14) {
tmp = (0.5 * sqrt((1.0 / t))) + ((sqrt((1.0 + z)) - sqrt(z)) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))));
} else {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 5.5d+14) then
tmp = (0.5d0 * sqrt((1.0d0 / t))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 - sqrt(x))))
else
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (1.0d0 + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.5e+14) {
tmp = (0.5 * Math.sqrt((1.0 / t))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 - Math.sqrt(x))));
} else {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (1.0 + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5.5e+14: tmp = (0.5 * math.sqrt((1.0 / t))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 - math.sqrt(x)))) else: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (1.0 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5.5e+14) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 - sqrt(x))))); else tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(1.0 + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 5.5e+14)
tmp = (0.5 * sqrt((1.0 / t))) + ((sqrt((1.0 + z)) - sqrt(z)) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))));
else
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (1.0 + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 5.5e+14], N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{+14}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{t}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{1 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if y < 5.5e14Initial program 97.4%
Taylor expanded in x around 0 49.7%
Taylor expanded in t around inf 26.3%
if 5.5e14 < y Initial 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 91.3%
+-commutative91.3%
Simplified91.3%
Taylor expanded in z around 0 84.0%
Final simplification54.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 (<= z 140000.0)
(+
(* 0.5 (sqrt (/ 1.0 t)))
(- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
(sqrt (+ 1.0 x))
(- (+ (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 <= 140000.0) {
tmp = (0.5 * sqrt((1.0 / t))) + ((sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = sqrt((1.0 + x)) + ((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 <= 140000.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / t))) + ((sqrt((1.0d0 + z)) + 2.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = sqrt((1.0d0 + x)) + ((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 <= 140000.0) {
tmp = (0.5 * Math.sqrt((1.0 / t))) + ((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)) + (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 <= 140000.0: tmp = (0.5 * math.sqrt((1.0 / t))) + ((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)) + (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 <= 140000.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + 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(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 <= 140000.0)
tmp = (0.5 * sqrt((1.0 / t))) + ((sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = sqrt((1.0 + x)) + ((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, 140000.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision], 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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 140000:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{t}} + \left(\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \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 < 1.4e5Initial program 96.8%
Taylor expanded in x around 0 46.8%
Taylor expanded in t around inf 21.4%
Taylor expanded in y around 0 8.8%
if 1.4e5 < 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.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0))))
(if (<= z 26000000.0)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
(sqrt (+ 1.0 x))
(- (+ 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 = sqrt((1.0 + x)) + ((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 = sqrt((1.0d0 + x)) + ((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 = Math.sqrt((1.0 + x)) + ((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 = math.sqrt((1.0 + x)) + ((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(sqrt(Float64(1.0 + x)) + 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 = sqrt((1.0 + x)) + ((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[(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]]]
\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}:\\
\;\;\;\;\sqrt{1 + x} + \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 z around inf 30.6%
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 (+ 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 3.3%
Taylor expanded in z around inf 21.7%
associate--l+34.8%
+-commutative34.8%
Simplified34.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 3500000.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 <= 3500000.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 <= 3500000.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 <= 3500000.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 <= 3500000.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 <= 3500000.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 <= 3500000.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, 3500000.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 3500000:\\
\;\;\;\;\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 < 3.5e6Initial 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%
Taylor expanded in y around 0 9.8%
+-commutative9.8%
Simplified9.8%
if 3.5e6 < 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 3.3%
Taylor expanded in z around inf 21.7%
associate--l+34.8%
+-commutative34.8%
Simplified34.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 12.2%
Taylor expanded in y around 0 9.8%
+-commutative9.8%
Simplified9.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
(let* ((t_1 (sqrt (+ y 1.0))))
(if (<= z 0.08)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (sqrt x))
(+ (sqrt (+ 1.0 x)) (- t_1 (+ (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 <= 0.08) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - sqrt(x);
} else {
tmp = sqrt((1.0 + x)) + (t_1 - (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 <= 0.08d0) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - sqrt(x)
else
tmp = sqrt((1.0d0 + x)) + (t_1 - (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 <= 0.08) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - Math.sqrt(x);
} else {
tmp = Math.sqrt((1.0 + x)) + (t_1 - (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 <= 0.08: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - math.sqrt(x) else: tmp = math.sqrt((1.0 + x)) + (t_1 - (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 <= 0.08) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - sqrt(x)); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(t_1 - 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 <= 0.08)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - sqrt(x);
else
tmp = sqrt((1.0 + x)) + (t_1 - (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, 0.08], N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - 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 0.08:\\
\;\;\;\;\left(1 + \left(t\_1 + \sqrt{1 + z}\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(t\_1 - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 0.0800000000000000017Initial program 96.8%
Taylor expanded in t around inf 15.2%
associate--l+18.6%
+-commutative18.6%
Simplified18.6%
Taylor expanded in x around 0 12.3%
Taylor expanded in x around inf 11.9%
if 0.0800000000000000017 < z Initial program 83.9%
Taylor expanded in t around inf 3.9%
associate--l+15.3%
+-commutative15.3%
Simplified15.3%
Taylor expanded in z around inf 30.4%
Final simplification21.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 (+ y 1.0))))
(if (<= z 0.026)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (sqrt x))
(+ 1.0 (- t_1 (+ (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 <= 0.026) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - sqrt(x);
} else {
tmp = 1.0 + (t_1 - (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 <= 0.026d0) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - sqrt(x)
else
tmp = 1.0d0 + (t_1 - (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 <= 0.026) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - Math.sqrt(x);
} else {
tmp = 1.0 + (t_1 - (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 <= 0.026: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - math.sqrt(x) else: tmp = 1.0 + (t_1 - (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 <= 0.026) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - sqrt(x)); else tmp = Float64(1.0 + Float64(t_1 - 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 <= 0.026)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - sqrt(x);
else
tmp = 1.0 + (t_1 - (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, 0.026], N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(t$95$1 - 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 0.026:\\
\;\;\;\;\left(1 + \left(t\_1 + \sqrt{1 + z}\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(t\_1 - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 0.0259999999999999988Initial program 96.8%
Taylor expanded in t around inf 15.2%
associate--l+18.6%
+-commutative18.6%
Simplified18.6%
Taylor expanded in x around 0 12.3%
Taylor expanded in x around inf 11.9%
if 0.0259999999999999988 < z Initial program 83.9%
Taylor expanded in t around inf 3.9%
associate--l+15.3%
+-commutative15.3%
Simplified15.3%
Taylor expanded in x around 0 3.3%
Taylor expanded in z around inf 21.6%
associate--l+34.7%
Simplified34.7%
Final simplification23.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.82) (+ 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 <= 0.82) {
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 <= 0.82d0) 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 <= 0.82) {
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 <= 0.82: 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 <= 0.82) 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 <= 0.82)
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, 0.82], 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 0.82:\\
\;\;\;\;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 < 0.819999999999999951Initial 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 14.9%
Taylor expanded in z around inf 28.9%
associate--l+38.6%
Simplified38.6%
if 0.819999999999999951 < 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%
neg-mul-14.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%
neg-mul-123.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%
neg-mul-13.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%
neg-mul-123.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%
neg-mul-13.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%
neg-mul-123.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%
neg-mul-13.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(1.0 + Float64(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[(1.0 + N[(N[(x * N[(0.5 + N[(x * N[(N[(x * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $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.32:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right) - \sqrt{x}\right)\\
\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%
neg-mul-122.6%
Simplified22.6%
Taylor expanded in x around 0 22.6%
associate--l+22.6%
fmm-def22.6%
metadata-eval22.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%
neg-mul-14.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.65) (+ 1.0 (- (* x (+ 0.5 (* x -0.125))) (sqrt x))) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.65) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 0.65d0) then
tmp = 1.0d0 + ((x * (0.5d0 + (x * (-0.125d0)))) - sqrt(x))
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.65) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.65: tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - math.sqrt(x)) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.65) tmp = Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - sqrt(x))); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 0.65)
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.65], N[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.65:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.650000000000000022Initial 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%
neg-mul-122.6%
Simplified22.6%
Taylor expanded in x around 0 22.6%
associate--l+22.6%
Simplified22.6%
if 0.650000000000000022 < 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%
neg-mul-14.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%
neg-mul-122.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%
neg-mul-14.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%
neg-mul-122.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%
neg-mul-14.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.065) (- 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.065) {
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.065d0) 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.065) {
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.065: 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.065) 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.065)
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.065], 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.065:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.065000000000000002Initial program 98.1%
Taylor expanded in t around inf 15.4%
associate--l+30.0%
+-commutative30.0%
Simplified30.0%
Taylor expanded in x around inf 22.7%
neg-mul-122.7%
Simplified22.7%
Taylor expanded in x around 0 22.7%
if 0.065000000000000002 < x Initial program 84.2%
Taylor expanded in t around inf 4.9%
associate--l+6.3%
+-commutative6.3%
Simplified6.3%
Taylor expanded in x around inf 4.7%
neg-mul-14.7%
Simplified4.7%
Taylor expanded in x around inf 9.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (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%
neg-mul-112.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 y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(y)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(y);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[y], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{y}
\end{array}
Initial program 90.5%
flip--90.5%
add-sqr-sqrt73.7%
add-sqr-sqrt91.1%
Applied egg-rr91.1%
Taylor expanded in y around 0 15.6%
associate-+r+15.6%
+-commutative15.6%
Simplified15.6%
Taylor expanded in y around inf 1.6%
mul-1-neg1.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))))