
(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 17 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 x)))
(t_2 (- t_1 (sqrt x)))
(t_3 (sqrt (+ 1.0 t)))
(t_4 (sqrt (+ 1.0 y)))
(t_5 (sqrt (+ 1.0 z))))
(if (<=
(+ (- t_3 (sqrt t)) (+ (- t_5 (sqrt z)) (+ t_2 (- t_4 (sqrt y)))))
2.999998)
(+
(+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_4 (sqrt y))))
(/ 1.0 (+ t_5 (sqrt z))))
(+
t_4
(- (+ t_5 (- t_2 (sqrt z))) (+ (sqrt y) (/ -1.0 (+ t_3 (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 + x));
double t_2 = t_1 - sqrt(x);
double t_3 = sqrt((1.0 + t));
double t_4 = sqrt((1.0 + y));
double t_5 = sqrt((1.0 + z));
double tmp;
if (((t_3 - sqrt(t)) + ((t_5 - sqrt(z)) + (t_2 + (t_4 - sqrt(y))))) <= 2.999998) {
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_4 + sqrt(y)))) + (1.0 / (t_5 + sqrt(z)));
} else {
tmp = t_4 + ((t_5 + (t_2 - sqrt(z))) - (sqrt(y) + (-1.0 / (t_3 + 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) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = t_1 - sqrt(x)
t_3 = sqrt((1.0d0 + t))
t_4 = sqrt((1.0d0 + y))
t_5 = sqrt((1.0d0 + z))
if (((t_3 - sqrt(t)) + ((t_5 - sqrt(z)) + (t_2 + (t_4 - sqrt(y))))) <= 2.999998d0) then
tmp = ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_4 + sqrt(y)))) + (1.0d0 / (t_5 + sqrt(z)))
else
tmp = t_4 + ((t_5 + (t_2 - sqrt(z))) - (sqrt(y) + ((-1.0d0) / (t_3 + 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 + x));
double t_2 = t_1 - Math.sqrt(x);
double t_3 = Math.sqrt((1.0 + t));
double t_4 = Math.sqrt((1.0 + y));
double t_5 = Math.sqrt((1.0 + z));
double tmp;
if (((t_3 - Math.sqrt(t)) + ((t_5 - Math.sqrt(z)) + (t_2 + (t_4 - Math.sqrt(y))))) <= 2.999998) {
tmp = ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_4 + Math.sqrt(y)))) + (1.0 / (t_5 + Math.sqrt(z)));
} else {
tmp = t_4 + ((t_5 + (t_2 - Math.sqrt(z))) - (Math.sqrt(y) + (-1.0 / (t_3 + 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 + x)) t_2 = t_1 - math.sqrt(x) t_3 = math.sqrt((1.0 + t)) t_4 = math.sqrt((1.0 + y)) t_5 = math.sqrt((1.0 + z)) tmp = 0 if ((t_3 - math.sqrt(t)) + ((t_5 - math.sqrt(z)) + (t_2 + (t_4 - math.sqrt(y))))) <= 2.999998: tmp = ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_4 + math.sqrt(y)))) + (1.0 / (t_5 + math.sqrt(z))) else: tmp = t_4 + ((t_5 + (t_2 - math.sqrt(z))) - (math.sqrt(y) + (-1.0 / (t_3 + 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 + x)) t_2 = Float64(t_1 - sqrt(x)) t_3 = sqrt(Float64(1.0 + t)) t_4 = sqrt(Float64(1.0 + y)) t_5 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(Float64(t_3 - sqrt(t)) + Float64(Float64(t_5 - sqrt(z)) + Float64(t_2 + Float64(t_4 - sqrt(y))))) <= 2.999998) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_4 + sqrt(y)))) + Float64(1.0 / Float64(t_5 + sqrt(z)))); else tmp = Float64(t_4 + Float64(Float64(t_5 + Float64(t_2 - sqrt(z))) - Float64(sqrt(y) + Float64(-1.0 / Float64(t_3 + 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 + x));
t_2 = t_1 - sqrt(x);
t_3 = sqrt((1.0 + t));
t_4 = sqrt((1.0 + y));
t_5 = sqrt((1.0 + z));
tmp = 0.0;
if (((t_3 - sqrt(t)) + ((t_5 - sqrt(z)) + (t_2 + (t_4 - sqrt(y))))) <= 2.999998)
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_4 + sqrt(y)))) + (1.0 / (t_5 + sqrt(z)));
else
tmp = t_4 + ((t_5 + (t_2 - sqrt(z))) - (sqrt(y) + (-1.0 / (t_3 + 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 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[x], $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[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$3 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$5 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.999998], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$4 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$5 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 + N[(N[(t$95$5 + N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(-1.0 / N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := t\_1 - \sqrt{x}\\
t_3 := \sqrt{1 + t}\\
t_4 := \sqrt{1 + y}\\
t_5 := \sqrt{1 + z}\\
\mathbf{if}\;\left(t\_3 - \sqrt{t}\right) + \left(\left(t\_5 - \sqrt{z}\right) + \left(t\_2 + \left(t\_4 - \sqrt{y}\right)\right)\right) \leq 2.999998:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{x}} + \frac{1}{t\_4 + \sqrt{y}}\right) + \frac{1}{t\_5 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_4 + \left(\left(t\_5 + \left(t\_2 - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{-1}{t\_3 + \sqrt{t}}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t 1)) (sqrt.f64 t))) < 2.99999800000000016Initial program 88.8%
associate-+l+88.8%
+-commutative88.8%
+-commutative88.8%
+-commutative88.8%
Simplified88.8%
flip--88.9%
add-sqr-sqrt70.6%
+-commutative70.6%
add-sqr-sqrt89.1%
+-commutative89.1%
Applied egg-rr89.1%
associate--l+92.5%
+-inverses92.5%
metadata-eval92.5%
Simplified92.5%
flip--92.7%
add-sqr-sqrt68.7%
add-sqr-sqrt93.0%
Applied egg-rr93.0%
associate--l+94.9%
+-inverses94.9%
metadata-eval94.9%
Simplified94.9%
Taylor expanded in t around inf 68.0%
flip--68.1%
add-sqr-sqrt55.2%
add-sqr-sqrt68.3%
Applied egg-rr68.3%
associate--l+69.9%
+-inverses69.9%
metadata-eval69.9%
Simplified69.9%
if 2.99999800000000016 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t 1)) (sqrt.f64 t))) Initial program 98.7%
+-commutative98.7%
associate-+r+98.7%
associate-+r-89.7%
associate-+l-89.4%
associate-+r-87.7%
Simplified72.3%
flip--72.3%
add-sqr-sqrt61.0%
add-sqr-sqrt72.3%
+-commutative72.3%
+-commutative72.3%
Applied egg-rr72.3%
associate--r+72.6%
+-inverses72.6%
metadata-eval72.6%
+-commutative72.6%
Simplified72.6%
Final simplification70.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_3 (sqrt (+ 1.0 y)))
(t_4 (sqrt (+ 1.0 z))))
(if (<=
(+ t_2 (+ (- t_4 (sqrt z)) (+ (- t_1 (sqrt x)) (- t_3 (sqrt y)))))
2.99999)
(+
(+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_3 (sqrt y))))
(/ 1.0 (+ t_4 (sqrt z))))
(+ (- (+ 1.0 (+ t_3 t_4)) (sqrt z)) (- t_2 (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 + x));
double t_2 = sqrt((1.0 + t)) - sqrt(t);
double t_3 = sqrt((1.0 + y));
double t_4 = sqrt((1.0 + z));
double tmp;
if ((t_2 + ((t_4 - sqrt(z)) + ((t_1 - sqrt(x)) + (t_3 - sqrt(y))))) <= 2.99999) {
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (1.0 / (t_4 + sqrt(z)));
} else {
tmp = ((1.0 + (t_3 + t_4)) - sqrt(z)) + (t_2 - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
t_3 = sqrt((1.0d0 + y))
t_4 = sqrt((1.0d0 + z))
if ((t_2 + ((t_4 - sqrt(z)) + ((t_1 - sqrt(x)) + (t_3 - sqrt(y))))) <= 2.99999d0) then
tmp = ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_3 + sqrt(y)))) + (1.0d0 / (t_4 + sqrt(z)))
else
tmp = ((1.0d0 + (t_3 + t_4)) - sqrt(z)) + (t_2 - 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 + x));
double t_2 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_3 = Math.sqrt((1.0 + y));
double t_4 = Math.sqrt((1.0 + z));
double tmp;
if ((t_2 + ((t_4 - Math.sqrt(z)) + ((t_1 - Math.sqrt(x)) + (t_3 - Math.sqrt(y))))) <= 2.99999) {
tmp = ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y)))) + (1.0 / (t_4 + Math.sqrt(z)));
} else {
tmp = ((1.0 + (t_3 + t_4)) - Math.sqrt(z)) + (t_2 - 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 + x)) t_2 = math.sqrt((1.0 + t)) - math.sqrt(t) t_3 = math.sqrt((1.0 + y)) t_4 = math.sqrt((1.0 + z)) tmp = 0 if (t_2 + ((t_4 - math.sqrt(z)) + ((t_1 - math.sqrt(x)) + (t_3 - math.sqrt(y))))) <= 2.99999: tmp = ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) + (1.0 / (t_4 + math.sqrt(z))) else: tmp = ((1.0 + (t_3 + t_4)) - math.sqrt(z)) + (t_2 - 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 + x)) t_2 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_3 = sqrt(Float64(1.0 + y)) t_4 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(t_2 + Float64(Float64(t_4 - sqrt(z)) + Float64(Float64(t_1 - sqrt(x)) + Float64(t_3 - sqrt(y))))) <= 2.99999) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_3 + sqrt(y)))) + Float64(1.0 / Float64(t_4 + sqrt(z)))); else tmp = Float64(Float64(Float64(1.0 + Float64(t_3 + t_4)) - sqrt(z)) + Float64(t_2 - 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 + x));
t_2 = sqrt((1.0 + t)) - sqrt(t);
t_3 = sqrt((1.0 + y));
t_4 = sqrt((1.0 + z));
tmp = 0.0;
if ((t_2 + ((t_4 - sqrt(z)) + ((t_1 - sqrt(x)) + (t_3 - sqrt(y))))) <= 2.99999)
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (1.0 / (t_4 + sqrt(z)));
else
tmp = ((1.0 + (t_3 + t_4)) - sqrt(z)) + (t_2 - 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 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 + N[(N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.99999], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(t$95$3 + t$95$4), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - 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 + x}\\
t_2 := \sqrt{1 + t} - \sqrt{t}\\
t_3 := \sqrt{1 + y}\\
t_4 := \sqrt{1 + z}\\
\mathbf{if}\;t\_2 + \left(\left(t\_4 - \sqrt{z}\right) + \left(\left(t\_1 - \sqrt{x}\right) + \left(t\_3 - \sqrt{y}\right)\right)\right) \leq 2.99999:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{x}} + \frac{1}{t\_3 + \sqrt{y}}\right) + \frac{1}{t\_4 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + \left(t\_3 + t\_4\right)\right) - \sqrt{z}\right) + \left(t\_2 - \sqrt{y}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t 1)) (sqrt.f64 t))) < 2.99998999999999993Initial program 88.7%
associate-+l+88.7%
+-commutative88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
flip--88.8%
add-sqr-sqrt70.3%
+-commutative70.3%
add-sqr-sqrt88.9%
+-commutative88.9%
Applied egg-rr88.9%
associate--l+92.5%
+-inverses92.5%
metadata-eval92.5%
Simplified92.5%
flip--92.6%
add-sqr-sqrt68.4%
add-sqr-sqrt92.9%
Applied egg-rr92.9%
associate--l+94.8%
+-inverses94.8%
metadata-eval94.8%
Simplified94.8%
Taylor expanded in t around inf 68.5%
flip--68.6%
add-sqr-sqrt55.6%
add-sqr-sqrt68.8%
Applied egg-rr68.8%
associate--l+70.4%
+-inverses70.4%
metadata-eval70.4%
Simplified70.4%
if 2.99998999999999993 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t 1)) (sqrt.f64 t))) Initial program 98.7%
+-commutative98.7%
associate-+r+98.7%
associate-+r-90.0%
associate-+l-89.7%
associate-+r-88.1%
Simplified70.7%
associate-+r-70.7%
associate--l-70.3%
+-commutative70.3%
+-commutative70.3%
+-commutative70.3%
Applied egg-rr70.3%
Taylor expanded in x around 0 53.5%
Final simplification66.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))) (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) (- (sqrt (+ 1.0 t)) (sqrt t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (sqrt((1.0d0 + t)) - sqrt(t)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (math.sqrt((1.0 + t)) - math.sqrt(t)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)
\end{array}
Initial program 91.2%
associate-+l+91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
Simplified91.2%
flip--91.3%
add-sqr-sqrt76.2%
+-commutative76.2%
add-sqr-sqrt91.4%
+-commutative91.4%
Applied egg-rr91.4%
associate--l+94.2%
+-inverses94.2%
metadata-eval94.2%
Simplified94.2%
flip--94.3%
add-sqr-sqrt74.2%
add-sqr-sqrt94.5%
Applied egg-rr94.5%
associate--l+95.9%
+-inverses95.9%
metadata-eval95.9%
Simplified95.9%
flip--60.2%
add-sqr-sqrt50.2%
add-sqr-sqrt60.4%
Applied egg-rr96.2%
associate--l+61.6%
+-inverses61.6%
metadata-eval61.6%
Simplified97.5%
Final simplification97.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ 1.0 z)) (sqrt z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - sqrt(z)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $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[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])\\
\\
\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)
\end{array}
Initial program 91.2%
associate-+l+91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
Simplified91.2%
flip--91.3%
add-sqr-sqrt76.2%
+-commutative76.2%
add-sqr-sqrt91.4%
+-commutative91.4%
Applied egg-rr91.4%
associate--l+94.2%
+-inverses94.2%
metadata-eval94.2%
Simplified94.2%
flip--94.3%
add-sqr-sqrt74.2%
add-sqr-sqrt94.5%
Applied egg-rr94.5%
associate--l+95.9%
+-inverses95.9%
metadata-eval95.9%
Simplified95.9%
Final simplification95.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))) (t_2 (sqrt (+ 1.0 y))))
(if (<= y 1.35e-10)
(+ (+ (- (sqrt (+ 1.0 t)) (sqrt t)) t_1) (+ 1.0 (- t_2 (sqrt y))))
(+
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (/ 1.0 (+ t_2 (sqrt y))))
t_1))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + y));
double tmp;
if (y <= 1.35e-10) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (1.0 + (t_2 - sqrt(y)));
} else {
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (t_2 + sqrt(y)))) + t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + y))
if (y <= 1.35d-10) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + t_1) + (1.0d0 + (t_2 - sqrt(y)))
else
tmp = ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (t_2 + sqrt(y)))) + t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (y <= 1.35e-10) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + t_1) + (1.0 + (t_2 - Math.sqrt(y)));
} else {
tmp = ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (t_2 + Math.sqrt(y)))) + t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + y)) tmp = 0 if y <= 1.35e-10: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + t_1) + (1.0 + (t_2 - math.sqrt(y))) else: tmp = ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (t_2 + math.sqrt(y)))) + t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (y <= 1.35e-10) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + t_1) + Float64(1.0 + Float64(t_2 - sqrt(y)))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(t_2 + sqrt(y)))) + t_1); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (y <= 1.35e-10)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (1.0 + (t_2 - sqrt(y)));
else
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (t_2 + sqrt(y)))) + t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.35e-10], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(1.0 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;y \leq 1.35 \cdot 10^{-10}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + t\_1\right) + \left(1 + \left(t\_2 - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{t\_2 + \sqrt{y}}\right) + t\_1\\
\end{array}
\end{array}
if y < 1.35e-10Initial program 98.2%
associate-+l+98.2%
+-commutative98.2%
+-commutative98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in x around 0 61.9%
if 1.35e-10 < y Initial program 84.2%
associate-+l+84.2%
+-commutative84.2%
+-commutative84.2%
+-commutative84.2%
Simplified84.2%
flip--84.2%
add-sqr-sqrt67.5%
+-commutative67.5%
add-sqr-sqrt84.3%
+-commutative84.3%
Applied egg-rr84.3%
associate--l+89.3%
+-inverses89.3%
metadata-eval89.3%
Simplified89.3%
flip--89.6%
add-sqr-sqrt49.4%
add-sqr-sqrt90.1%
Applied egg-rr90.1%
associate--l+92.9%
+-inverses92.9%
metadata-eval92.9%
Simplified92.9%
Taylor expanded in t around inf 57.1%
Final simplification59.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 z))))
(if (<= t 18500000000.0)
(+
1.0
(-
(+ (sqrt (+ 1.0 t)) (+ (sqrt (+ 1.0 y)) t_1))
(+ (sqrt t) (+ (sqrt y) (sqrt z)))))
(+
(- t_1 (sqrt z))
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(/ 1.0 (+ (sqrt y) (+ 1.0 (* y 0.5)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 18500000000.0) {
tmp = 1.0 + ((sqrt((1.0 + t)) + (sqrt((1.0 + y)) + t_1)) - (sqrt(t) + (sqrt(y) + sqrt(z))));
} else {
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt(y) + (1.0 + (y * 0.5)))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 18500000000.0d0) then
tmp = 1.0d0 + ((sqrt((1.0d0 + t)) + (sqrt((1.0d0 + y)) + t_1)) - (sqrt(t) + (sqrt(y) + sqrt(z))))
else
tmp = (t_1 - sqrt(z)) + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt(y) + (1.0d0 + (y * 0.5d0)))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 18500000000.0) {
tmp = 1.0 + ((Math.sqrt((1.0 + t)) + (Math.sqrt((1.0 + y)) + t_1)) - (Math.sqrt(t) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt(y) + (1.0 + (y * 0.5)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 18500000000.0: tmp = 1.0 + ((math.sqrt((1.0 + t)) + (math.sqrt((1.0 + y)) + t_1)) - (math.sqrt(t) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = (t_1 - math.sqrt(z)) + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (math.sqrt(y) + (1.0 + (y * 0.5))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 18500000000.0) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + t)) + Float64(sqrt(Float64(1.0 + y)) + t_1)) - Float64(sqrt(t) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(y) + Float64(1.0 + Float64(y * 0.5)))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 18500000000.0)
tmp = 1.0 + ((sqrt((1.0 + t)) + (sqrt((1.0 + y)) + t_1)) - (sqrt(t) + (sqrt(y) + sqrt(z))));
else
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt(y) + (1.0 + (y * 0.5)))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 18500000000.0], N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 18500000000:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + t} + \left(\sqrt{1 + y} + t\_1\right)\right) - \left(\sqrt{t} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{y} + \left(1 + y \cdot 0.5\right)}\right)\\
\end{array}
\end{array}
if t < 1.85e10Initial program 98.2%
+-commutative98.2%
associate-+r+98.2%
associate-+r-77.2%
associate-+l-58.2%
associate-+r-55.1%
Simplified42.8%
Taylor expanded in x around 0 20.2%
associate--l+37.9%
+-commutative37.9%
+-commutative37.9%
+-commutative37.9%
Simplified37.9%
if 1.85e10 < t Initial program 85.6%
associate-+l+85.6%
+-commutative85.6%
+-commutative85.6%
+-commutative85.6%
Simplified85.6%
flip--85.7%
add-sqr-sqrt72.1%
+-commutative72.1%
add-sqr-sqrt85.9%
+-commutative85.9%
Applied egg-rr85.9%
associate--l+90.3%
+-inverses90.3%
metadata-eval90.3%
Simplified90.3%
flip--90.4%
add-sqr-sqrt73.3%
add-sqr-sqrt90.8%
Applied egg-rr90.8%
associate--l+93.1%
+-inverses93.1%
metadata-eval93.1%
Simplified93.1%
Taylor expanded in t around inf 93.0%
Taylor expanded in y around 0 89.7%
*-commutative89.7%
Simplified89.7%
Final simplification66.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)) (sqrt z))))
(if (<= y 1e+16)
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) t_1)
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))
(+
t_1
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(/ 1.0 (+ (sqrt y) (+ 1.0 (* y 0.5)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (y <= 1e+16) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (1.0 + (sqrt((1.0 + y)) - sqrt(y)));
} else {
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt(y) + (1.0 + (y * 0.5)))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
if (y <= 1d+16) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + t_1) + (1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y)))
else
tmp = t_1 + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt(y) + (1.0d0 + (y * 0.5d0)))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (y <= 1e+16) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + t_1) + (1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt(y) + (1.0 + (y * 0.5)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if y <= 1e+16: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + t_1) + (1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))) else: tmp = t_1 + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (math.sqrt(y) + (1.0 + (y * 0.5))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (y <= 1e+16) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + t_1) + Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(y) + Float64(1.0 + Float64(y * 0.5)))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (y <= 1e+16)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (1.0 + (sqrt((1.0 + y)) - sqrt(y)));
else
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt(y) + (1.0 + (y * 0.5)))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1e+16], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;y \leq 10^{+16}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + t\_1\right) + \left(1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{y} + \left(1 + y \cdot 0.5\right)}\right)\\
\end{array}
\end{array}
if y < 1e16Initial program 97.6%
associate-+l+97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 60.9%
if 1e16 < y Initial program 83.9%
associate-+l+83.9%
+-commutative83.9%
+-commutative83.9%
+-commutative83.9%
Simplified83.9%
flip--83.9%
add-sqr-sqrt68.4%
+-commutative68.4%
add-sqr-sqrt84.0%
+-commutative84.0%
Applied egg-rr84.0%
associate--l+89.4%
+-inverses89.4%
metadata-eval89.4%
Simplified89.4%
flip--89.4%
add-sqr-sqrt46.3%
add-sqr-sqrt89.4%
Applied egg-rr89.4%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
Simplified92.4%
Taylor expanded in t around inf 56.3%
Taylor expanded in y around 0 53.5%
*-commutative53.5%
Simplified53.5%
Final simplification57.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 z)) (sqrt z)))
(t_2 (- (sqrt (+ 1.0 y)) (sqrt y))))
(if (<= x 1.46e-30)
(+ (+ (- (sqrt (+ 1.0 t)) (sqrt t)) t_1) (+ 1.0 t_2))
(+ t_1 (+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) t_2)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + y)) - sqrt(y);
double tmp;
if (x <= 1.46e-30) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (1.0 + t_2);
} else {
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + t_2);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + y)) - sqrt(y)
if (x <= 1.46d-30) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + t_1) + (1.0d0 + t_2)
else
tmp = t_1 + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + t_2)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double tmp;
if (x <= 1.46e-30) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + t_1) + (1.0 + t_2);
} else {
tmp = t_1 + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + y)) - math.sqrt(y) tmp = 0 if x <= 1.46e-30: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + t_1) + (1.0 + t_2) else: tmp = t_1 + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + t_2) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) tmp = 0.0 if (x <= 1.46e-30) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + t_1) + Float64(1.0 + t_2)); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + t_2)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
t_2 = sqrt((1.0 + y)) - sqrt(y);
tmp = 0.0;
if (x <= 1.46e-30)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (1.0 + t_2);
else
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + t_2);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.46e-30], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(1.0 + t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + y} - \sqrt{y}\\
\mathbf{if}\;x \leq 1.46 \cdot 10^{-30}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + t\_1\right) + \left(1 + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + t\_2\right)\\
\end{array}
\end{array}
if x < 1.4600000000000001e-30Initial program 98.5%
associate-+l+98.5%
+-commutative98.5%
+-commutative98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in x around 0 98.5%
if 1.4600000000000001e-30 < x Initial program 84.9%
associate-+l+84.9%
+-commutative84.9%
+-commutative84.9%
+-commutative84.9%
Simplified84.9%
flip--85.1%
add-sqr-sqrt57.2%
+-commutative57.2%
add-sqr-sqrt85.3%
+-commutative85.3%
Applied egg-rr85.3%
associate--l+90.4%
+-inverses90.4%
metadata-eval90.4%
Simplified90.4%
Taylor expanded in t around inf 55.3%
Final simplification75.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= x 9.8e-24)
(+ t_1 (+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(+
t_1
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (/ 1.0 (+ 1.0 (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)) - sqrt(z);
double tmp;
if (x <= 9.8e-24) {
tmp = t_1 + (1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
} else {
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (1.0 + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
if (x <= 9.8d-24) then
tmp = t_1 + (1.0d0 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))))
else
tmp = t_1 + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (1.0d0 + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (x <= 9.8e-24) {
tmp = t_1 + (1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (1.0 + 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)) - math.sqrt(z) tmp = 0 if x <= 9.8e-24: tmp = t_1 + (1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) else: tmp = t_1 + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (1.0 + 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(1.0 + z)) - sqrt(z)) tmp = 0.0 if (x <= 9.8e-24) tmp = Float64(t_1 + Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(1.0 + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (x <= 9.8e-24)
tmp = t_1 + (1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
else
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (1.0 + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 9.8e-24], N[(t$95$1 + N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;x \leq 9.8 \cdot 10^{-24}:\\
\;\;\;\;t\_1 + \left(1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{1 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if x < 9.8000000000000002e-24Initial program 98.5%
associate-+l+98.5%
+-commutative98.5%
+-commutative98.5%
+-commutative98.5%
Simplified98.5%
flip--98.5%
add-sqr-sqrt98.5%
+-commutative98.5%
add-sqr-sqrt98.5%
+-commutative98.5%
Applied egg-rr98.5%
associate--l+98.5%
+-inverses98.5%
metadata-eval98.5%
Simplified98.5%
flip--98.8%
add-sqr-sqrt72.5%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in t around inf 61.7%
Taylor expanded in x around 0 61.6%
+-commutative61.6%
Simplified61.6%
if 9.8000000000000002e-24 < x Initial program 84.5%
associate-+l+84.5%
+-commutative84.5%
+-commutative84.5%
+-commutative84.5%
Simplified84.5%
flip--84.6%
add-sqr-sqrt56.0%
+-commutative56.0%
add-sqr-sqrt84.9%
+-commutative84.9%
Applied egg-rr84.9%
associate--l+90.2%
+-inverses90.2%
metadata-eval90.2%
Simplified90.2%
flip--90.2%
add-sqr-sqrt75.8%
add-sqr-sqrt90.6%
Applied egg-rr90.6%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
Simplified93.3%
Taylor expanded in t around inf 58.7%
Taylor expanded in y around 0 54.9%
Final simplification58.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 2.1e-31)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 5e+15)
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 2.1e-31) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 5e+15) {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (t_1 + 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 + x))
if (y <= 2.1d-31) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 5d+15) then
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 2.1e-31) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 5e+15) {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 2.1e-31: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 5e+15: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 2.1e-31) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 5e+15) tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 2.1e-31)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 5e+15)
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.1e-31], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 5e+15], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 2.1 \cdot 10^{-31}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.09999999999999991e-31Initial program 98.0%
+-commutative98.0%
associate-+r+98.0%
associate-+r-98.0%
associate-+l-98.0%
associate-+r-98.0%
Simplified70.7%
Taylor expanded in t around inf 17.7%
associate--l+23.2%
+-commutative23.2%
associate--l+23.2%
+-commutative23.2%
associate-+r+23.2%
Simplified23.2%
Taylor expanded in y around 0 17.7%
+-commutative17.7%
+-commutative17.7%
Simplified17.7%
Taylor expanded in x around 0 27.2%
associate--l+56.0%
Simplified56.0%
if 2.09999999999999991e-31 < y < 5e15Initial program 94.8%
+-commutative94.8%
associate-+r+94.8%
associate-+r-94.7%
associate-+l-94.7%
associate-+r-94.5%
Simplified72.0%
Taylor expanded in t around inf 15.4%
associate--l+20.0%
+-commutative20.0%
associate--l+20.0%
+-commutative20.0%
associate-+r+20.0%
Simplified20.0%
Taylor expanded in z around inf 28.1%
if 5e15 < y Initial program 83.9%
+-commutative83.9%
associate-+r+83.9%
associate-+r-42.1%
associate-+l-23.9%
associate-+r-4.4%
Simplified4.2%
Taylor expanded in t around inf 3.7%
associate--l+20.3%
+-commutative20.3%
associate--l+25.2%
+-commutative25.2%
associate-+r+25.2%
Simplified25.2%
Taylor expanded in z around inf 19.8%
Taylor expanded in y around inf 19.4%
flip--19.4%
add-sqr-sqrt19.6%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
associate--l+25.4%
+-inverses25.4%
metadata-eval25.4%
Simplified25.4%
Final simplification39.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 9.5e-20)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 9.5e-20) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + 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 (x <= 9.5d-20) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + 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 (x <= 9.5e-20) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 9.5e-20: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 9.5e-20) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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 (x <= 9.5e-20)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
else
tmp = 1.0 / (sqrt((1.0 + x)) + 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[x, 9.5e-20], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $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}\;x \leq 9.5 \cdot 10^{-20}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if x < 9.5e-20Initial program 98.6%
associate-+l+98.6%
+-commutative98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
flip--98.6%
add-sqr-sqrt98.6%
+-commutative98.6%
add-sqr-sqrt98.6%
+-commutative98.6%
Applied egg-rr98.6%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
Simplified98.6%
flip--98.8%
add-sqr-sqrt72.9%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in t around inf 61.0%
Taylor expanded in x around 0 60.9%
+-commutative60.9%
Simplified60.9%
if 9.5e-20 < x Initial program 84.3%
+-commutative84.3%
associate-+r+84.3%
associate-+r-80.4%
associate-+l-66.1%
associate-+r-51.4%
Simplified46.9%
Taylor expanded in t around inf 6.5%
associate--l+10.0%
+-commutative10.0%
associate--l+9.5%
+-commutative9.5%
associate-+r+9.5%
Simplified9.5%
Taylor expanded in z around inf 10.5%
Taylor expanded in y around inf 6.5%
flip--6.5%
add-sqr-sqrt7.0%
add-sqr-sqrt6.5%
Applied egg-rr6.5%
associate--l+13.3%
+-inverses13.3%
metadata-eval13.3%
Simplified13.3%
Final simplification36.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 (<= y 1.4e-30)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 1e+16)
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4e-30) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 1e+16) {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.4d-30) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 1d+16) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4e-30) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 1e+16) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.4e-30: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 1e+16: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.4e-30) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 1e+16) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.4e-30)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 1e+16)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.4e-30], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 1e+16], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $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 1.4 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 10^{+16}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.39999999999999994e-30Initial program 98.1%
+-commutative98.1%
associate-+r+98.1%
associate-+r-98.1%
associate-+l-98.1%
associate-+r-98.0%
Simplified71.0%
Taylor expanded in t around inf 17.7%
associate--l+23.2%
+-commutative23.2%
associate--l+23.2%
+-commutative23.2%
associate-+r+23.2%
Simplified23.2%
Taylor expanded in y around 0 17.7%
+-commutative17.7%
+-commutative17.7%
Simplified17.7%
Taylor expanded in x around 0 27.2%
associate--l+55.7%
Simplified55.7%
if 1.39999999999999994e-30 < y < 1e16Initial program 94.5%
+-commutative94.5%
associate-+r+94.5%
associate-+r-94.5%
associate-+l-94.4%
associate-+r-94.3%
Simplified70.6%
Taylor expanded in t around inf 15.1%
associate--l+19.9%
+-commutative19.9%
associate--l+19.9%
+-commutative19.9%
associate-+r+19.9%
Simplified19.9%
Taylor expanded in z around inf 28.6%
Taylor expanded in x around 0 58.3%
associate--l+58.4%
Simplified58.4%
if 1e16 < y Initial program 83.9%
+-commutative83.9%
associate-+r+83.9%
associate-+r-42.1%
associate-+l-23.9%
associate-+r-4.4%
Simplified4.2%
Taylor expanded in t around inf 3.7%
associate--l+20.3%
+-commutative20.3%
associate--l+25.2%
+-commutative25.2%
associate-+r+25.2%
Simplified25.2%
Taylor expanded in z around inf 19.8%
Taylor expanded in y around inf 19.4%
flip--19.4%
add-sqr-sqrt19.6%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
associate--l+25.4%
+-inverses25.4%
metadata-eval25.4%
Simplified25.4%
Final simplification41.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 8.2e+14) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 8.2e+14) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 8.2d+14) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 8.2e+14) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 8.2e+14: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 8.2e+14) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 8.2e+14)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 8.2e+14], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.2 \cdot 10^{+14}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 8.2e14Initial program 97.0%
+-commutative97.0%
associate-+r+97.0%
associate-+r-78.7%
associate-+l-71.5%
associate-+r-53.4%
Simplified53.5%
Taylor expanded in t around inf 18.2%
associate--l+22.2%
+-commutative22.2%
associate--l+32.8%
+-commutative32.8%
associate-+r+32.8%
Simplified32.8%
Taylor expanded in y around 0 28.5%
+-commutative28.5%
+-commutative28.5%
Simplified28.5%
Taylor expanded in x around 0 40.2%
associate--l+40.2%
Simplified40.2%
if 8.2e14 < z Initial program 85.2%
+-commutative85.2%
associate-+r+85.2%
associate-+r-64.2%
associate-+l-54.3%
associate-+r-54.3%
Simplified25.4%
Taylor expanded in t around inf 3.4%
associate--l+21.0%
+-commutative21.0%
associate--l+14.7%
+-commutative14.7%
associate-+r+14.7%
Simplified14.7%
Taylor expanded in z around inf 39.2%
Taylor expanded in x around 0 34.2%
associate--l+53.1%
Simplified53.1%
Final simplification46.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 2.0) (+ 1.0 (sqrt (+ 1.0 y))) (- (sqrt (+ 1.0 x)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.0) {
tmp = 1.0 + sqrt((1.0 + y));
} else {
tmp = sqrt((1.0 + x)) - 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 <= 2.0d0) then
tmp = 1.0d0 + sqrt((1.0d0 + y))
else
tmp = sqrt((1.0d0 + x)) - 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 <= 2.0) {
tmp = 1.0 + Math.sqrt((1.0 + y));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.0: tmp = 1.0 + math.sqrt((1.0 + y)) else: tmp = math.sqrt((1.0 + x)) - 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 <= 2.0) tmp = Float64(1.0 + sqrt(Float64(1.0 + y))); else tmp = Float64(sqrt(Float64(1.0 + x)) - 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 <= 2.0)
tmp = 1.0 + sqrt((1.0 + y));
else
tmp = sqrt((1.0 + x)) - 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, 2.0], N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $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 2:\\
\;\;\;\;1 + \sqrt{1 + y}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 2Initial program 98.2%
+-commutative98.2%
associate-+r+98.2%
associate-+r-98.2%
associate-+l-98.2%
associate-+r-98.1%
Simplified71.3%
Taylor expanded in t around inf 17.7%
associate--l+23.1%
+-commutative23.1%
associate--l+23.1%
+-commutative23.1%
associate-+r+23.1%
Simplified23.1%
Taylor expanded in z around inf 30.5%
Taylor expanded in y around 0 29.4%
Taylor expanded in x around 0 47.2%
if 2 < y Initial program 83.6%
+-commutative83.6%
associate-+r+83.6%
associate-+r-42.8%
associate-+l-25.0%
associate-+r-6.0%
Simplified5.4%
Taylor expanded in t around inf 3.6%
associate--l+20.0%
+-commutative20.0%
associate--l+24.8%
+-commutative24.8%
associate-+r+24.8%
Simplified24.8%
Taylor expanded in z around inf 19.5%
Taylor expanded in y around inf 19.1%
Final simplification33.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \sqrt{y}\right)
\end{array}
Initial program 91.2%
+-commutative91.2%
associate-+r+91.2%
associate-+r-71.6%
associate-+l-63.0%
associate-+r-53.9%
Simplified39.7%
Taylor expanded in t around inf 10.9%
associate--l+21.6%
+-commutative21.6%
associate--l+23.9%
+-commutative23.9%
associate-+r+23.9%
Simplified23.9%
Taylor expanded in z around inf 25.2%
Taylor expanded in x around 0 28.3%
associate--l+46.2%
Simplified46.2%
Final simplification46.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (sqrt (+ 1.0 y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + 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 = 1.0d0 + 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 1.0 + Math.sqrt((1.0 + y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + math.sqrt((1.0 + y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + sqrt(Float64(1.0 + y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + 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[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \sqrt{1 + y}
\end{array}
Initial program 91.2%
+-commutative91.2%
associate-+r+91.2%
associate-+r-71.6%
associate-+l-63.0%
associate-+r-53.9%
Simplified39.7%
Taylor expanded in t around inf 10.9%
associate--l+21.6%
+-commutative21.6%
associate--l+23.9%
+-commutative23.9%
associate-+r+23.9%
Simplified23.9%
Taylor expanded in z around inf 25.2%
Taylor expanded in y around 0 18.0%
Taylor expanded in x around 0 27.6%
Final simplification27.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (sqrt (+ 1.0 y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 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 = 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 Math.sqrt((1.0 + y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(Float64(1.0 + y)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + y}
\end{array}
Initial program 91.2%
+-commutative91.2%
associate-+r+91.2%
associate-+r-71.6%
associate-+l-63.0%
associate-+r-53.9%
Simplified39.7%
Taylor expanded in t around inf 10.9%
associate--l+21.6%
+-commutative21.6%
associate--l+23.9%
+-commutative23.9%
associate-+r+23.9%
Simplified23.9%
Taylor expanded in z around inf 25.2%
Taylor expanded in y around 0 18.0%
Taylor expanded in x around inf 15.4%
Final simplification15.4%
(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 2024041
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:herbie-target
(+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))