
(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 24 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 t)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (+ (sqrt y) (pow (+ 1.0 y) 0.5)))
(t_4 (sqrt (+ 1.0 y)))
(t_5 (+ (- t_2 (sqrt x)) (- t_4 (sqrt y))))
(t_6 (- t_1 (sqrt t)))
(t_7 (+ (sqrt x) t_2)))
(if (<= t_5 0.0)
(+
(* 0.5 (sqrt (/ 1.0 x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (+ (* 0.5 (sqrt (/ 1.0 z))) t_6)))
(if (<= t_5 1.95)
(+ (/ (+ (* t_3 (+ x (- 1.0 x))) t_7) (* t_3 t_7)) t_6)
(-
(+
(+ 1.0 t_4)
(+ (/ 1.0 (+ t_1 (sqrt t))) (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z))))))
(+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t));
double t_2 = sqrt((x + 1.0));
double t_3 = sqrt(y) + pow((1.0 + y), 0.5);
double t_4 = sqrt((1.0 + y));
double t_5 = (t_2 - sqrt(x)) + (t_4 - sqrt(y));
double t_6 = t_1 - sqrt(t);
double t_7 = sqrt(x) + t_2;
double tmp;
if (t_5 <= 0.0) {
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + t_6));
} else if (t_5 <= 1.95) {
tmp = (((t_3 * (x + (1.0 - x))) + t_7) / (t_3 * t_7)) + t_6;
} else {
tmp = ((1.0 + t_4) + ((1.0 / (t_1 + sqrt(t))) + (1.0 / (sqrt(z) + sqrt((1.0 + z)))))) - (sqrt(x) + sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = sqrt((1.0d0 + t))
t_2 = sqrt((x + 1.0d0))
t_3 = sqrt(y) + ((1.0d0 + y) ** 0.5d0)
t_4 = sqrt((1.0d0 + y))
t_5 = (t_2 - sqrt(x)) + (t_4 - sqrt(y))
t_6 = t_1 - sqrt(t)
t_7 = sqrt(x) + t_2
if (t_5 <= 0.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + ((0.5d0 * sqrt((1.0d0 / z))) + t_6))
else if (t_5 <= 1.95d0) then
tmp = (((t_3 * (x + (1.0d0 - x))) + t_7) / (t_3 * t_7)) + t_6
else
tmp = ((1.0d0 + t_4) + ((1.0d0 / (t_1 + sqrt(t))) + (1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))))) - (sqrt(x) + sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t));
double t_2 = Math.sqrt((x + 1.0));
double t_3 = Math.sqrt(y) + Math.pow((1.0 + y), 0.5);
double t_4 = Math.sqrt((1.0 + y));
double t_5 = (t_2 - Math.sqrt(x)) + (t_4 - Math.sqrt(y));
double t_6 = t_1 - Math.sqrt(t);
double t_7 = Math.sqrt(x) + t_2;
double tmp;
if (t_5 <= 0.0) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + ((0.5 * Math.sqrt((1.0 / z))) + t_6));
} else if (t_5 <= 1.95) {
tmp = (((t_3 * (x + (1.0 - x))) + t_7) / (t_3 * t_7)) + t_6;
} else {
tmp = ((1.0 + t_4) + ((1.0 / (t_1 + Math.sqrt(t))) + (1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))))) - (Math.sqrt(x) + Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) t_2 = math.sqrt((x + 1.0)) t_3 = math.sqrt(y) + math.pow((1.0 + y), 0.5) t_4 = math.sqrt((1.0 + y)) t_5 = (t_2 - math.sqrt(x)) + (t_4 - math.sqrt(y)) t_6 = t_1 - math.sqrt(t) t_7 = math.sqrt(x) + t_2 tmp = 0 if t_5 <= 0.0: tmp = (0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + ((0.5 * math.sqrt((1.0 / z))) + t_6)) elif t_5 <= 1.95: tmp = (((t_3 * (x + (1.0 - x))) + t_7) / (t_3 * t_7)) + t_6 else: tmp = ((1.0 + t_4) + ((1.0 / (t_1 + math.sqrt(t))) + (1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))))) - (math.sqrt(x) + math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + t)) t_2 = sqrt(Float64(x + 1.0)) t_3 = Float64(sqrt(y) + (Float64(1.0 + y) ^ 0.5)) t_4 = sqrt(Float64(1.0 + y)) t_5 = Float64(Float64(t_2 - sqrt(x)) + Float64(t_4 - sqrt(y))) t_6 = Float64(t_1 - sqrt(t)) t_7 = Float64(sqrt(x) + t_2) tmp = 0.0 if (t_5 <= 0.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + t_6))); elseif (t_5 <= 1.95) tmp = Float64(Float64(Float64(Float64(t_3 * Float64(x + Float64(1.0 - x))) + t_7) / Float64(t_3 * t_7)) + t_6); else tmp = Float64(Float64(Float64(1.0 + t_4) + Float64(Float64(1.0 / Float64(t_1 + sqrt(t))) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))))) - Float64(sqrt(x) + sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t));
t_2 = sqrt((x + 1.0));
t_3 = sqrt(y) + ((1.0 + y) ^ 0.5);
t_4 = sqrt((1.0 + y));
t_5 = (t_2 - sqrt(x)) + (t_4 - sqrt(y));
t_6 = t_1 - sqrt(t);
t_7 = sqrt(x) + t_2;
tmp = 0.0;
if (t_5 <= 0.0)
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + t_6));
elseif (t_5 <= 1.95)
tmp = (((t_3 * (x + (1.0 - x))) + t_7) / (t_3 * t_7)) + t_6;
else
tmp = ((1.0 + t_4) + ((1.0 / (t_1 + sqrt(t))) + (1.0 / (sqrt(z) + sqrt((1.0 + z)))))) - (sqrt(x) + sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[y], $MachinePrecision] + N[Power[N[(1.0 + y), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$5, 0.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 1.95], N[(N[(N[(N[(t$95$3 * N[(x + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$7), $MachinePrecision] / N[(t$95$3 * t$95$7), $MachinePrecision]), $MachinePrecision] + t$95$6), $MachinePrecision], N[(N[(N[(1.0 + t$95$4), $MachinePrecision] + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t}\\
t_2 := \sqrt{x + 1}\\
t_3 := \sqrt{y} + {\left(1 + y\right)}^{0.5}\\
t_4 := \sqrt{1 + y}\\
t_5 := \left(t\_2 - \sqrt{x}\right) + \left(t\_4 - \sqrt{y}\right)\\
t_6 := t\_1 - \sqrt{t}\\
t_7 := \sqrt{x} + t\_2\\
\mathbf{if}\;t\_5 \leq 0:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + t\_6\right)\right)\\
\mathbf{elif}\;t\_5 \leq 1.95:\\
\;\;\;\;\frac{t\_3 \cdot \left(x + \left(1 - x\right)\right) + t\_7}{t\_3 \cdot t\_7} + t\_6\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t\_4\right) + \left(\frac{1}{t\_1 + \sqrt{t}} + \frac{1}{\sqrt{z} + \sqrt{1 + z}}\right)\right) - \left(\sqrt{x} + \sqrt{y}\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.0Initial program 75.8%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified46.1%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6440.6%
Simplified40.6%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6443.6%
Simplified43.6%
Taylor expanded in x around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6448.9%
Simplified48.9%
if 0.0 < (+.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))) < 1.94999999999999996Initial program 93.2%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6434.1%
Simplified34.1%
Applied egg-rr59.2%
if 1.94999999999999996 < (+.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 98.7%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6499.1%
Applied egg-rr99.1%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6499.3%
Applied egg-rr99.3%
Taylor expanded in x around 0
--lowering--.f64N/A
Simplified98.4%
Final simplification66.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (sqrt (+ 1.0 t)))
(t_3 (sqrt (+ x 1.0)))
(t_4
(+
(* 0.5 (sqrt (/ 1.0 y)))
(+ (* 0.5 (sqrt (/ 1.0 z))) (- t_2 (sqrt t)))))
(t_5 (sqrt (+ 1.0 y)))
(t_6 (+ (+ (- t_3 (sqrt x)) (- t_5 (sqrt y))) (- t_1 (sqrt z)))))
(if (<= t_6 0.0)
(+ (* 0.5 (sqrt (/ 1.0 x))) t_4)
(if (<= t_6 1.0002)
(+ t_4 (/ (- (+ x 1.0) x) (+ (sqrt x) (pow (+ x 1.0) 0.5))))
(if (<= t_6 2.0025)
(+ t_3 (- (+ t_5 (/ 1.0 (+ (sqrt z) t_1))) (+ (sqrt x) (sqrt y))))
(+
(/ 1.0 (+ t_2 (sqrt t)))
(- (+ (+ 1.0 t_5) t_1) (+ (sqrt y) (+ (sqrt x) (sqrt z))))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + t));
double t_3 = sqrt((x + 1.0));
double t_4 = (0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t)));
double t_5 = sqrt((1.0 + y));
double t_6 = ((t_3 - sqrt(x)) + (t_5 - sqrt(y))) + (t_1 - sqrt(z));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * sqrt((1.0 / x))) + t_4;
} else if (t_6 <= 1.0002) {
tmp = t_4 + (((x + 1.0) - x) / (sqrt(x) + pow((x + 1.0), 0.5)));
} else if (t_6 <= 2.0025) {
tmp = t_3 + ((t_5 + (1.0 / (sqrt(z) + t_1))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 / (t_2 + sqrt(t))) + (((1.0 + t_5) + t_1) - (sqrt(y) + (sqrt(x) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + t))
t_3 = sqrt((x + 1.0d0))
t_4 = (0.5d0 * sqrt((1.0d0 / y))) + ((0.5d0 * sqrt((1.0d0 / z))) + (t_2 - sqrt(t)))
t_5 = sqrt((1.0d0 + y))
t_6 = ((t_3 - sqrt(x)) + (t_5 - sqrt(y))) + (t_1 - sqrt(z))
if (t_6 <= 0.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + t_4
else if (t_6 <= 1.0002d0) then
tmp = t_4 + (((x + 1.0d0) - x) / (sqrt(x) + ((x + 1.0d0) ** 0.5d0)))
else if (t_6 <= 2.0025d0) then
tmp = t_3 + ((t_5 + (1.0d0 / (sqrt(z) + t_1))) - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 / (t_2 + sqrt(t))) + (((1.0d0 + t_5) + t_1) - (sqrt(y) + (sqrt(x) + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + t));
double t_3 = Math.sqrt((x + 1.0));
double t_4 = (0.5 * Math.sqrt((1.0 / y))) + ((0.5 * Math.sqrt((1.0 / z))) + (t_2 - Math.sqrt(t)));
double t_5 = Math.sqrt((1.0 + y));
double t_6 = ((t_3 - Math.sqrt(x)) + (t_5 - Math.sqrt(y))) + (t_1 - Math.sqrt(z));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + t_4;
} else if (t_6 <= 1.0002) {
tmp = t_4 + (((x + 1.0) - x) / (Math.sqrt(x) + Math.pow((x + 1.0), 0.5)));
} else if (t_6 <= 2.0025) {
tmp = t_3 + ((t_5 + (1.0 / (Math.sqrt(z) + t_1))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 / (t_2 + Math.sqrt(t))) + (((1.0 + t_5) + t_1) - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + t)) t_3 = math.sqrt((x + 1.0)) t_4 = (0.5 * math.sqrt((1.0 / y))) + ((0.5 * math.sqrt((1.0 / z))) + (t_2 - math.sqrt(t))) t_5 = math.sqrt((1.0 + y)) t_6 = ((t_3 - math.sqrt(x)) + (t_5 - math.sqrt(y))) + (t_1 - math.sqrt(z)) tmp = 0 if t_6 <= 0.0: tmp = (0.5 * math.sqrt((1.0 / x))) + t_4 elif t_6 <= 1.0002: tmp = t_4 + (((x + 1.0) - x) / (math.sqrt(x) + math.pow((x + 1.0), 0.5))) elif t_6 <= 2.0025: tmp = t_3 + ((t_5 + (1.0 / (math.sqrt(z) + t_1))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 / (t_2 + math.sqrt(t))) + (((1.0 + t_5) + t_1) - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + t)) t_3 = sqrt(Float64(x + 1.0)) t_4 = Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_2 - sqrt(t)))) t_5 = sqrt(Float64(1.0 + y)) t_6 = Float64(Float64(Float64(t_3 - sqrt(x)) + Float64(t_5 - sqrt(y))) + Float64(t_1 - sqrt(z))) tmp = 0.0 if (t_6 <= 0.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_4); elseif (t_6 <= 1.0002) tmp = Float64(t_4 + Float64(Float64(Float64(x + 1.0) - x) / Float64(sqrt(x) + (Float64(x + 1.0) ^ 0.5)))); elseif (t_6 <= 2.0025) tmp = Float64(t_3 + Float64(Float64(t_5 + Float64(1.0 / Float64(sqrt(z) + t_1))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(t_2 + sqrt(t))) + Float64(Float64(Float64(1.0 + t_5) + t_1) - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + t));
t_3 = sqrt((x + 1.0));
t_4 = (0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t)));
t_5 = sqrt((1.0 + y));
t_6 = ((t_3 - sqrt(x)) + (t_5 - sqrt(y))) + (t_1 - sqrt(z));
tmp = 0.0;
if (t_6 <= 0.0)
tmp = (0.5 * sqrt((1.0 / x))) + t_4;
elseif (t_6 <= 1.0002)
tmp = t_4 + (((x + 1.0) - x) / (sqrt(x) + ((x + 1.0) ^ 0.5)));
elseif (t_6 <= 2.0025)
tmp = t_3 + ((t_5 + (1.0 / (sqrt(z) + t_1))) - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 / (t_2 + sqrt(t))) + (((1.0 + t_5) + t_1) - (sqrt(y) + (sqrt(x) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$5 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 0.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision], If[LessEqual[t$95$6, 1.0002], N[(t$95$4 + N[(N[(N[(x + 1.0), $MachinePrecision] - x), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Power[N[(x + 1.0), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 2.0025], N[(t$95$3 + N[(N[(t$95$5 + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t$95$5), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $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}\\
t_2 := \sqrt{1 + t}\\
t_3 := \sqrt{x + 1}\\
t_4 := 0.5 \cdot \sqrt{\frac{1}{y}} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_2 - \sqrt{t}\right)\right)\\
t_5 := \sqrt{1 + y}\\
t_6 := \left(\left(t\_3 - \sqrt{x}\right) + \left(t\_5 - \sqrt{y}\right)\right) + \left(t\_1 - \sqrt{z}\right)\\
\mathbf{if}\;t\_6 \leq 0:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + t\_4\\
\mathbf{elif}\;t\_6 \leq 1.0002:\\
\;\;\;\;t\_4 + \frac{\left(x + 1\right) - x}{\sqrt{x} + {\left(x + 1\right)}^{0.5}}\\
\mathbf{elif}\;t\_6 \leq 2.0025:\\
\;\;\;\;t\_3 + \left(\left(t\_5 + \frac{1}{\sqrt{z} + t\_1}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{t}} + \left(\left(\left(1 + t\_5\right) + t\_1\right) - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.0Initial program 59.0%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified3.5%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6469.9%
Simplified69.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6476.0%
Simplified76.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6486.6%
Simplified86.6%
if 0.0 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.0002Initial program 90.6%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified54.6%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6465.9%
Simplified65.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6443.3%
Simplified43.3%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f6443.9%
Applied egg-rr43.9%
if 1.0002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.00249999999999995Initial program 97.7%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6498.1%
Applied egg-rr98.1%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6498.5%
Applied egg-rr98.5%
Taylor expanded in t around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6432.0%
Simplified32.0%
if 2.00249999999999995 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 98.3%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6494.4%
Simplified94.4%
flip--N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
+-commutativeN/A
+-commutativeN/A
associate--l+N/A
+-inversesN/A
metadata-evalN/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6495.9%
Applied egg-rr95.9%
Final simplification52.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (sqrt (+ 1.0 t)))
(t_3 (sqrt (+ x 1.0)))
(t_4
(+
(* 0.5 (sqrt (/ 1.0 y)))
(+ (* 0.5 (sqrt (/ 1.0 z))) (- t_2 (sqrt t)))))
(t_5 (sqrt (+ 1.0 y)))
(t_6 (+ (+ (- t_3 (sqrt x)) (- t_5 (sqrt y))) (- t_1 (sqrt z)))))
(if (<= t_6 0.0)
(+ (* 0.5 (sqrt (/ 1.0 x))) t_4)
(if (<= t_6 1.0002)
(+ t_4 (/ (- (+ x 1.0) x) (+ (sqrt x) (pow (+ x 1.0) 0.5))))
(if (<= t_6 2.98)
(+ t_3 (- (+ t_5 (/ 1.0 (+ (sqrt z) t_1))) (+ (sqrt x) (sqrt y))))
(+
(-
(+ (+ t_5 2.0) (* z (+ 0.5 (* z (+ -0.125 (* z 0.0625))))))
(+ (sqrt y) (+ (sqrt x) (sqrt z))))
(/ (- (+ 1.0 t) t) (+ t_2 (sqrt t)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + t));
double t_3 = sqrt((x + 1.0));
double t_4 = (0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t)));
double t_5 = sqrt((1.0 + y));
double t_6 = ((t_3 - sqrt(x)) + (t_5 - sqrt(y))) + (t_1 - sqrt(z));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * sqrt((1.0 / x))) + t_4;
} else if (t_6 <= 1.0002) {
tmp = t_4 + (((x + 1.0) - x) / (sqrt(x) + pow((x + 1.0), 0.5)));
} else if (t_6 <= 2.98) {
tmp = t_3 + ((t_5 + (1.0 / (sqrt(z) + t_1))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (((t_5 + 2.0) + (z * (0.5 + (z * (-0.125 + (z * 0.0625)))))) - (sqrt(y) + (sqrt(x) + sqrt(z)))) + (((1.0 + t) - t) / (t_2 + sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + t))
t_3 = sqrt((x + 1.0d0))
t_4 = (0.5d0 * sqrt((1.0d0 / y))) + ((0.5d0 * sqrt((1.0d0 / z))) + (t_2 - sqrt(t)))
t_5 = sqrt((1.0d0 + y))
t_6 = ((t_3 - sqrt(x)) + (t_5 - sqrt(y))) + (t_1 - sqrt(z))
if (t_6 <= 0.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + t_4
else if (t_6 <= 1.0002d0) then
tmp = t_4 + (((x + 1.0d0) - x) / (sqrt(x) + ((x + 1.0d0) ** 0.5d0)))
else if (t_6 <= 2.98d0) then
tmp = t_3 + ((t_5 + (1.0d0 / (sqrt(z) + t_1))) - (sqrt(x) + sqrt(y)))
else
tmp = (((t_5 + 2.0d0) + (z * (0.5d0 + (z * ((-0.125d0) + (z * 0.0625d0)))))) - (sqrt(y) + (sqrt(x) + sqrt(z)))) + (((1.0d0 + t) - t) / (t_2 + sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + t));
double t_3 = Math.sqrt((x + 1.0));
double t_4 = (0.5 * Math.sqrt((1.0 / y))) + ((0.5 * Math.sqrt((1.0 / z))) + (t_2 - Math.sqrt(t)));
double t_5 = Math.sqrt((1.0 + y));
double t_6 = ((t_3 - Math.sqrt(x)) + (t_5 - Math.sqrt(y))) + (t_1 - Math.sqrt(z));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + t_4;
} else if (t_6 <= 1.0002) {
tmp = t_4 + (((x + 1.0) - x) / (Math.sqrt(x) + Math.pow((x + 1.0), 0.5)));
} else if (t_6 <= 2.98) {
tmp = t_3 + ((t_5 + (1.0 / (Math.sqrt(z) + t_1))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (((t_5 + 2.0) + (z * (0.5 + (z * (-0.125 + (z * 0.0625)))))) - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)))) + (((1.0 + t) - t) / (t_2 + Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + t)) t_3 = math.sqrt((x + 1.0)) t_4 = (0.5 * math.sqrt((1.0 / y))) + ((0.5 * math.sqrt((1.0 / z))) + (t_2 - math.sqrt(t))) t_5 = math.sqrt((1.0 + y)) t_6 = ((t_3 - math.sqrt(x)) + (t_5 - math.sqrt(y))) + (t_1 - math.sqrt(z)) tmp = 0 if t_6 <= 0.0: tmp = (0.5 * math.sqrt((1.0 / x))) + t_4 elif t_6 <= 1.0002: tmp = t_4 + (((x + 1.0) - x) / (math.sqrt(x) + math.pow((x + 1.0), 0.5))) elif t_6 <= 2.98: tmp = t_3 + ((t_5 + (1.0 / (math.sqrt(z) + t_1))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (((t_5 + 2.0) + (z * (0.5 + (z * (-0.125 + (z * 0.0625)))))) - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z)))) + (((1.0 + t) - t) / (t_2 + math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + t)) t_3 = sqrt(Float64(x + 1.0)) t_4 = Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_2 - sqrt(t)))) t_5 = sqrt(Float64(1.0 + y)) t_6 = Float64(Float64(Float64(t_3 - sqrt(x)) + Float64(t_5 - sqrt(y))) + Float64(t_1 - sqrt(z))) tmp = 0.0 if (t_6 <= 0.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_4); elseif (t_6 <= 1.0002) tmp = Float64(t_4 + Float64(Float64(Float64(x + 1.0) - x) / Float64(sqrt(x) + (Float64(x + 1.0) ^ 0.5)))); elseif (t_6 <= 2.98) tmp = Float64(t_3 + Float64(Float64(t_5 + Float64(1.0 / Float64(sqrt(z) + t_1))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(Float64(t_5 + 2.0) + Float64(z * Float64(0.5 + Float64(z * Float64(-0.125 + Float64(z * 0.0625)))))) - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))) + Float64(Float64(Float64(1.0 + t) - t) / Float64(t_2 + sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + t));
t_3 = sqrt((x + 1.0));
t_4 = (0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t)));
t_5 = sqrt((1.0 + y));
t_6 = ((t_3 - sqrt(x)) + (t_5 - sqrt(y))) + (t_1 - sqrt(z));
tmp = 0.0;
if (t_6 <= 0.0)
tmp = (0.5 * sqrt((1.0 / x))) + t_4;
elseif (t_6 <= 1.0002)
tmp = t_4 + (((x + 1.0) - x) / (sqrt(x) + ((x + 1.0) ^ 0.5)));
elseif (t_6 <= 2.98)
tmp = t_3 + ((t_5 + (1.0 / (sqrt(z) + t_1))) - (sqrt(x) + sqrt(y)));
else
tmp = (((t_5 + 2.0) + (z * (0.5 + (z * (-0.125 + (z * 0.0625)))))) - (sqrt(y) + (sqrt(x) + sqrt(z)))) + (((1.0 + t) - t) / (t_2 + sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$5 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 0.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision], If[LessEqual[t$95$6, 1.0002], N[(t$95$4 + N[(N[(N[(x + 1.0), $MachinePrecision] - x), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Power[N[(x + 1.0), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 2.98], N[(t$95$3 + N[(N[(t$95$5 + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t$95$5 + 2.0), $MachinePrecision] + N[(z * N[(0.5 + N[(z * N[(-0.125 + N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t), $MachinePrecision] - t), $MachinePrecision] / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{1 + t}\\
t_3 := \sqrt{x + 1}\\
t_4 := 0.5 \cdot \sqrt{\frac{1}{y}} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_2 - \sqrt{t}\right)\right)\\
t_5 := \sqrt{1 + y}\\
t_6 := \left(\left(t\_3 - \sqrt{x}\right) + \left(t\_5 - \sqrt{y}\right)\right) + \left(t\_1 - \sqrt{z}\right)\\
\mathbf{if}\;t\_6 \leq 0:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + t\_4\\
\mathbf{elif}\;t\_6 \leq 1.0002:\\
\;\;\;\;t\_4 + \frac{\left(x + 1\right) - x}{\sqrt{x} + {\left(x + 1\right)}^{0.5}}\\
\mathbf{elif}\;t\_6 \leq 2.98:\\
\;\;\;\;t\_3 + \left(\left(t\_5 + \frac{1}{\sqrt{z} + t\_1}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t\_5 + 2\right) + z \cdot \left(0.5 + z \cdot \left(-0.125 + z \cdot 0.0625\right)\right)\right) - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right) + \frac{\left(1 + t\right) - t}{t\_2 + \sqrt{t}}\\
\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.0Initial program 59.0%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified3.5%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6469.9%
Simplified69.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6476.0%
Simplified76.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6486.6%
Simplified86.6%
if 0.0 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.0002Initial program 90.6%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified54.6%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6465.9%
Simplified65.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6443.3%
Simplified43.3%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f6443.9%
Applied egg-rr43.9%
if 1.0002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.97999999999999998Initial program 97.7%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6498.1%
Applied egg-rr98.1%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6498.5%
Applied egg-rr98.5%
Taylor expanded in t around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6432.6%
Simplified32.6%
if 2.97999999999999998 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 98.3%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6497.0%
Simplified97.0%
Taylor expanded in z around 0
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f6497.0%
Simplified97.0%
flip--N/A
/-lowering-/.f64N/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6497.6%
Applied egg-rr97.6%
Final simplification52.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (sqrt (+ 1.0 t)))
(t_4 (sqrt (+ 1.0 y)))
(t_5 (+ (+ t_1 (- t_4 (sqrt y))) (- t_2 (sqrt z))))
(t_6 (+ (* 0.5 (sqrt (/ 1.0 z))) (- t_3 (sqrt t)))))
(if (<= t_5 4e-5)
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) t_6)
(/ (+ (* (sqrt x) 0.5) (* (sqrt (/ 1.0 x)) -0.125)) x))
(if (<= t_5 1.9999999999985)
(+ t_1 (+ t_6 (/ 1.0 (+ (sqrt y) (pow (+ 1.0 y) 0.5)))))
(-
(+ (+ 1.0 t_4) (+ (/ 1.0 (+ t_3 (sqrt t))) (/ 1.0 (+ (sqrt z) t_2))))
(+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + t));
double t_4 = sqrt((1.0 + y));
double t_5 = (t_1 + (t_4 - sqrt(y))) + (t_2 - sqrt(z));
double t_6 = (0.5 * sqrt((1.0 / z))) + (t_3 - sqrt(t));
double tmp;
if (t_5 <= 4e-5) {
tmp = ((0.5 * sqrt((1.0 / y))) + t_6) + (((sqrt(x) * 0.5) + (sqrt((1.0 / x)) * -0.125)) / x);
} else if (t_5 <= 1.9999999999985) {
tmp = t_1 + (t_6 + (1.0 / (sqrt(y) + pow((1.0 + y), 0.5))));
} else {
tmp = ((1.0 + t_4) + ((1.0 / (t_3 + sqrt(t))) + (1.0 / (sqrt(z) + t_2)))) - (sqrt(x) + sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: 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((x + 1.0d0)) - sqrt(x)
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + t))
t_4 = sqrt((1.0d0 + y))
t_5 = (t_1 + (t_4 - sqrt(y))) + (t_2 - sqrt(z))
t_6 = (0.5d0 * sqrt((1.0d0 / z))) + (t_3 - sqrt(t))
if (t_5 <= 4d-5) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + t_6) + (((sqrt(x) * 0.5d0) + (sqrt((1.0d0 / x)) * (-0.125d0))) / x)
else if (t_5 <= 1.9999999999985d0) then
tmp = t_1 + (t_6 + (1.0d0 / (sqrt(y) + ((1.0d0 + y) ** 0.5d0))))
else
tmp = ((1.0d0 + t_4) + ((1.0d0 / (t_3 + sqrt(t))) + (1.0d0 / (sqrt(z) + t_2)))) - (sqrt(x) + sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + t));
double t_4 = Math.sqrt((1.0 + y));
double t_5 = (t_1 + (t_4 - Math.sqrt(y))) + (t_2 - Math.sqrt(z));
double t_6 = (0.5 * Math.sqrt((1.0 / z))) + (t_3 - Math.sqrt(t));
double tmp;
if (t_5 <= 4e-5) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + t_6) + (((Math.sqrt(x) * 0.5) + (Math.sqrt((1.0 / x)) * -0.125)) / x);
} else if (t_5 <= 1.9999999999985) {
tmp = t_1 + (t_6 + (1.0 / (Math.sqrt(y) + Math.pow((1.0 + y), 0.5))));
} else {
tmp = ((1.0 + t_4) + ((1.0 / (t_3 + Math.sqrt(t))) + (1.0 / (Math.sqrt(z) + t_2)))) - (Math.sqrt(x) + Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + t)) t_4 = math.sqrt((1.0 + y)) t_5 = (t_1 + (t_4 - math.sqrt(y))) + (t_2 - math.sqrt(z)) t_6 = (0.5 * math.sqrt((1.0 / z))) + (t_3 - math.sqrt(t)) tmp = 0 if t_5 <= 4e-5: tmp = ((0.5 * math.sqrt((1.0 / y))) + t_6) + (((math.sqrt(x) * 0.5) + (math.sqrt((1.0 / x)) * -0.125)) / x) elif t_5 <= 1.9999999999985: tmp = t_1 + (t_6 + (1.0 / (math.sqrt(y) + math.pow((1.0 + y), 0.5)))) else: tmp = ((1.0 + t_4) + ((1.0 / (t_3 + math.sqrt(t))) + (1.0 / (math.sqrt(z) + t_2)))) - (math.sqrt(x) + math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + t)) t_4 = sqrt(Float64(1.0 + y)) t_5 = Float64(Float64(t_1 + Float64(t_4 - sqrt(y))) + Float64(t_2 - sqrt(z))) t_6 = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_3 - sqrt(t))) tmp = 0.0 if (t_5 <= 4e-5) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + t_6) + Float64(Float64(Float64(sqrt(x) * 0.5) + Float64(sqrt(Float64(1.0 / x)) * -0.125)) / x)); elseif (t_5 <= 1.9999999999985) tmp = Float64(t_1 + Float64(t_6 + Float64(1.0 / Float64(sqrt(y) + (Float64(1.0 + y) ^ 0.5))))); else tmp = Float64(Float64(Float64(1.0 + t_4) + Float64(Float64(1.0 / Float64(t_3 + sqrt(t))) + Float64(1.0 / Float64(sqrt(z) + t_2)))) - Float64(sqrt(x) + sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + t));
t_4 = sqrt((1.0 + y));
t_5 = (t_1 + (t_4 - sqrt(y))) + (t_2 - sqrt(z));
t_6 = (0.5 * sqrt((1.0 / z))) + (t_3 - sqrt(t));
tmp = 0.0;
if (t_5 <= 4e-5)
tmp = ((0.5 * sqrt((1.0 / y))) + t_6) + (((sqrt(x) * 0.5) + (sqrt((1.0 / x)) * -0.125)) / x);
elseif (t_5 <= 1.9999999999985)
tmp = t_1 + (t_6 + (1.0 / (sqrt(y) + ((1.0 + y) ^ 0.5))));
else
tmp = ((1.0 + t_4) + ((1.0 / (t_3 + sqrt(t))) + (1.0 / (sqrt(z) + t_2)))) - (sqrt(x) + sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$1 + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 4e-5], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$6), $MachinePrecision] + N[(N[(N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision] + N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 1.9999999999985], N[(t$95$1 + N[(t$95$6 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Power[N[(1.0 + y), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$4), $MachinePrecision] + N[(N[(1.0 / N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t}\\
t_4 := \sqrt{1 + y}\\
t_5 := \left(t\_1 + \left(t\_4 - \sqrt{y}\right)\right) + \left(t\_2 - \sqrt{z}\right)\\
t_6 := 0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_3 - \sqrt{t}\right)\\
\mathbf{if}\;t\_5 \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + t\_6\right) + \frac{\sqrt{x} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot -0.125}{x}\\
\mathbf{elif}\;t\_5 \leq 1.9999999999985:\\
\;\;\;\;t\_1 + \left(t\_6 + \frac{1}{\sqrt{y} + {\left(1 + y\right)}^{0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t\_4\right) + \left(\frac{1}{t\_3 + \sqrt{t}} + \frac{1}{\sqrt{z} + t\_2}\right)\right) - \left(\sqrt{x} + \sqrt{y}\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))) < 4.00000000000000033e-5Initial program 56.4%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified4.0%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6468.8%
Simplified68.8%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6476.5%
Simplified76.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6487.5%
Simplified87.5%
if 4.00000000000000033e-5 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.99999999999850009Initial program 93.2%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified57.0%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6464.8%
Simplified64.8%
+-commutativeN/A
flip--N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
associate--l+N/A
+-inversesN/A
metadata-evalN/A
+-commutativeN/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6465.4%
Applied egg-rr65.4%
if 1.99999999999850009 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 98.1%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6498.6%
Applied egg-rr98.6%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6498.7%
Applied egg-rr98.7%
Taylor expanded in x around 0
--lowering--.f64N/A
Simplified56.8%
Final simplification64.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (sqrt (+ 1.0 t)))
(t_3
(+
(* 0.5 (sqrt (/ 1.0 y)))
(+ (* 0.5 (sqrt (/ 1.0 z))) (- t_2 (sqrt t)))))
(t_4 (sqrt (+ 1.0 y)))
(t_5
(+
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (- t_4 (sqrt y)))
(- t_1 (sqrt z)))))
(if (<= t_5 0.0)
(+ (* 0.5 (sqrt (/ 1.0 x))) t_3)
(if (<= t_5 1.0002)
(+ t_3 (/ (- (+ x 1.0) x) (+ (sqrt x) (pow (+ x 1.0) 0.5))))
(-
(+ (+ 1.0 t_4) (+ (/ 1.0 (+ t_2 (sqrt t))) (/ 1.0 (+ (sqrt z) t_1))))
(+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + t));
double t_3 = (0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t)));
double t_4 = sqrt((1.0 + y));
double t_5 = ((sqrt((x + 1.0)) - sqrt(x)) + (t_4 - sqrt(y))) + (t_1 - sqrt(z));
double tmp;
if (t_5 <= 0.0) {
tmp = (0.5 * sqrt((1.0 / x))) + t_3;
} else if (t_5 <= 1.0002) {
tmp = t_3 + (((x + 1.0) - x) / (sqrt(x) + pow((x + 1.0), 0.5)));
} else {
tmp = ((1.0 + t_4) + ((1.0 / (t_2 + sqrt(t))) + (1.0 / (sqrt(z) + t_1)))) - (sqrt(x) + sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + t))
t_3 = (0.5d0 * sqrt((1.0d0 / y))) + ((0.5d0 * sqrt((1.0d0 / z))) + (t_2 - sqrt(t)))
t_4 = sqrt((1.0d0 + y))
t_5 = ((sqrt((x + 1.0d0)) - sqrt(x)) + (t_4 - sqrt(y))) + (t_1 - sqrt(z))
if (t_5 <= 0.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + t_3
else if (t_5 <= 1.0002d0) then
tmp = t_3 + (((x + 1.0d0) - x) / (sqrt(x) + ((x + 1.0d0) ** 0.5d0)))
else
tmp = ((1.0d0 + t_4) + ((1.0d0 / (t_2 + sqrt(t))) + (1.0d0 / (sqrt(z) + t_1)))) - (sqrt(x) + sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + t));
double t_3 = (0.5 * Math.sqrt((1.0 / y))) + ((0.5 * Math.sqrt((1.0 / z))) + (t_2 - Math.sqrt(t)));
double t_4 = Math.sqrt((1.0 + y));
double t_5 = ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (t_4 - Math.sqrt(y))) + (t_1 - Math.sqrt(z));
double tmp;
if (t_5 <= 0.0) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + t_3;
} else if (t_5 <= 1.0002) {
tmp = t_3 + (((x + 1.0) - x) / (Math.sqrt(x) + Math.pow((x + 1.0), 0.5)));
} else {
tmp = ((1.0 + t_4) + ((1.0 / (t_2 + Math.sqrt(t))) + (1.0 / (Math.sqrt(z) + t_1)))) - (Math.sqrt(x) + Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + t)) t_3 = (0.5 * math.sqrt((1.0 / y))) + ((0.5 * math.sqrt((1.0 / z))) + (t_2 - math.sqrt(t))) t_4 = math.sqrt((1.0 + y)) t_5 = ((math.sqrt((x + 1.0)) - math.sqrt(x)) + (t_4 - math.sqrt(y))) + (t_1 - math.sqrt(z)) tmp = 0 if t_5 <= 0.0: tmp = (0.5 * math.sqrt((1.0 / x))) + t_3 elif t_5 <= 1.0002: tmp = t_3 + (((x + 1.0) - x) / (math.sqrt(x) + math.pow((x + 1.0), 0.5))) else: tmp = ((1.0 + t_4) + ((1.0 / (t_2 + math.sqrt(t))) + (1.0 / (math.sqrt(z) + t_1)))) - (math.sqrt(x) + math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + t)) t_3 = Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_2 - sqrt(t)))) t_4 = sqrt(Float64(1.0 + y)) t_5 = Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(t_4 - sqrt(y))) + Float64(t_1 - sqrt(z))) tmp = 0.0 if (t_5 <= 0.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_3); elseif (t_5 <= 1.0002) tmp = Float64(t_3 + Float64(Float64(Float64(x + 1.0) - x) / Float64(sqrt(x) + (Float64(x + 1.0) ^ 0.5)))); else tmp = Float64(Float64(Float64(1.0 + t_4) + Float64(Float64(1.0 / Float64(t_2 + sqrt(t))) + Float64(1.0 / Float64(sqrt(z) + t_1)))) - Float64(sqrt(x) + sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + t));
t_3 = (0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t)));
t_4 = sqrt((1.0 + y));
t_5 = ((sqrt((x + 1.0)) - sqrt(x)) + (t_4 - sqrt(y))) + (t_1 - sqrt(z));
tmp = 0.0;
if (t_5 <= 0.0)
tmp = (0.5 * sqrt((1.0 / x))) + t_3;
elseif (t_5 <= 1.0002)
tmp = t_3 + (((x + 1.0) - x) / (sqrt(x) + ((x + 1.0) ^ 0.5)));
else
tmp = ((1.0 + t_4) + ((1.0 / (t_2 + sqrt(t))) + (1.0 / (sqrt(z) + t_1)))) - (sqrt(x) + sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 0.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision], If[LessEqual[t$95$5, 1.0002], N[(t$95$3 + N[(N[(N[(x + 1.0), $MachinePrecision] - x), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Power[N[(x + 1.0), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$4), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $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{1 + t}\\
t_3 := 0.5 \cdot \sqrt{\frac{1}{y}} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_2 - \sqrt{t}\right)\right)\\
t_4 := \sqrt{1 + y}\\
t_5 := \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(t\_4 - \sqrt{y}\right)\right) + \left(t\_1 - \sqrt{z}\right)\\
\mathbf{if}\;t\_5 \leq 0:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + t\_3\\
\mathbf{elif}\;t\_5 \leq 1.0002:\\
\;\;\;\;t\_3 + \frac{\left(x + 1\right) - x}{\sqrt{x} + {\left(x + 1\right)}^{0.5}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t\_4\right) + \left(\frac{1}{t\_2 + \sqrt{t}} + \frac{1}{\sqrt{z} + t\_1}\right)\right) - \left(\sqrt{x} + \sqrt{y}\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.0Initial program 59.0%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified3.5%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6469.9%
Simplified69.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6476.0%
Simplified76.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6486.6%
Simplified86.6%
if 0.0 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.0002Initial program 90.6%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified54.6%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6465.9%
Simplified65.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6443.3%
Simplified43.3%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f6443.9%
Applied egg-rr43.9%
if 1.0002 < (+.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.9%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6498.3%
Applied egg-rr98.3%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6498.6%
Applied egg-rr98.6%
Taylor expanded in x around 0
--lowering--.f64N/A
Simplified52.3%
Final simplification53.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x))))
(if (<= t_1 4e-5)
(+
(+
(* 0.5 (sqrt (/ 1.0 y)))
(+ (* 0.5 (sqrt (/ 1.0 z))) (- (sqrt (+ 1.0 t)) (sqrt t))))
(/ (+ (* (sqrt x) 0.5) (* (sqrt (/ 1.0 x)) -0.125)) x))
(+
t_1
(+
(/ (- (+ 1.0 y) y) (+ (sqrt y) (sqrt (+ 1.0 y))))
(- (sqrt (+ 1.0 z)) (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t_1 <= 4e-5) {
tmp = ((0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + (sqrt((1.0 + t)) - sqrt(t)))) + (((sqrt(x) * 0.5) + (sqrt((1.0 / x)) * -0.125)) / x);
} else {
tmp = t_1 + ((((1.0 + y) - y) / (sqrt(y) + sqrt((1.0 + y)))) + (sqrt((1.0 + z)) - sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (t_1 <= 4d-5) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + ((0.5d0 * sqrt((1.0d0 / z))) + (sqrt((1.0d0 + t)) - sqrt(t)))) + (((sqrt(x) * 0.5d0) + (sqrt((1.0d0 / x)) * (-0.125d0))) / x)
else
tmp = t_1 + ((((1.0d0 + y) - y) / (sqrt(y) + sqrt((1.0d0 + y)))) + (sqrt((1.0d0 + z)) - sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t_1 <= 4e-5) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + ((0.5 * Math.sqrt((1.0 / z))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)))) + (((Math.sqrt(x) * 0.5) + (Math.sqrt((1.0 / x)) * -0.125)) / x);
} else {
tmp = t_1 + ((((1.0 + y) - y) / (Math.sqrt(y) + Math.sqrt((1.0 + y)))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t_1 <= 4e-5: tmp = ((0.5 * math.sqrt((1.0 / y))) + ((0.5 * math.sqrt((1.0 / z))) + (math.sqrt((1.0 + t)) - math.sqrt(t)))) + (((math.sqrt(x) * 0.5) + (math.sqrt((1.0 / x)) * -0.125)) / x) else: tmp = t_1 + ((((1.0 + y) - y) / (math.sqrt(y) + math.sqrt((1.0 + y)))) + (math.sqrt((1.0 + z)) - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t_1 <= 4e-5) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))) + Float64(Float64(Float64(sqrt(x) * 0.5) + Float64(sqrt(Float64(1.0 / x)) * -0.125)) / x)); else tmp = Float64(t_1 + Float64(Float64(Float64(Float64(1.0 + y) - y) / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t_1 <= 4e-5)
tmp = ((0.5 * sqrt((1.0 / y))) + ((0.5 * sqrt((1.0 / z))) + (sqrt((1.0 + t)) - sqrt(t)))) + (((sqrt(x) * 0.5) + (sqrt((1.0 / x)) * -0.125)) / x);
else
tmp = t_1 + ((((1.0 + y) - y) / (sqrt(y) + sqrt((1.0 + y)))) + (sqrt((1.0 + z)) - sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e-5], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision] + N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[(N[(1.0 + y), $MachinePrecision] - y), $MachinePrecision] / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\right) + \frac{\sqrt{x} \cdot 0.5 + \sqrt{\frac{1}{x}} \cdot -0.125}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\frac{\left(1 + y\right) - y}{\sqrt{y} + \sqrt{1 + y}} + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 4.00000000000000033e-5Initial program 83.3%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified57.3%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6444.6%
Simplified44.6%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6426.4%
Simplified26.4%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6429.5%
Simplified29.5%
if 4.00000000000000033e-5 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.7%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified66.6%
Taylor expanded in t around inf
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6458.7%
Simplified58.7%
flip--N/A
/-lowering-/.f64N/A
rem-square-sqrtN/A
--lowering--.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6458.7%
Applied egg-rr58.7%
Final simplification44.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x))))
(if (<= t_1 4e-5)
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+
(* -0.125 (sqrt (/ 1.0 (* x (* x x)))))
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y))))))
(+
t_1
(+
(/ (- (+ 1.0 y) y) (+ (sqrt y) (sqrt (+ 1.0 y))))
(- (sqrt (+ 1.0 z)) (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t_1 <= 4e-5) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((-0.125 * sqrt((1.0 / (x * (x * x))))) + (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))));
} else {
tmp = t_1 + ((((1.0 + y) - y) / (sqrt(y) + sqrt((1.0 + y)))) + (sqrt((1.0 + z)) - sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (t_1 <= 4d-5) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + (((-0.125d0) * sqrt((1.0d0 / (x * (x * x))))) + (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y)))))
else
tmp = t_1 + ((((1.0d0 + y) - y) / (sqrt(y) + sqrt((1.0d0 + y)))) + (sqrt((1.0d0 + z)) - sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t_1 <= 4e-5) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((-0.125 * Math.sqrt((1.0 / (x * (x * x))))) + (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y)))));
} else {
tmp = t_1 + ((((1.0 + y) - y) / (Math.sqrt(y) + Math.sqrt((1.0 + y)))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t_1 <= 4e-5: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((-0.125 * math.sqrt((1.0 / (x * (x * x))))) + (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y))))) else: tmp = t_1 + ((((1.0 + y) - y) / (math.sqrt(y) + math.sqrt((1.0 + y)))) + (math.sqrt((1.0 + z)) - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t_1 <= 4e-5) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(-0.125 * sqrt(Float64(1.0 / Float64(x * Float64(x * x))))) + Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))))); else tmp = Float64(t_1 + Float64(Float64(Float64(Float64(1.0 + y) - y) / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t_1 <= 4e-5)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((-0.125 * sqrt((1.0 / (x * (x * x))))) + (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))));
else
tmp = t_1 + ((((1.0 + y) - y) / (sqrt(y) + sqrt((1.0 + y)))) + (sqrt((1.0 + z)) - sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e-5], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[(N[(1.0 + y), $MachinePrecision] - y), $MachinePrecision] / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(-0.125 \cdot \sqrt{\frac{1}{x \cdot \left(x \cdot x\right)}} + 0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\frac{\left(1 + y\right) - y}{\sqrt{y} + \sqrt{1 + y}} + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 4.00000000000000033e-5Initial program 83.3%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6443.0%
Simplified43.0%
Taylor expanded in y around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6422.4%
Simplified22.4%
Taylor expanded in x around inf
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6427.6%
Simplified27.6%
if 4.00000000000000033e-5 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.7%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified66.6%
Taylor expanded in t around inf
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6458.7%
Simplified58.7%
flip--N/A
/-lowering-/.f64N/A
rem-square-sqrtN/A
--lowering--.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6458.7%
Applied egg-rr58.7%
Final simplification43.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 (+ x 1.0)) (sqrt x))))
(if (<= t_1 4e-5)
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+
(* -0.125 (sqrt (/ 1.0 (* x (* x x)))))
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y))))))
(+ t_1 (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 y)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t_1 <= 4e-5) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((-0.125 * sqrt((1.0 / (x * (x * x))))) + (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))));
} else {
tmp = t_1 + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (t_1 <= 4d-5) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + (((-0.125d0) * sqrt((1.0d0 / (x * (x * x))))) + (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y)))))
else
tmp = t_1 + ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + y)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t_1 <= 4e-5) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((-0.125 * Math.sqrt((1.0 / (x * (x * x))))) + (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y)))));
} else {
tmp = t_1 + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t_1 <= 4e-5: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((-0.125 * math.sqrt((1.0 / (x * (x * x))))) + (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y))))) else: tmp = t_1 + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t_1 <= 4e-5) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(-0.125 * sqrt(Float64(1.0 / Float64(x * Float64(x * x))))) + Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))))); else tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t_1 <= 4e-5)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((-0.125 * sqrt((1.0 / (x * (x * x))))) + (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))));
else
tmp = t_1 + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e-5], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(-0.125 \cdot \sqrt{\frac{1}{x \cdot \left(x \cdot x\right)}} + 0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 4.00000000000000033e-5Initial program 83.3%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6443.0%
Simplified43.0%
Taylor expanded in y around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6422.4%
Simplified22.4%
Taylor expanded in x around inf
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6427.6%
Simplified27.6%
if 4.00000000000000033e-5 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.7%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified66.6%
Taylor expanded in t around inf
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6458.7%
Simplified58.7%
Final simplification43.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.005)
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y)))))
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 y)) (sqrt y)))
(- 1.0 (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.005) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y))));
} else {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y))) + (1.0 - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.005d0) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y))))
else
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + y)) - sqrt(y))) + (1.0d0 - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.005) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y))));
} else {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + (1.0 - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.005: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y)))) else: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) + (1.0 - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.005) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y))))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(1.0 - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.005)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y))));
else
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y))) + (1.0 - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.005], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.005:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(1 - \sqrt{x}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0050000000000000001Initial program 83.6%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6443.1%
Simplified43.1%
Taylor expanded in y around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6422.5%
Simplified22.5%
Taylor expanded in x around inf
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6427.1%
Simplified27.1%
if 0.0050000000000000001 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.0%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified67.6%
Taylor expanded in t around inf
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6459.1%
Simplified59.1%
Taylor expanded in x around 0
--lowering--.f64N/A
sqrt-lowering-sqrt.f6456.5%
Simplified56.5%
Final simplification41.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 y))) (t_2 (sqrt (+ 1.0 z))))
(if (<= t 1.56e+43)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (+ (+ 1.0 t_1) t_2) (sqrt z)))
(+
(/ (- (+ x 1.0) x) (+ (sqrt x) (sqrt (+ x 1.0))))
(+ (- t_2 (sqrt z)) (- t_1 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z));
double tmp;
if (t <= 1.56e+43) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + t_1) + t_2) - sqrt(z));
} else {
tmp = (((x + 1.0) - x) / (sqrt(x) + sqrt((x + 1.0)))) + ((t_2 - sqrt(z)) + (t_1 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z))
if (t <= 1.56d+43) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + (((1.0d0 + t_1) + t_2) - sqrt(z))
else
tmp = (((x + 1.0d0) - x) / (sqrt(x) + sqrt((x + 1.0d0)))) + ((t_2 - sqrt(z)) + (t_1 - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 1.56e+43) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + t_1) + t_2) - Math.sqrt(z));
} else {
tmp = (((x + 1.0) - x) / (Math.sqrt(x) + Math.sqrt((x + 1.0)))) + ((t_2 - Math.sqrt(z)) + (t_1 - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + z)) tmp = 0 if t <= 1.56e+43: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + t_1) + t_2) - math.sqrt(z)) else: tmp = (((x + 1.0) - x) / (math.sqrt(x) + math.sqrt((x + 1.0)))) + ((t_2 - math.sqrt(z)) + (t_1 - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 1.56e+43) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + t_1) + t_2) - sqrt(z))); else tmp = Float64(Float64(Float64(Float64(x + 1.0) - x) / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))) + Float64(Float64(t_2 - sqrt(z)) + Float64(t_1 - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 1.56e+43)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + t_1) + t_2) - sqrt(z));
else
tmp = (((x + 1.0) - x) / (sqrt(x) + sqrt((x + 1.0)))) + ((t_2 - sqrt(z)) + (t_1 - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.56e+43], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t$95$1), $MachinePrecision] + t$95$2), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x + 1.0), $MachinePrecision] - x), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 1.56 \cdot 10^{+43}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(\left(1 + t\_1\right) + t\_2\right) - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 1\right) - x}{\sqrt{x} + \sqrt{x + 1}} + \left(\left(t\_2 - \sqrt{z}\right) + \left(t\_1 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 1.55999999999999988e43Initial program 94.4%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6426.6%
Simplified26.6%
Taylor expanded in z around inf
sqrt-lowering-sqrt.f6426.3%
Simplified26.3%
if 1.55999999999999988e43 < t Initial program 84.9%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified65.3%
Taylor expanded in t around inf
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6484.9%
Simplified84.9%
flip--N/A
/-lowering-/.f64N/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6485.2%
Applied egg-rr85.2%
Final simplification51.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 23000.0)
(+
(sqrt (+ x 1.0))
(-
(+ (sqrt (+ 1.0 y)) (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))))
(+ (sqrt x) (sqrt y))))
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+
(* -0.125 (sqrt (/ 1.0 (* x (* x x)))))
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 23000.0) {
tmp = sqrt((x + 1.0)) + ((sqrt((1.0 + y)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((-0.125 * sqrt((1.0 / (x * (x * x))))) + (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 23000.0d0) then
tmp = sqrt((x + 1.0d0)) + ((sqrt((1.0d0 + y)) + (1.0d0 / (sqrt(z) + sqrt((1.0d0 + z))))) - (sqrt(x) + sqrt(y)))
else
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + (((-0.125d0) * sqrt((1.0d0 / (x * (x * x))))) + (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y)))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 23000.0) {
tmp = Math.sqrt((x + 1.0)) + ((Math.sqrt((1.0 + y)) + (1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z))))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((-0.125 * Math.sqrt((1.0 / (x * (x * x))))) + (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 23000.0: tmp = math.sqrt((x + 1.0)) + ((math.sqrt((1.0 + y)) + (1.0 / (math.sqrt(z) + math.sqrt((1.0 + z))))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((-0.125 * math.sqrt((1.0 / (x * (x * x))))) + (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 23000.0) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z))))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(-0.125 * sqrt(Float64(1.0 / Float64(x * Float64(x * x))))) + Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 23000.0)
tmp = sqrt((x + 1.0)) + ((sqrt((1.0 + y)) + (1.0 / (sqrt(z) + sqrt((1.0 + z))))) - (sqrt(x) + sqrt(y)));
else
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((-0.125 * sqrt((1.0 / (x * (x * x))))) + (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 23000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $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 23000:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(\sqrt{1 + y} + \frac{1}{\sqrt{z} + \sqrt{1 + z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(-0.125 \cdot \sqrt{\frac{1}{x \cdot \left(x \cdot x\right)}} + 0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right)\right)\\
\end{array}
\end{array}
if x < 23000Initial program 97.0%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6497.7%
Applied egg-rr97.7%
flip--N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
rem-square-sqrtN/A
rem-square-sqrtN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
pow1/2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6497.9%
Applied egg-rr97.9%
Taylor expanded in t around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6450.1%
Simplified50.1%
if 23000 < x Initial program 83.6%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6443.1%
Simplified43.1%
Taylor expanded in y around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6422.5%
Simplified22.5%
Taylor expanded in x around inf
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6427.3%
Simplified27.3%
Final simplification38.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 9.8e+26)
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(- (+ (+ 1.0 t_1) (sqrt (+ 1.0 z))) (sqrt 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((1.0 + y));
double tmp;
if (z <= 9.8e+26) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + t_1) + sqrt((1.0 + z))) - sqrt(z));
} else {
tmp = (sqrt((x + 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((1.0d0 + y))
if (z <= 9.8d+26) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + (((1.0d0 + t_1) + sqrt((1.0d0 + z))) - sqrt(z))
else
tmp = (sqrt((x + 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((1.0 + y));
double tmp;
if (z <= 9.8e+26) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + t_1) + Math.sqrt((1.0 + z))) - Math.sqrt(z));
} else {
tmp = (Math.sqrt((x + 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((1.0 + y)) tmp = 0 if z <= 9.8e+26: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + t_1) + math.sqrt((1.0 + z))) - math.sqrt(z)) else: tmp = (math.sqrt((x + 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(1.0 + y)) tmp = 0.0 if (z <= 9.8e+26) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + t_1) + sqrt(Float64(1.0 + z))) - sqrt(z))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(t_1 - 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((1.0 + y));
tmp = 0.0;
if (z <= 9.8e+26)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + t_1) + sqrt((1.0 + z))) - sqrt(z));
else
tmp = (sqrt((x + 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[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 9.8e+26], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t$95$1), $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $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 + y}\\
\mathbf{if}\;z \leq 9.8 \cdot 10^{+26}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(\left(1 + t\_1\right) + \sqrt{1 + z}\right) - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + \left(t\_1 - \sqrt{y}\right)\right) - \sqrt{x}\\
\end{array}
\end{array}
if z < 9.79999999999999947e26Initial program 93.8%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6430.0%
Simplified30.0%
Taylor expanded in z around inf
sqrt-lowering-sqrt.f6432.4%
Simplified32.4%
if 9.79999999999999947e26 < z Initial program 86.4%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6464.1%
Simplified64.1%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6421.1%
Simplified21.1%
associate--r+N/A
--lowering--.f64N/A
+-commutativeN/A
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6434.2%
Applied egg-rr34.2%
Final simplification33.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 y))))
(if (<= z 0.82)
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(- (+ (+ t_1 2.0) (* z (+ 0.5 (* z (+ -0.125 (* z 0.0625)))))) (sqrt z)))
(if (<= z 4e+30)
(+ 1.0 (- (+ (* 0.5 (sqrt (/ 1.0 z))) t_1) (+ (sqrt x) (sqrt y))))
(- (+ (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((1.0 + y));
double tmp;
if (z <= 0.82) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (((t_1 + 2.0) + (z * (0.5 + (z * (-0.125 + (z * 0.0625)))))) - sqrt(z));
} else if (z <= 4e+30) {
tmp = 1.0 + (((0.5 * sqrt((1.0 / z))) + t_1) - (sqrt(x) + sqrt(y)));
} else {
tmp = (sqrt((x + 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((1.0d0 + y))
if (z <= 0.82d0) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + (((t_1 + 2.0d0) + (z * (0.5d0 + (z * ((-0.125d0) + (z * 0.0625d0)))))) - sqrt(z))
else if (z <= 4d+30) then
tmp = 1.0d0 + (((0.5d0 * sqrt((1.0d0 / z))) + t_1) - (sqrt(x) + sqrt(y)))
else
tmp = (sqrt((x + 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((1.0 + y));
double tmp;
if (z <= 0.82) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((t_1 + 2.0) + (z * (0.5 + (z * (-0.125 + (z * 0.0625)))))) - Math.sqrt(z));
} else if (z <= 4e+30) {
tmp = 1.0 + (((0.5 * Math.sqrt((1.0 / z))) + t_1) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (Math.sqrt((x + 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((1.0 + y)) tmp = 0 if z <= 0.82: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (((t_1 + 2.0) + (z * (0.5 + (z * (-0.125 + (z * 0.0625)))))) - math.sqrt(z)) elif z <= 4e+30: tmp = 1.0 + (((0.5 * math.sqrt((1.0 / z))) + t_1) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (math.sqrt((x + 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(1.0 + y)) tmp = 0.0 if (z <= 0.82) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(t_1 + 2.0) + Float64(z * Float64(0.5 + Float64(z * Float64(-0.125 + Float64(z * 0.0625)))))) - sqrt(z))); elseif (z <= 4e+30) tmp = Float64(1.0 + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + t_1) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(t_1 - 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((1.0 + y));
tmp = 0.0;
if (z <= 0.82)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (((t_1 + 2.0) + (z * (0.5 + (z * (-0.125 + (z * 0.0625)))))) - sqrt(z));
elseif (z <= 4e+30)
tmp = 1.0 + (((0.5 * sqrt((1.0 / z))) + t_1) - (sqrt(x) + sqrt(y)));
else
tmp = (sqrt((x + 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[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.82], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 + 2.0), $MachinePrecision] + N[(z * N[(0.5 + N[(z * N[(-0.125 + N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e+30], N[(1.0 + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $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 + y}\\
\mathbf{if}\;z \leq 0.82:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(\left(t\_1 + 2\right) + z \cdot \left(0.5 + z \cdot \left(-0.125 + z \cdot 0.0625\right)\right)\right) - \sqrt{z}\right)\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+30}:\\
\;\;\;\;1 + \left(\left(0.5 \cdot \sqrt{\frac{1}{z}} + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + \left(t\_1 - \sqrt{y}\right)\right) - \sqrt{x}\\
\end{array}
\end{array}
if z < 0.819999999999999951Initial program 96.5%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6432.5%
Simplified32.5%
Taylor expanded in z around 0
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f6432.4%
Simplified32.4%
Taylor expanded in z around inf
sqrt-lowering-sqrt.f6434.1%
Simplified34.1%
if 0.819999999999999951 < z < 4.0000000000000001e30Initial program 72.1%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6412.7%
Simplified12.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f649.3%
Simplified9.3%
Taylor expanded in t around inf
--lowering--.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
Simplified4.2%
Taylor expanded in z around inf
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6417.1%
Simplified17.1%
if 4.0000000000000001e30 < z Initial program 86.5%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6464.6%
Simplified64.6%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6421.3%
Simplified21.3%
associate--r+N/A
--lowering--.f64N/A
+-commutativeN/A
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6433.9%
Applied egg-rr33.9%
Final simplification32.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 (<= z 1.5e+17)
(+
2.0
(+
(+ (sqrt (+ 1.0 z)) (* y 0.5))
(* z (- (* (+ (sqrt x) (sqrt y)) (/ -1.0 z)) (sqrt (/ 1.0 z))))))
(- (+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) (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 <= 1.5e+17) {
tmp = 2.0 + ((sqrt((1.0 + z)) + (y * 0.5)) + (z * (((sqrt(x) + sqrt(y)) * (-1.0 / z)) - sqrt((1.0 / z)))));
} else {
tmp = (sqrt((x + 1.0)) + (sqrt((1.0 + y)) - 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 <= 1.5d+17) then
tmp = 2.0d0 + ((sqrt((1.0d0 + z)) + (y * 0.5d0)) + (z * (((sqrt(x) + sqrt(y)) * ((-1.0d0) / z)) - sqrt((1.0d0 / z)))))
else
tmp = (sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - 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 <= 1.5e+17) {
tmp = 2.0 + ((Math.sqrt((1.0 + z)) + (y * 0.5)) + (z * (((Math.sqrt(x) + Math.sqrt(y)) * (-1.0 / z)) - Math.sqrt((1.0 / z)))));
} else {
tmp = (Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - 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 <= 1.5e+17: tmp = 2.0 + ((math.sqrt((1.0 + z)) + (y * 0.5)) + (z * (((math.sqrt(x) + math.sqrt(y)) * (-1.0 / z)) - math.sqrt((1.0 / z))))) else: tmp = (math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - 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 <= 1.5e+17) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(y * 0.5)) + Float64(z * Float64(Float64(Float64(sqrt(x) + sqrt(y)) * Float64(-1.0 / z)) - sqrt(Float64(1.0 / z)))))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - 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 <= 1.5e+17)
tmp = 2.0 + ((sqrt((1.0 + z)) + (y * 0.5)) + (z * (((sqrt(x) + sqrt(y)) * (-1.0 / z)) - sqrt((1.0 / z)))));
else
tmp = (sqrt((x + 1.0)) + (sqrt((1.0 + y)) - 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, 1.5e+17], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + N[(z * N[(N[(N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.5 \cdot 10^{+17}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + z} + y \cdot 0.5\right) + z \cdot \left(\left(\sqrt{x} + \sqrt{y}\right) \cdot \frac{-1}{z} - \sqrt{\frac{1}{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) - \sqrt{x}\\
\end{array}
\end{array}
if z < 1.5e17Initial program 94.5%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6430.8%
Simplified30.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6429.8%
Simplified29.8%
Taylor expanded in t around inf
--lowering--.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
Simplified19.3%
Taylor expanded in y around 0
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
Simplified20.1%
if 1.5e17 < z Initial program 85.9%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6463.7%
Simplified63.7%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6420.4%
Simplified20.4%
associate--r+N/A
--lowering--.f64N/A
+-commutativeN/A
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6433.2%
Applied egg-rr33.2%
Final simplification26.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 y))))
(if (<= z 1.5e+17)
(-
(+ 1.0 (+ t_1 (sqrt (+ 1.0 z))))
(* z (+ (sqrt (/ 1.0 z)) (/ (sqrt y) 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((1.0 + y));
double tmp;
if (z <= 1.5e+17) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (z * (sqrt((1.0 / z)) + (sqrt(y) / z)));
} else {
tmp = (sqrt((x + 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((1.0d0 + y))
if (z <= 1.5d+17) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - (z * (sqrt((1.0d0 / z)) + (sqrt(y) / z)))
else
tmp = (sqrt((x + 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((1.0 + y));
double tmp;
if (z <= 1.5e+17) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - (z * (Math.sqrt((1.0 / z)) + (Math.sqrt(y) / z)));
} else {
tmp = (Math.sqrt((x + 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((1.0 + y)) tmp = 0 if z <= 1.5e+17: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - (z * (math.sqrt((1.0 / z)) + (math.sqrt(y) / z))) else: tmp = (math.sqrt((x + 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(1.0 + y)) tmp = 0.0 if (z <= 1.5e+17) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - Float64(z * Float64(sqrt(Float64(1.0 / z)) + Float64(sqrt(y) / z)))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(t_1 - 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((1.0 + y));
tmp = 0.0;
if (z <= 1.5e+17)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (z * (sqrt((1.0 / z)) + (sqrt(y) / z)));
else
tmp = (sqrt((x + 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[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.5e+17], N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $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 + y}\\
\mathbf{if}\;z \leq 1.5 \cdot 10^{+17}:\\
\;\;\;\;\left(1 + \left(t\_1 + \sqrt{1 + z}\right)\right) - z \cdot \left(\sqrt{\frac{1}{z}} + \frac{\sqrt{y}}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + \left(t\_1 - \sqrt{y}\right)\right) - \sqrt{x}\\
\end{array}
\end{array}
if z < 1.5e17Initial program 94.5%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6430.8%
Simplified30.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6429.8%
Simplified29.8%
Taylor expanded in t around inf
--lowering--.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
Simplified19.3%
Taylor expanded in y around inf
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6433.6%
Simplified33.6%
if 1.5e17 < z Initial program 85.9%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6463.7%
Simplified63.7%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6420.4%
Simplified20.4%
associate--r+N/A
--lowering--.f64N/A
+-commutativeN/A
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6433.2%
Applied egg-rr33.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 2.75e+23)
(- (+ 1.0 (+ t_2 (sqrt (+ 1.0 z)))) (sqrt z))
(if (<= z 1.9e+167)
(- (+ t_2 t_1) (+ (sqrt x) (sqrt y)))
(+ (- t_1 (sqrt x)) (* 0.5 (sqrt (/ 1.0 y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 2.75e+23) {
tmp = (1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z);
} else if (z <= 1.9e+167) {
tmp = (t_2 + t_1) - (sqrt(x) + sqrt(y));
} else {
tmp = (t_1 - sqrt(x)) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((1.0d0 + y))
if (z <= 2.75d+23) then
tmp = (1.0d0 + (t_2 + sqrt((1.0d0 + z)))) - sqrt(z)
else if (z <= 1.9d+167) then
tmp = (t_2 + t_1) - (sqrt(x) + sqrt(y))
else
tmp = (t_1 - sqrt(x)) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 2.75e+23) {
tmp = (1.0 + (t_2 + Math.sqrt((1.0 + z)))) - Math.sqrt(z);
} else if (z <= 1.9e+167) {
tmp = (t_2 + t_1) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = (t_1 - Math.sqrt(x)) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 2.75e+23: tmp = (1.0 + (t_2 + math.sqrt((1.0 + z)))) - math.sqrt(z) elif z <= 1.9e+167: tmp = (t_2 + t_1) - (math.sqrt(x) + math.sqrt(y)) else: tmp = (t_1 - math.sqrt(x)) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 2.75e+23) tmp = Float64(Float64(1.0 + Float64(t_2 + sqrt(Float64(1.0 + z)))) - sqrt(z)); elseif (z <= 1.9e+167) tmp = Float64(Float64(t_2 + t_1) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 2.75e+23)
tmp = (1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z);
elseif (z <= 1.9e+167)
tmp = (t_2 + t_1) - (sqrt(x) + sqrt(y));
else
tmp = (t_1 - sqrt(x)) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.75e+23], N[(N[(1.0 + N[(t$95$2 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+167], N[(N[(t$95$2 + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 2.75 \cdot 10^{+23}:\\
\;\;\;\;\left(1 + \left(t\_2 + \sqrt{1 + z}\right)\right) - \sqrt{z}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+167}:\\
\;\;\;\;\left(t\_2 + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if z < 2.75000000000000002e23Initial program 93.8%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6430.2%
Simplified30.2%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6429.1%
Simplified29.1%
Taylor expanded in t around inf
--lowering--.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
Simplified18.9%
Taylor expanded in z around inf
sqrt-lowering-sqrt.f6431.3%
Simplified31.3%
if 2.75000000000000002e23 < z < 1.89999999999999997e167Initial program 88.3%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6458.8%
Simplified58.8%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6412.6%
Simplified12.6%
if 1.89999999999999997e167 < z Initial program 84.8%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified39.8%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6485.2%
Simplified85.2%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6442.2%
Simplified42.2%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6420.1%
Simplified20.1%
Final simplification24.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 9.8e+26)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (sqrt 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((1.0 + y));
double tmp;
if (z <= 9.8e+26) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - sqrt(z);
} else {
tmp = (sqrt((x + 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((1.0d0 + y))
if (z <= 9.8d+26) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - sqrt(z)
else
tmp = (sqrt((x + 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((1.0 + y));
double tmp;
if (z <= 9.8e+26) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - Math.sqrt(z);
} else {
tmp = (Math.sqrt((x + 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((1.0 + y)) tmp = 0 if z <= 9.8e+26: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - math.sqrt(z) else: tmp = (math.sqrt((x + 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(1.0 + y)) tmp = 0.0 if (z <= 9.8e+26) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - sqrt(z)); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(t_1 - 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((1.0 + y));
tmp = 0.0;
if (z <= 9.8e+26)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - sqrt(z);
else
tmp = (sqrt((x + 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[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 9.8e+26], N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $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 + y}\\
\mathbf{if}\;z \leq 9.8 \cdot 10^{+26}:\\
\;\;\;\;\left(1 + \left(t\_1 + \sqrt{1 + z}\right)\right) - \sqrt{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + \left(t\_1 - \sqrt{y}\right)\right) - \sqrt{x}\\
\end{array}
\end{array}
if z < 9.79999999999999947e26Initial program 93.8%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6430.0%
Simplified30.0%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6428.9%
Simplified28.9%
Taylor expanded in t around inf
--lowering--.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
Simplified18.7%
Taylor expanded in z around inf
sqrt-lowering-sqrt.f6431.7%
Simplified31.7%
if 9.79999999999999947e26 < z Initial program 86.4%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6464.1%
Simplified64.1%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6421.1%
Simplified21.1%
associate--r+N/A
--lowering--.f64N/A
+-commutativeN/A
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6434.2%
Applied egg-rr34.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 4.6e+22)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (sqrt z))
(if (<= z 1.9e+167)
(- (+ 1.0 t_1) (+ (sqrt x) (sqrt y)))
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 4.6e+22) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - sqrt(z);
} else if (z <= 1.9e+167) {
tmp = (1.0 + t_1) - (sqrt(x) + sqrt(y));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 4.6d+22) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - sqrt(z)
else if (z <= 1.9d+167) then
tmp = (1.0d0 + t_1) - (sqrt(x) + sqrt(y))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 4.6e+22) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - Math.sqrt(z);
} else if (z <= 1.9e+167) {
tmp = (1.0 + t_1) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 4.6e+22: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - math.sqrt(z) elif z <= 1.9e+167: tmp = (1.0 + t_1) - (math.sqrt(x) + math.sqrt(y)) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 4.6e+22) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - sqrt(z)); elseif (z <= 1.9e+167) tmp = Float64(Float64(1.0 + t_1) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 4.6e+22)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - sqrt(z);
elseif (z <= 1.9e+167)
tmp = (1.0 + t_1) - (sqrt(x) + sqrt(y));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 4.6e+22], N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+167], N[(N[(1.0 + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 4.6 \cdot 10^{+22}:\\
\;\;\;\;\left(1 + \left(t\_1 + \sqrt{1 + z}\right)\right) - \sqrt{z}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+167}:\\
\;\;\;\;\left(1 + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if z < 4.6000000000000004e22Initial program 93.8%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6430.2%
Simplified30.2%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6429.1%
Simplified29.1%
Taylor expanded in t around inf
--lowering--.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
Simplified18.9%
Taylor expanded in z around inf
sqrt-lowering-sqrt.f6431.3%
Simplified31.3%
if 4.6000000000000004e22 < z < 1.89999999999999997e167Initial program 88.3%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6458.8%
Simplified58.8%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6412.6%
Simplified12.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f648.5%
Simplified8.5%
if 1.89999999999999997e167 < z Initial program 84.8%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified39.8%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6485.2%
Simplified85.2%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6442.2%
Simplified42.2%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6420.1%
Simplified20.1%
Final simplification23.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 18000000.0) (- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y))) (+ (- (sqrt (+ x 1.0)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 18000000.0) {
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 18000000.0d0) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 18000000.0) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 18000000.0: tmp = (1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 18000000.0) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 18000000.0)
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 18000000.0], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 18000000:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 1.8e7Initial program 96.5%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6454.9%
Simplified54.9%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6425.0%
Simplified25.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6419.7%
Simplified19.7%
if 1.8e7 < y Initial program 84.3%
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
Simplified51.9%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6449.7%
Simplified49.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6452.3%
Simplified52.3%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6423.8%
Simplified23.8%
Final simplification21.8%
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 28000000.0) (- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y))) (+ (sqrt (+ x 1.0)) (- (* 0.5 (sqrt (/ 1.0 y))) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 28000000.0) {
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
} else {
tmp = sqrt((x + 1.0)) + ((0.5 * sqrt((1.0 / 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 (y <= 28000000.0d0) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))
else
tmp = sqrt((x + 1.0d0)) + ((0.5d0 * sqrt((1.0d0 / 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 (y <= 28000000.0) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = Math.sqrt((x + 1.0)) + ((0.5 * Math.sqrt((1.0 / y))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 28000000.0: tmp = (1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = math.sqrt((x + 1.0)) + ((0.5 * math.sqrt((1.0 / 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 (y <= 28000000.0) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / 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 (y <= 28000000.0)
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
else
tmp = sqrt((x + 1.0)) + ((0.5 * sqrt((1.0 / 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[y, 28000000.0], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 28000000:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 2.8e7Initial program 96.5%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6454.9%
Simplified54.9%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6425.0%
Simplified25.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6419.7%
Simplified19.7%
if 2.8e7 < y Initial program 84.3%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6424.5%
Simplified24.5%
Taylor expanded in y around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6448.9%
Simplified48.9%
Taylor expanded in t around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6419.8%
Simplified19.8%
Final simplification19.8%
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 3.8e+15) (- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.8e+15) {
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3.8d+15) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.8e+15) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3.8e+15: tmp = (1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 3.8e+15) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 3.8e+15)
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 3.8e+15], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.8 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 3.8e15Initial program 95.6%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6454.0%
Simplified54.0%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6424.5%
Simplified24.5%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6419.3%
Simplified19.3%
if 3.8e15 < y Initial program 84.9%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6424.7%
Simplified24.7%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f643.7%
Simplified3.7%
Taylor expanded in y around inf
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6420.2%
Simplified20.2%
Final simplification19.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Initial program 90.3%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6439.6%
Simplified39.6%
Taylor expanded in t around inf
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6414.2%
Simplified14.2%
Taylor expanded in y around inf
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f6415.6%
Simplified15.6%
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 (* 0.5 (sqrt (/ 1.0 y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.5 * sqrt((1.0 / y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 * sqrt((1.0d0 / y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 0.5 * Math.sqrt((1.0 / y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.5 * math.sqrt((1.0 / y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(0.5 * sqrt(Float64(1.0 / y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.5 * sqrt((1.0 / y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot \sqrt{\frac{1}{y}}
\end{array}
Initial program 90.3%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6439.6%
Simplified39.6%
Taylor expanded in y around inf
associate--l+N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6428.4%
Simplified28.4%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f648.0%
Simplified8.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* 0.0625 (* z (* z z))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.0625 * (z * (z * z));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.0625d0 * (z * (z * z))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 0.0625 * (z * (z * z));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.0625 * (z * (z * z))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(0.0625 * Float64(z * Float64(z * z))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.0625 * (z * (z * z));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(0.0625 * N[(z * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.0625 \cdot \left(z \cdot \left(z \cdot z\right)\right)
\end{array}
Initial program 90.3%
Taylor expanded in x around 0
--lowering--.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6423.1%
Simplified23.1%
Taylor expanded in z around 0
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f6417.3%
Simplified17.3%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.9%
Simplified3.9%
(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 2024161
(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))))