
(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 18 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 z)) (sqrt z)))
(t_2 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_3 (sqrt (+ 1.0 y)))
(t_4 (sqrt (+ 1.0 t))))
(if (<= t_2 0.002)
(+
(/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* (sqrt x) 0.5)) x)
(+ (/ 1.0 (+ (sqrt y) t_3)) (+ t_4 (- t_1 (sqrt t)))))
(+ (+ t_1 (+ t_2 (- t_3 (sqrt y)))) (- t_4 (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)) - sqrt(z);
double t_2 = sqrt((x + 1.0)) - sqrt(x);
double t_3 = sqrt((1.0 + y));
double t_4 = sqrt((1.0 + t));
double tmp;
if (t_2 <= 0.002) {
tmp = (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x) + ((1.0 / (sqrt(y) + t_3)) + (t_4 + (t_1 - sqrt(t))));
} else {
tmp = (t_1 + (t_2 + (t_3 - sqrt(y)))) + (t_4 - 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) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((x + 1.0d0)) - sqrt(x)
t_3 = sqrt((1.0d0 + y))
t_4 = sqrt((1.0d0 + t))
if (t_2 <= 0.002d0) then
tmp = ((((-0.125d0) * sqrt((1.0d0 / x))) + (sqrt(x) * 0.5d0)) / x) + ((1.0d0 / (sqrt(y) + t_3)) + (t_4 + (t_1 - sqrt(t))))
else
tmp = (t_1 + (t_2 + (t_3 - sqrt(y)))) + (t_4 - 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)) - Math.sqrt(z);
double t_2 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_3 = Math.sqrt((1.0 + y));
double t_4 = Math.sqrt((1.0 + t));
double tmp;
if (t_2 <= 0.002) {
tmp = (((-0.125 * Math.sqrt((1.0 / x))) + (Math.sqrt(x) * 0.5)) / x) + ((1.0 / (Math.sqrt(y) + t_3)) + (t_4 + (t_1 - Math.sqrt(t))));
} else {
tmp = (t_1 + (t_2 + (t_3 - Math.sqrt(y)))) + (t_4 - 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)) - math.sqrt(z) t_2 = math.sqrt((x + 1.0)) - math.sqrt(x) t_3 = math.sqrt((1.0 + y)) t_4 = math.sqrt((1.0 + t)) tmp = 0 if t_2 <= 0.002: tmp = (((-0.125 * math.sqrt((1.0 / x))) + (math.sqrt(x) * 0.5)) / x) + ((1.0 / (math.sqrt(y) + t_3)) + (t_4 + (t_1 - math.sqrt(t)))) else: tmp = (t_1 + (t_2 + (t_3 - math.sqrt(y)))) + (t_4 - math.sqrt(t)) 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(x + 1.0)) - sqrt(x)) t_3 = sqrt(Float64(1.0 + y)) t_4 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_2 <= 0.002) tmp = Float64(Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(sqrt(x) * 0.5)) / x) + Float64(Float64(1.0 / Float64(sqrt(y) + t_3)) + Float64(t_4 + Float64(t_1 - sqrt(t))))); else tmp = Float64(Float64(t_1 + Float64(t_2 + Float64(t_3 - sqrt(y)))) + Float64(t_4 - 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)) - sqrt(z);
t_2 = sqrt((x + 1.0)) - sqrt(x);
t_3 = sqrt((1.0 + y));
t_4 = sqrt((1.0 + t));
tmp = 0.0;
if (t_2 <= 0.002)
tmp = (((-0.125 * sqrt((1.0 / x))) + (sqrt(x) * 0.5)) / x) + ((1.0 / (sqrt(y) + t_3)) + (t_4 + (t_1 - sqrt(t))));
else
tmp = (t_1 + (t_2 + (t_3 - sqrt(y)))) + (t_4 - 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[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 0.002], N[(N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(t$95$2 + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{x + 1} - \sqrt{x}\\
t_3 := \sqrt{1 + y}\\
t_4 := \sqrt{1 + t}\\
\mathbf{if}\;t\_2 \leq 0.002:\\
\;\;\;\;\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x} + \left(\frac{1}{\sqrt{y} + t\_3} + \left(t\_4 + \left(t\_1 - \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \left(t\_2 + \left(t\_3 - \sqrt{y}\right)\right)\right) + \left(t\_4 - \sqrt{t}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 2e-3Initial program 81.1%
associate-+l+81.1%
associate-+l+81.1%
+-commutative81.1%
+-commutative81.1%
associate-+l-62.3%
+-commutative62.3%
+-commutative62.3%
Simplified62.3%
flip--62.6%
add-sqr-sqrt55.2%
add-sqr-sqrt62.8%
Applied egg-rr62.8%
associate-+r-66.6%
+-inverses66.6%
metadata-eval66.6%
+-commutative66.6%
Simplified66.6%
Taylor expanded in x around inf 71.7%
if 2e-3 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.2%
Final simplification85.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)))
(t_2 (- (sqrt (+ 1.0 z)) (sqrt z)))
(t_3 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_4 (sqrt (+ 1.0 t))))
(if (<= t_3 0.0)
(+
(+ (/ 1.0 (+ (sqrt y) t_1)) (+ t_4 (- t_2 (sqrt t))))
(* (sqrt (/ 1.0 x)) 0.5))
(+ (+ t_2 (+ t_3 (- t_1 (sqrt y)))) (- t_4 (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 + y));
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double t_3 = sqrt((x + 1.0)) - sqrt(x);
double t_4 = sqrt((1.0 + t));
double tmp;
if (t_3 <= 0.0) {
tmp = ((1.0 / (sqrt(y) + t_1)) + (t_4 + (t_2 - sqrt(t)))) + (sqrt((1.0 / x)) * 0.5);
} else {
tmp = (t_2 + (t_3 + (t_1 - sqrt(y)))) + (t_4 - 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) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
t_3 = sqrt((x + 1.0d0)) - sqrt(x)
t_4 = sqrt((1.0d0 + t))
if (t_3 <= 0.0d0) then
tmp = ((1.0d0 / (sqrt(y) + t_1)) + (t_4 + (t_2 - sqrt(t)))) + (sqrt((1.0d0 / x)) * 0.5d0)
else
tmp = (t_2 + (t_3 + (t_1 - sqrt(y)))) + (t_4 - 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 + y));
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_3 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_4 = Math.sqrt((1.0 + t));
double tmp;
if (t_3 <= 0.0) {
tmp = ((1.0 / (Math.sqrt(y) + t_1)) + (t_4 + (t_2 - Math.sqrt(t)))) + (Math.sqrt((1.0 / x)) * 0.5);
} else {
tmp = (t_2 + (t_3 + (t_1 - Math.sqrt(y)))) + (t_4 - 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 + y)) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) t_3 = math.sqrt((x + 1.0)) - math.sqrt(x) t_4 = math.sqrt((1.0 + t)) tmp = 0 if t_3 <= 0.0: tmp = ((1.0 / (math.sqrt(y) + t_1)) + (t_4 + (t_2 - math.sqrt(t)))) + (math.sqrt((1.0 / x)) * 0.5) else: tmp = (t_2 + (t_3 + (t_1 - math.sqrt(y)))) + (t_4 - 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 + y)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_3 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_4 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_3 <= 0.0) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(y) + t_1)) + Float64(t_4 + Float64(t_2 - sqrt(t)))) + Float64(sqrt(Float64(1.0 / x)) * 0.5)); else tmp = Float64(Float64(t_2 + Float64(t_3 + Float64(t_1 - sqrt(y)))) + Float64(t_4 - 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 + y));
t_2 = sqrt((1.0 + z)) - sqrt(z);
t_3 = sqrt((x + 1.0)) - sqrt(x);
t_4 = sqrt((1.0 + t));
tmp = 0.0;
if (t_3 <= 0.0)
tmp = ((1.0 / (sqrt(y) + t_1)) + (t_4 + (t_2 - sqrt(t)))) + (sqrt((1.0 / x)) * 0.5);
else
tmp = (t_2 + (t_3 + (t_1 - sqrt(y)))) + (t_4 - 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 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], N[(N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + N[(t$95$3 + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
t_3 := \sqrt{x + 1} - \sqrt{x}\\
t_4 := \sqrt{1 + t}\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;\left(\frac{1}{\sqrt{y} + t\_1} + \left(t\_4 + \left(t\_2 - \sqrt{t}\right)\right)\right) + \sqrt{\frac{1}{x}} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 + \left(t\_3 + \left(t\_1 - \sqrt{y}\right)\right)\right) + \left(t\_4 - \sqrt{t}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 81.4%
associate-+l+81.4%
associate-+l+81.4%
+-commutative81.4%
+-commutative81.4%
associate-+l-62.6%
+-commutative62.6%
+-commutative62.6%
Simplified62.6%
flip--62.9%
add-sqr-sqrt55.3%
add-sqr-sqrt63.1%
Applied egg-rr63.1%
associate-+r-67.0%
+-inverses67.0%
metadata-eval67.0%
+-commutative67.0%
Simplified67.0%
Taylor expanded in x around inf 71.7%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.6%
Final simplification85.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 t)) (sqrt t))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 3e+15)
(+
t_2
(+ (+ (sqrt (+ 1.0 z)) (- (- 1.0 (sqrt x)) (sqrt z))) (- t_1 (sqrt y))))
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (+ (/ 1.0 (+ (sqrt y) t_2)) 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 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 3e+15) {
tmp = t_2 + ((sqrt((1.0 + z)) + ((1.0 - sqrt(x)) - sqrt(z))) + (t_1 - sqrt(y)));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((1.0 / (sqrt(y) + t_2)) + 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 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + y))
if (z <= 3d+15) then
tmp = t_2 + ((sqrt((1.0d0 + z)) + ((1.0d0 - sqrt(x)) - sqrt(z))) + (t_1 - sqrt(y)))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((1.0d0 / (sqrt(y) + t_2)) + 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 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 3e+15) {
tmp = t_2 + ((Math.sqrt((1.0 + z)) + ((1.0 - Math.sqrt(x)) - Math.sqrt(z))) + (t_1 - Math.sqrt(y)));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((1.0 / (Math.sqrt(y) + t_2)) + 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 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 3e+15: tmp = t_2 + ((math.sqrt((1.0 + z)) + ((1.0 - math.sqrt(x)) - math.sqrt(z))) + (t_1 - math.sqrt(y))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((1.0 / (math.sqrt(y) + t_2)) + 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 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 3e+15) tmp = Float64(t_2 + Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(Float64(1.0 - sqrt(x)) - sqrt(z))) + Float64(t_1 - sqrt(y)))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(1.0 / Float64(sqrt(y) + t_2)) + 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 + t)) - sqrt(t);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 3e+15)
tmp = t_2 + ((sqrt((1.0 + z)) + ((1.0 - sqrt(x)) - sqrt(z))) + (t_1 - sqrt(y)));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((1.0 / (sqrt(y) + t_2)) + 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 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 3e+15], N[(t$95$2 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 3 \cdot 10^{+15}:\\
\;\;\;\;t\_2 + \left(\left(\sqrt{1 + z} + \left(\left(1 - \sqrt{x}\right) - \sqrt{z}\right)\right) + \left(t\_1 - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{1}{\sqrt{y} + t\_2} + t\_1\right)\\
\end{array}
\end{array}
if z < 3e15Initial program 96.7%
+-commutative96.7%
associate-+r+96.7%
associate-+r-77.0%
associate-+l-70.5%
associate-+r-59.0%
Simplified59.0%
Taylor expanded in x around 0 31.6%
if 3e15 < z Initial program 82.7%
associate-+l+82.7%
associate-+l+82.7%
+-commutative82.7%
+-commutative82.7%
associate-+l-82.7%
+-commutative82.7%
+-commutative82.7%
Simplified82.7%
flip--82.8%
add-sqr-sqrt69.1%
add-sqr-sqrt83.0%
Applied egg-rr83.0%
associate-+r-86.5%
+-inverses86.5%
metadata-eval86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in z around inf 86.5%
Final simplification58.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt y) (sqrt z)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (sqrt (+ x 1.0)))
(t_4 (sqrt (+ 1.0 z))))
(if (<= y 4.05e-10)
(+ 1.0 (+ t_2 (- t_4 (+ (sqrt x) t_1))))
(if (<= y 7.2e+30)
(+
(- t_3 (sqrt x))
(+ (/ 1.0 (+ (sqrt y) t_2)) (- (sqrt (+ 1.0 t)) (sqrt t))))
(+ (/ (+ 1.0 (- x x)) (+ (sqrt x) t_3)) (- (+ t_2 t_4) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(y) + sqrt(z);
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt((x + 1.0));
double t_4 = sqrt((1.0 + z));
double tmp;
if (y <= 4.05e-10) {
tmp = 1.0 + (t_2 + (t_4 - (sqrt(x) + t_1)));
} else if (y <= 7.2e+30) {
tmp = (t_3 - sqrt(x)) + ((1.0 / (sqrt(y) + t_2)) + (sqrt((1.0 + t)) - sqrt(t)));
} else {
tmp = ((1.0 + (x - x)) / (sqrt(x) + t_3)) + ((t_2 + t_4) - 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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt(y) + sqrt(z)
t_2 = sqrt((1.0d0 + y))
t_3 = sqrt((x + 1.0d0))
t_4 = sqrt((1.0d0 + z))
if (y <= 4.05d-10) then
tmp = 1.0d0 + (t_2 + (t_4 - (sqrt(x) + t_1)))
else if (y <= 7.2d+30) then
tmp = (t_3 - sqrt(x)) + ((1.0d0 / (sqrt(y) + t_2)) + (sqrt((1.0d0 + t)) - sqrt(t)))
else
tmp = ((1.0d0 + (x - x)) / (sqrt(x) + t_3)) + ((t_2 + t_4) - 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(y) + Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + y));
double t_3 = Math.sqrt((x + 1.0));
double t_4 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 4.05e-10) {
tmp = 1.0 + (t_2 + (t_4 - (Math.sqrt(x) + t_1)));
} else if (y <= 7.2e+30) {
tmp = (t_3 - Math.sqrt(x)) + ((1.0 / (Math.sqrt(y) + t_2)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
} else {
tmp = ((1.0 + (x - x)) / (Math.sqrt(x) + t_3)) + ((t_2 + t_4) - t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(y) + math.sqrt(z) t_2 = math.sqrt((1.0 + y)) t_3 = math.sqrt((x + 1.0)) t_4 = math.sqrt((1.0 + z)) tmp = 0 if y <= 4.05e-10: tmp = 1.0 + (t_2 + (t_4 - (math.sqrt(x) + t_1))) elif y <= 7.2e+30: tmp = (t_3 - math.sqrt(x)) + ((1.0 / (math.sqrt(y) + t_2)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) else: tmp = ((1.0 + (x - x)) / (math.sqrt(x) + t_3)) + ((t_2 + t_4) - t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(y) + sqrt(z)) t_2 = sqrt(Float64(1.0 + y)) t_3 = sqrt(Float64(x + 1.0)) t_4 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 4.05e-10) tmp = Float64(1.0 + Float64(t_2 + Float64(t_4 - Float64(sqrt(x) + t_1)))); elseif (y <= 7.2e+30) tmp = Float64(Float64(t_3 - sqrt(x)) + Float64(Float64(1.0 / Float64(sqrt(y) + t_2)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); else tmp = Float64(Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + t_3)) + Float64(Float64(t_2 + t_4) - 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(y) + sqrt(z);
t_2 = sqrt((1.0 + y));
t_3 = sqrt((x + 1.0));
t_4 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 4.05e-10)
tmp = 1.0 + (t_2 + (t_4 - (sqrt(x) + t_1)));
elseif (y <= 7.2e+30)
tmp = (t_3 - sqrt(x)) + ((1.0 / (sqrt(y) + t_2)) + (sqrt((1.0 + t)) - sqrt(t)));
else
tmp = ((1.0 + (x - x)) / (sqrt(x) + t_3)) + ((t_2 + t_4) - 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[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 4.05e-10], N[(1.0 + N[(t$95$2 + N[(t$95$4 - N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+30], N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 + t$95$4), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y} + \sqrt{z}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{x + 1}\\
t_4 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 4.05 \cdot 10^{-10}:\\
\;\;\;\;1 + \left(t\_2 + \left(t\_4 - \left(\sqrt{x} + t\_1\right)\right)\right)\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+30}:\\
\;\;\;\;\left(t\_3 - \sqrt{x}\right) + \left(\frac{1}{\sqrt{y} + t\_2} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t\_3} + \left(\left(t\_2 + t\_4\right) - t\_1\right)\\
\end{array}
\end{array}
if y < 4.04999999999999997e-10Initial program 97.7%
+-commutative97.7%
associate-+r+97.7%
associate-+r-97.7%
associate-+l-97.7%
associate-+r-97.7%
Simplified78.2%
Taylor expanded in t around inf 14.1%
Taylor expanded in x around 0 12.7%
associate--l+22.7%
associate--l+30.7%
Simplified30.7%
if 4.04999999999999997e-10 < y < 7.2000000000000004e30Initial program 83.1%
associate-+l+83.1%
associate-+l+83.1%
+-commutative83.1%
+-commutative83.1%
associate-+l-69.0%
+-commutative69.0%
+-commutative69.0%
Simplified69.0%
flip--70.5%
add-sqr-sqrt66.7%
add-sqr-sqrt75.5%
Applied egg-rr75.5%
associate-+r-83.8%
+-inverses83.8%
metadata-eval83.8%
+-commutative83.8%
Simplified83.8%
Taylor expanded in z around inf 46.1%
if 7.2000000000000004e30 < y Initial program 81.6%
associate-+l+81.6%
associate-+l+81.6%
+-commutative81.6%
+-commutative81.6%
associate-+l-64.0%
+-commutative64.0%
+-commutative64.0%
Simplified64.0%
flip--64.0%
add-sqr-sqrt55.6%
+-commutative55.6%
add-sqr-sqrt64.0%
+-commutative64.0%
Applied egg-rr64.0%
associate--l+69.5%
Simplified69.5%
Taylor expanded in t around inf 25.8%
Final simplification29.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 y))))
(if (<= z 8.4e+15)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (/ 1.0 (+ (sqrt y) t_1)) (- (sqrt (+ 1.0 t)) (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 8.4e+15) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((1.0 / (sqrt(y) + t_1)) + (sqrt((1.0 + t)) - 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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 8.4d+15) then
tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((1.0d0 / (sqrt(y) + t_1)) + (sqrt((1.0d0 + t)) - 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 + y));
double tmp;
if (z <= 8.4e+15) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)))));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((1.0 / (Math.sqrt(y) + t_1)) + (Math.sqrt((1.0 + t)) - 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 + y)) tmp = 0 if z <= 8.4e+15: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((1.0 / (math.sqrt(y) + t_1)) + (math.sqrt((1.0 + t)) - 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 + y)) tmp = 0.0 if (z <= 8.4e+15) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(1.0 / Float64(sqrt(y) + t_1)) + Float64(sqrt(Float64(1.0 + t)) - 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 + y));
tmp = 0.0;
if (z <= 8.4e+15)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((1.0 / (sqrt(y) + t_1)) + (sqrt((1.0 + t)) - 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 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 8.4e+15], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $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])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 8.4 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(t\_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{1}{\sqrt{y} + t\_1} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if z < 8.4e15Initial program 96.7%
+-commutative96.7%
associate-+r+96.7%
associate-+r-77.0%
associate-+l-70.5%
associate-+r-59.0%
Simplified59.0%
Taylor expanded in t around inf 15.2%
Taylor expanded in x around 0 13.6%
associate--l+20.4%
associate--l+20.4%
Simplified20.4%
if 8.4e15 < z Initial program 82.7%
associate-+l+82.7%
associate-+l+82.7%
+-commutative82.7%
+-commutative82.7%
associate-+l-82.7%
+-commutative82.7%
+-commutative82.7%
Simplified82.7%
flip--82.8%
add-sqr-sqrt69.1%
add-sqr-sqrt83.0%
Applied egg-rr83.0%
associate-+r-86.5%
+-inverses86.5%
metadata-eval86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in z around inf 86.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 2.1e+18)
(+
1.0
(+
(sqrt (+ 1.0 y))
(- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))
(-
(sqrt (+ x 1.0))
(*
x
(fma -1.0 (/ (- (hypot 1.0 (sqrt y)) (sqrt y)) x) (sqrt (/ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.1e+18) {
tmp = 1.0 + (sqrt((1.0 + y)) + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
} else {
tmp = sqrt((x + 1.0)) - (x * fma(-1.0, ((hypot(1.0, sqrt(y)) - sqrt(y)) / x), sqrt((1.0 / x))));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 2.1e+18) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))))); else tmp = Float64(sqrt(Float64(x + 1.0)) - Float64(x * fma(-1.0, Float64(Float64(hypot(1.0, sqrt(y)) - sqrt(y)) / x), sqrt(Float64(1.0 / x))))); end return 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, 2.1e+18], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[(x * N[(-1.0 * N[(N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.1 \cdot 10^{+18}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - x \cdot \mathsf{fma}\left(-1, \frac{\mathsf{hypot}\left(1, \sqrt{y}\right) - \sqrt{y}}{x}, \sqrt{\frac{1}{x}}\right)\\
\end{array}
\end{array}
if z < 2.1e18Initial program 96.2%
+-commutative96.2%
associate-+r+96.2%
associate-+r-76.3%
associate-+l-69.9%
associate-+r-58.6%
Simplified58.6%
Taylor expanded in t around inf 15.1%
Taylor expanded in x around 0 13.6%
associate--l+20.7%
associate--l+20.7%
Simplified20.7%
if 2.1e18 < z Initial program 83.0%
+-commutative83.0%
associate-+r+83.0%
associate-+r-64.7%
associate-+l-54.9%
associate-+r-54.9%
Simplified32.9%
Taylor expanded in t around inf 3.9%
Taylor expanded in z around inf 20.7%
associate--l+30.1%
Simplified30.1%
Taylor expanded in x around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
Simplified30.1%
Final simplification25.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))) (t_2 (sqrt (+ x 1.0))))
(if (<= y 2.25e-41)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))
(if (<= y 64000.0)
(- (+ (+ t_1 t_2) (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y)))
(+
t_2
(-
(+ (* -0.125 (sqrt (/ 1.0 (pow y 3.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 t_1 = sqrt((1.0 + y));
double t_2 = sqrt((x + 1.0));
double tmp;
if (y <= 2.25e-41) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
} else if (y <= 64000.0) {
tmp = ((t_1 + t_2) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y));
} else {
tmp = t_2 + (((-0.125 * sqrt((1.0 / pow(y, 3.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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((x + 1.0d0))
if (y <= 2.25d-41) then
tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))))
else if (y <= 64000.0d0) then
tmp = ((t_1 + t_2) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y))
else
tmp = t_2 + ((((-0.125d0) * sqrt((1.0d0 / (y ** 3.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 t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 2.25e-41) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)))));
} else if (y <= 64000.0) {
tmp = ((t_1 + t_2) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = t_2 + (((-0.125 * Math.sqrt((1.0 / Math.pow(y, 3.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): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((x + 1.0)) tmp = 0 if y <= 2.25e-41: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))))) elif y <= 64000.0: tmp = ((t_1 + t_2) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = t_2 + (((-0.125 * math.sqrt((1.0 / math.pow(y, 3.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) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 2.25e-41) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))))); elseif (y <= 64000.0) tmp = Float64(Float64(Float64(t_1 + t_2) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(t_2 + Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / (y ^ 3.0)))) + 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)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 2.25e-41)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
elseif (y <= 64000.0)
tmp = ((t_1 + t_2) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y));
else
tmp = t_2 + (((-0.125 * sqrt((1.0 / (y ^ 3.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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.25e-41], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 64000.0], N[(N[(N[(t$95$1 + t$95$2), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $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}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 2.25 \cdot 10^{-41}:\\
\;\;\;\;1 + \left(t\_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{elif}\;y \leq 64000:\\
\;\;\;\;\left(\left(t\_1 + t\_2\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(\left(-0.125 \cdot \sqrt{\frac{1}{{y}^{3}}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 2.25e-41Initial program 97.6%
+-commutative97.6%
associate-+r+97.6%
associate-+r-97.6%
associate-+l-97.6%
associate-+r-97.6%
Simplified76.9%
Taylor expanded in t around inf 14.0%
Taylor expanded in x around 0 12.6%
associate--l+22.4%
associate--l+31.1%
Simplified31.1%
if 2.25e-41 < y < 64000Initial program 99.7%
+-commutative99.7%
associate-+r+99.7%
associate-+r-99.7%
associate-+l-99.7%
associate-+r-99.5%
Simplified94.4%
Taylor expanded in t around inf 24.5%
Taylor expanded in z around inf 11.9%
associate-+r+11.9%
+-commutative11.9%
Simplified11.9%
if 64000 < y Initial program 81.2%
+-commutative81.2%
associate-+r+81.2%
associate-+r-41.4%
associate-+l-24.7%
associate-+r-12.5%
Simplified11.0%
Taylor expanded in t around inf 3.9%
Taylor expanded in z around inf 4.2%
associate--l+18.7%
Simplified18.7%
Taylor expanded in y around inf 18.9%
Final simplification24.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 4e+18)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))
(+ (sqrt (+ x 1.0)) (- 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 + y));
double tmp;
if (z <= 4e+18) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
} else {
tmp = sqrt((x + 1.0)) + (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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 4d+18) then
tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))))
else
tmp = sqrt((x + 1.0d0)) + (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 + y));
double tmp;
if (z <= 4e+18) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)))));
} else {
tmp = Math.sqrt((x + 1.0)) + (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 + y)) tmp = 0 if z <= 4e+18: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))))) else: tmp = math.sqrt((x + 1.0)) + (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 + y)) tmp = 0.0 if (z <= 4e+18) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(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 + y));
tmp = 0.0;
if (z <= 4e+18)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
else
tmp = sqrt((x + 1.0)) + (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 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 4e+18], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $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{1 + y}\\
\mathbf{if}\;z \leq 4 \cdot 10^{+18}:\\
\;\;\;\;1 + \left(t\_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 4e18Initial program 96.2%
+-commutative96.2%
associate-+r+96.2%
associate-+r-76.3%
associate-+l-69.9%
associate-+r-58.6%
Simplified58.6%
Taylor expanded in t around inf 15.1%
Taylor expanded in x around 0 13.6%
associate--l+20.7%
associate--l+20.7%
Simplified20.7%
if 4e18 < z Initial program 83.0%
+-commutative83.0%
associate-+r+83.0%
associate-+r-64.7%
associate-+l-54.9%
associate-+r-54.9%
Simplified32.9%
Taylor expanded in t around inf 3.9%
Taylor expanded in z around inf 20.7%
associate--l+30.1%
Simplified30.1%
Final simplification25.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))))
(if (<= z 1.1)
(- (+ (+ t_1 2.0) (* 0.5 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (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));
double tmp;
if (z <= 1.1) {
tmp = ((t_1 + 2.0) + (0.5 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = t_1 + (sqrt((1.0 + y)) - (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) :: tmp
t_1 = sqrt((x + 1.0d0))
if (z <= 1.1d0) then
tmp = ((t_1 + 2.0d0) + (0.5d0 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = t_1 + (sqrt((1.0d0 + y)) - (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));
double tmp;
if (z <= 1.1) {
tmp = ((t_1 + 2.0) + (0.5 * z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (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)) tmp = 0 if z <= 1.1: tmp = ((t_1 + 2.0) + (0.5 * z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = t_1 + (math.sqrt((1.0 + y)) - (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(x + 1.0)) tmp = 0.0 if (z <= 1.1) tmp = Float64(Float64(Float64(t_1 + 2.0) + Float64(0.5 * z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - 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));
tmp = 0.0;
if (z <= 1.1)
tmp = ((t_1 + 2.0) + (0.5 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = t_1 + (sqrt((1.0 + y)) - (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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.1], N[(N[(N[(t$95$1 + 2.0), $MachinePrecision] + N[(0.5 * z), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;z \leq 1.1:\\
\;\;\;\;\left(\left(t\_1 + 2\right) + 0.5 \cdot z\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1.1000000000000001Initial program 97.3%
+-commutative97.3%
associate-+r+97.3%
associate-+r-77.4%
associate-+l-72.2%
associate-+r-61.2%
Simplified61.2%
Taylor expanded in t around inf 15.7%
Taylor expanded in z around 0 15.7%
associate-+r+15.7%
*-commutative15.7%
Simplified15.7%
Taylor expanded in y around 0 13.4%
associate-+r+13.5%
*-commutative13.5%
Simplified13.5%
if 1.1000000000000001 < z Initial program 82.5%
+-commutative82.5%
associate-+r+82.5%
associate-+r-64.3%
associate-+l-53.4%
associate-+r-52.5%
Simplified31.7%
Taylor expanded in t around inf 4.0%
Taylor expanded in z around inf 19.9%
associate--l+29.7%
Simplified29.7%
Final simplification21.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 1.12)
(- (+ 2.0 (+ t_1 (* 0.5 z))) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+ (sqrt (+ x 1.0)) (- 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 + y));
double tmp;
if (z <= 1.12) {
tmp = (2.0 + (t_1 + (0.5 * z))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = sqrt((x + 1.0)) + (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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 1.12d0) then
tmp = (2.0d0 + (t_1 + (0.5d0 * z))) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = sqrt((x + 1.0d0)) + (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 + y));
double tmp;
if (z <= 1.12) {
tmp = (2.0 + (t_1 + (0.5 * z))) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = Math.sqrt((x + 1.0)) + (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 + y)) tmp = 0 if z <= 1.12: tmp = (2.0 + (t_1 + (0.5 * z))) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = math.sqrt((x + 1.0)) + (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 + y)) tmp = 0.0 if (z <= 1.12) tmp = Float64(Float64(2.0 + Float64(t_1 + Float64(0.5 * z))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(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 + y));
tmp = 0.0;
if (z <= 1.12)
tmp = (2.0 + (t_1 + (0.5 * z))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = sqrt((x + 1.0)) + (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 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.12], N[(N[(2.0 + N[(t$95$1 + N[(0.5 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $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{1 + y}\\
\mathbf{if}\;z \leq 1.12:\\
\;\;\;\;\left(2 + \left(t\_1 + 0.5 \cdot z\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1.1200000000000001Initial program 97.3%
+-commutative97.3%
associate-+r+97.3%
associate-+r-77.4%
associate-+l-72.2%
associate-+r-61.2%
Simplified61.2%
Taylor expanded in t around inf 15.7%
Taylor expanded in z around 0 15.7%
associate-+r+15.7%
*-commutative15.7%
Simplified15.7%
Taylor expanded in x around 0 14.1%
if 1.1200000000000001 < z Initial program 82.5%
+-commutative82.5%
associate-+r+82.5%
associate-+r-64.3%
associate-+l-53.4%
associate-+r-52.5%
Simplified31.7%
Taylor expanded in t around inf 4.0%
Taylor expanded in z around inf 19.9%
associate--l+29.7%
Simplified29.7%
Final simplification22.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 19000000.0) (- (+ 1.0 (hypot 1.0 (sqrt 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 <= 19000000.0) {
tmp = (1.0 + hypot(1.0, sqrt(y))) - (sqrt(x) + sqrt(y));
} else {
tmp = (sqrt((x + 1.0)) + (0.5 * sqrt((1.0 / y)))) - sqrt(x);
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 19000000.0) {
tmp = (1.0 + Math.hypot(1.0, Math.sqrt(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 <= 19000000.0: tmp = (1.0 + math.hypot(1.0, math.sqrt(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 <= 19000000.0) tmp = Float64(Float64(1.0 + hypot(1.0, sqrt(y))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + 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 <= 19000000.0)
tmp = (1.0 + hypot(1.0, sqrt(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, 19000000.0], N[(N[(1.0 + N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 19000000:\\
\;\;\;\;\left(1 + \mathsf{hypot}\left(1, \sqrt{y}\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.9e7Initial program 97.8%
+-commutative97.8%
associate-+r+97.8%
associate-+r-97.8%
associate-+l-97.8%
associate-+r-97.8%
Simplified78.9%
Taylor expanded in t around inf 15.2%
Taylor expanded in z around inf 23.7%
associate--l+23.7%
Simplified23.7%
Taylor expanded in x around 0 21.3%
rem-square-sqrt21.3%
metadata-eval21.3%
hypot-undefine21.3%
Simplified21.3%
if 1.9e7 < y Initial program 81.2%
+-commutative81.2%
associate-+r+81.2%
associate-+r-41.4%
associate-+l-24.7%
associate-+r-12.5%
Simplified11.0%
Taylor expanded in t around inf 3.9%
Taylor expanded in z around inf 4.2%
associate--l+18.7%
Simplified18.7%
Taylor expanded in y around inf 18.9%
Final simplification20.2%
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 (+ 1.0 y)) (+ (sqrt x) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + 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[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)
\end{array}
Initial program 89.8%
+-commutative89.8%
associate-+r+89.8%
associate-+r-70.7%
associate-+l-62.7%
associate-+r-56.8%
Simplified46.3%
Taylor expanded in t around inf 9.8%
Taylor expanded in z around inf 14.3%
associate--l+21.3%
Simplified21.3%
Final simplification21.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 72000000.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 <= 72000000.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 <= 72000000.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 <= 72000000.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 <= 72000000.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 <= 72000000.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + 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 <= 72000000.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, 72000000.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 72000000:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 7.2e7Initial program 97.8%
+-commutative97.8%
associate-+r+97.8%
associate-+r-97.8%
associate-+l-97.8%
associate-+r-97.8%
Simplified78.9%
Taylor expanded in t around inf 15.2%
Taylor expanded in z around inf 23.7%
associate--l+23.7%
Simplified23.7%
Taylor expanded in x around 0 21.3%
associate--l+21.3%
Simplified21.3%
if 7.2e7 < y Initial program 81.2%
+-commutative81.2%
associate-+r+81.2%
associate-+r-41.4%
associate-+l-24.7%
associate-+r-12.5%
Simplified11.0%
Taylor expanded in t around inf 3.9%
Taylor expanded in z around inf 4.2%
associate--l+18.7%
Simplified18.7%
Taylor expanded in y around inf 18.9%
Final simplification20.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)) (+ (sqrt x) (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(x) + 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(x) + 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(x) + 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(x) + 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)) - Float64(sqrt(x) + 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(x) + 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[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)
\end{array}
Initial program 89.8%
+-commutative89.8%
associate-+r+89.8%
associate-+r-70.7%
associate-+l-62.7%
associate-+r-56.8%
Simplified46.3%
Taylor expanded in t around inf 9.8%
Taylor expanded in z around inf 14.3%
associate--l+21.3%
Simplified21.3%
Taylor expanded in x around 0 12.8%
associate--l+21.8%
Simplified21.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 (<= y 0.85) (+ 1.0 t_1) t_1)))
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 (y <= 0.85) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (y <= 0.85d0) then
tmp = 1.0d0 + t_1
else
tmp = 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((x + 1.0)) - Math.sqrt(x);
double tmp;
if (y <= 0.85) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
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 y <= 0.85: tmp = 1.0 + t_1 else: tmp = t_1 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 (y <= 0.85) tmp = Float64(1.0 + t_1); else tmp = 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((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (y <= 0.85)
tmp = 1.0 + t_1;
else
tmp = 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[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 0.85], N[(1.0 + t$95$1), $MachinePrecision], t$95$1]]
\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}\;y \leq 0.85:\\
\;\;\;\;1 + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < 0.849999999999999978Initial program 97.8%
+-commutative97.8%
associate-+r+97.8%
associate-+r-97.8%
associate-+l-97.8%
associate-+r-97.8%
Simplified78.7%
Taylor expanded in t around inf 15.3%
Taylor expanded in z around inf 23.9%
associate--l+23.8%
Simplified23.8%
Taylor expanded in x around inf 23.7%
Taylor expanded in y around 0 23.7%
associate--l+38.1%
Simplified38.1%
if 0.849999999999999978 < y Initial program 81.3%
+-commutative81.3%
associate-+r+81.3%
associate-+r-41.9%
associate-+l-25.3%
associate-+r-13.2%
Simplified11.7%
Taylor expanded in t around inf 3.9%
Taylor expanded in z around inf 4.1%
associate--l+18.6%
Simplified18.6%
Taylor expanded in y around inf 18.8%
Final simplification28.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 89.8%
+-commutative89.8%
associate-+r+89.8%
associate-+r-70.7%
associate-+l-62.7%
associate-+r-56.8%
Simplified46.3%
Taylor expanded in t around inf 9.8%
Taylor expanded in z around inf 14.3%
associate--l+21.3%
Simplified21.3%
Taylor expanded in y around inf 14.9%
Final simplification14.9%
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 89.8%
+-commutative89.8%
associate-+r+89.8%
associate-+r-70.7%
associate-+l-62.7%
associate-+r-56.8%
Simplified46.3%
Taylor expanded in t around inf 9.8%
Taylor expanded in z around inf 14.3%
associate--l+21.3%
Simplified21.3%
Taylor expanded in x around inf 15.2%
Taylor expanded in x around inf 17.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (sqrt y))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(y) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt(y);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[Sqrt[y], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{y}
\end{array}
Initial program 89.8%
+-commutative89.8%
associate-+r+89.8%
associate-+r-70.7%
associate-+l-62.7%
associate-+r-56.8%
Simplified46.3%
Taylor expanded in t around inf 9.8%
Taylor expanded in z around inf 14.3%
associate--l+21.3%
Simplified21.3%
Taylor expanded in x around inf 15.2%
Taylor expanded in y around inf 6.8%
(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 2024181
(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))))