
(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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (sqrt (+ 1.0 z)))
(t_4 (- t_3 (sqrt z)))
(t_5 (sqrt (+ 1.0 y)))
(t_6 (+ (- t_2 (sqrt x)) (- t_5 (sqrt y)))))
(if (<= t_6 0.0)
(+
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y))))
(+ t_4 (* 0.5 (sqrt (/ 1.0 t)))))
(if (<= t_6 1.002)
(+
(/ (+ (* (sqrt y) 0.5) (* y (/ (- (+ x 1.0) x) (+ (sqrt x) t_2)))) y)
(+ t_4 t_1))
(+
(+ (/ 1.0 (+ t_3 (sqrt z))) t_1)
(- (+ 1.0 t_5) (+ (sqrt x) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((x + 1.0));
double t_3 = sqrt((1.0 + z));
double t_4 = t_3 - sqrt(z);
double t_5 = sqrt((1.0 + y));
double t_6 = (t_2 - sqrt(x)) + (t_5 - sqrt(y));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_4 + (0.5 * sqrt((1.0 / t))));
} else if (t_6 <= 1.002) {
tmp = (((sqrt(y) * 0.5) + (y * (((x + 1.0) - x) / (sqrt(x) + t_2)))) / y) + (t_4 + t_1);
} else {
tmp = ((1.0 / (t_3 + sqrt(z))) + t_1) + ((1.0 + t_5) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((x + 1.0d0))
t_3 = sqrt((1.0d0 + z))
t_4 = t_3 - sqrt(z)
t_5 = sqrt((1.0d0 + y))
t_6 = (t_2 - sqrt(x)) + (t_5 - sqrt(y))
if (t_6 <= 0.0d0) then
tmp = (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y)))) + (t_4 + (0.5d0 * sqrt((1.0d0 / t))))
else if (t_6 <= 1.002d0) then
tmp = (((sqrt(y) * 0.5d0) + (y * (((x + 1.0d0) - x) / (sqrt(x) + t_2)))) / y) + (t_4 + t_1)
else
tmp = ((1.0d0 / (t_3 + sqrt(z))) + t_1) + ((1.0d0 + t_5) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((x + 1.0));
double t_3 = Math.sqrt((1.0 + z));
double t_4 = t_3 - Math.sqrt(z);
double t_5 = Math.sqrt((1.0 + y));
double t_6 = (t_2 - Math.sqrt(x)) + (t_5 - Math.sqrt(y));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y)))) + (t_4 + (0.5 * Math.sqrt((1.0 / t))));
} else if (t_6 <= 1.002) {
tmp = (((Math.sqrt(y) * 0.5) + (y * (((x + 1.0) - x) / (Math.sqrt(x) + t_2)))) / y) + (t_4 + t_1);
} else {
tmp = ((1.0 / (t_3 + Math.sqrt(z))) + t_1) + ((1.0 + t_5) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((x + 1.0)) t_3 = math.sqrt((1.0 + z)) t_4 = t_3 - math.sqrt(z) t_5 = math.sqrt((1.0 + y)) t_6 = (t_2 - math.sqrt(x)) + (t_5 - math.sqrt(y)) tmp = 0 if t_6 <= 0.0: tmp = (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y)))) + (t_4 + (0.5 * math.sqrt((1.0 / t)))) elif t_6 <= 1.002: tmp = (((math.sqrt(y) * 0.5) + (y * (((x + 1.0) - x) / (math.sqrt(x) + t_2)))) / y) + (t_4 + t_1) else: tmp = ((1.0 / (t_3 + math.sqrt(z))) + t_1) + ((1.0 + t_5) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(x + 1.0)) t_3 = sqrt(Float64(1.0 + z)) t_4 = Float64(t_3 - sqrt(z)) t_5 = sqrt(Float64(1.0 + y)) t_6 = Float64(Float64(t_2 - sqrt(x)) + Float64(t_5 - sqrt(y))) tmp = 0.0 if (t_6 <= 0.0) tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))) + Float64(t_4 + Float64(0.5 * sqrt(Float64(1.0 / t))))); elseif (t_6 <= 1.002) tmp = Float64(Float64(Float64(Float64(sqrt(y) * 0.5) + Float64(y * Float64(Float64(Float64(x + 1.0) - x) / Float64(sqrt(x) + t_2)))) / y) + Float64(t_4 + t_1)); else tmp = Float64(Float64(Float64(1.0 / Float64(t_3 + sqrt(z))) + t_1) + Float64(Float64(1.0 + t_5) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
t_2 = sqrt((x + 1.0));
t_3 = sqrt((1.0 + z));
t_4 = t_3 - sqrt(z);
t_5 = sqrt((1.0 + y));
t_6 = (t_2 - sqrt(x)) + (t_5 - sqrt(y));
tmp = 0.0;
if (t_6 <= 0.0)
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_4 + (0.5 * sqrt((1.0 / t))));
elseif (t_6 <= 1.002)
tmp = (((sqrt(y) * 0.5) + (y * (((x + 1.0) - x) / (sqrt(x) + t_2)))) / y) + (t_4 + t_1);
else
tmp = ((1.0 / (t_3 + sqrt(z))) + t_1) + ((1.0 + t_5) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$5 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 0.0], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 1.002], N[(N[(N[(N[(N[Sqrt[y], $MachinePrecision] * 0.5), $MachinePrecision] + N[(y * N[(N[(N[(x + 1.0), $MachinePrecision] - x), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(t$95$4 + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(N[(1.0 + t$95$5), $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{1 + t} - \sqrt{t}\\
t_2 := \sqrt{x + 1}\\
t_3 := \sqrt{1 + z}\\
t_4 := t\_3 - \sqrt{z}\\
t_5 := \sqrt{1 + y}\\
t_6 := \left(t\_2 - \sqrt{x}\right) + \left(t\_5 - \sqrt{y}\right)\\
\mathbf{if}\;t\_6 \leq 0:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right) + \left(t\_4 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{elif}\;t\_6 \leq 1.002:\\
\;\;\;\;\frac{\sqrt{y} \cdot 0.5 + y \cdot \frac{\left(x + 1\right) - x}{\sqrt{x} + t\_2}}{y} + \left(t\_4 + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_3 + \sqrt{z}} + t\_1\right) + \left(\left(1 + t\_5\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 0.0Initial program 86.5%
associate-+l+86.5%
associate-+l-86.5%
associate-+l-86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in y around inf 86.5%
Taylor expanded in x around inf 91.1%
distribute-lft-out91.1%
Simplified91.1%
Taylor expanded in t around inf 36.5%
if 0.0 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 1.002Initial program 96.0%
associate-+l+96.0%
associate-+l-60.7%
associate-+l-96.0%
+-commutative96.0%
+-commutative96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in y around inf 57.9%
Taylor expanded in y around 0 57.1%
+-commutative57.1%
flip--57.0%
add-sqr-sqrt56.3%
add-sqr-sqrt57.5%
Applied egg-rr57.5%
if 1.002 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) Initial program 97.1%
associate-+l+97.1%
associate-+l-97.1%
associate-+l-97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
flip--97.2%
add-sqr-sqrt75.5%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
associate--l+97.8%
+-inverses97.8%
metadata-eval97.8%
Simplified97.8%
Taylor expanded in x around 0 93.8%
Final simplification62.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_2 (+ (sqrt (+ 1.0 t)) (sqrt t)))
(t_3 (- (sqrt (+ 1.0 y)) (sqrt y)))
(t_4 (sqrt (+ 1.0 z)))
(t_5 (+ t_4 (sqrt z))))
(if (<= (+ t_1 t_3) 5e-5)
(+
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y))))
(+ (- t_4 (sqrt z)) (* 0.5 (sqrt (/ 1.0 t)))))
(+ t_1 (+ t_3 (/ (+ t_2 t_5) (* t_2 t_5)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double t_2 = sqrt((1.0 + t)) + sqrt(t);
double t_3 = sqrt((1.0 + y)) - sqrt(y);
double t_4 = sqrt((1.0 + z));
double t_5 = t_4 + sqrt(z);
double tmp;
if ((t_1 + t_3) <= 5e-5) {
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + ((t_4 - sqrt(z)) + (0.5 * sqrt((1.0 / t))));
} else {
tmp = t_1 + (t_3 + ((t_2 + t_5) / (t_2 * t_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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
t_2 = sqrt((1.0d0 + t)) + sqrt(t)
t_3 = sqrt((1.0d0 + y)) - sqrt(y)
t_4 = sqrt((1.0d0 + z))
t_5 = t_4 + sqrt(z)
if ((t_1 + t_3) <= 5d-5) then
tmp = (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y)))) + ((t_4 - sqrt(z)) + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = t_1 + (t_3 + ((t_2 + t_5) / (t_2 * t_5)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + t)) + Math.sqrt(t);
double t_3 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double t_4 = Math.sqrt((1.0 + z));
double t_5 = t_4 + Math.sqrt(z);
double tmp;
if ((t_1 + t_3) <= 5e-5) {
tmp = (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y)))) + ((t_4 - Math.sqrt(z)) + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = t_1 + (t_3 + ((t_2 + t_5) / (t_2 * t_5)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) t_2 = math.sqrt((1.0 + t)) + math.sqrt(t) t_3 = math.sqrt((1.0 + y)) - math.sqrt(y) t_4 = math.sqrt((1.0 + z)) t_5 = t_4 + math.sqrt(z) tmp = 0 if (t_1 + t_3) <= 5e-5: tmp = (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y)))) + ((t_4 - math.sqrt(z)) + (0.5 * math.sqrt((1.0 / t)))) else: tmp = t_1 + (t_3 + ((t_2 + t_5) / (t_2 * t_5))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_2 = Float64(sqrt(Float64(1.0 + t)) + sqrt(t)) t_3 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) t_4 = sqrt(Float64(1.0 + z)) t_5 = Float64(t_4 + sqrt(z)) tmp = 0.0 if (Float64(t_1 + t_3) <= 5e-5) tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))) + Float64(Float64(t_4 - sqrt(z)) + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(t_1 + Float64(t_3 + Float64(Float64(t_2 + t_5) / Float64(t_2 * t_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((x + 1.0)) - sqrt(x);
t_2 = sqrt((1.0 + t)) + sqrt(t);
t_3 = sqrt((1.0 + y)) - sqrt(y);
t_4 = sqrt((1.0 + z));
t_5 = t_4 + sqrt(z);
tmp = 0.0;
if ((t_1 + t_3) <= 5e-5)
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + ((t_4 - sqrt(z)) + (0.5 * sqrt((1.0 / t))));
else
tmp = t_1 + (t_3 + ((t_2 + t_5) / (t_2 * t_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[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[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[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 + t$95$3), $MachinePrecision], 5e-5], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$3 + N[(N[(t$95$2 + t$95$5), $MachinePrecision] / N[(t$95$2 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
t_2 := \sqrt{1 + t} + \sqrt{t}\\
t_3 := \sqrt{1 + y} - \sqrt{y}\\
t_4 := \sqrt{1 + z}\\
t_5 := t\_4 + \sqrt{z}\\
\mathbf{if}\;t\_1 + t\_3 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right) + \left(\left(t\_4 - \sqrt{z}\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_3 + \frac{t\_2 + t\_5}{t\_2 \cdot t\_5}\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 5.00000000000000024e-5Initial program 85.9%
associate-+l+85.9%
associate-+l-85.0%
associate-+l-85.9%
+-commutative85.9%
+-commutative85.9%
+-commutative85.9%
Simplified85.9%
Taylor expanded in y around inf 85.0%
Taylor expanded in x around inf 90.8%
distribute-lft-out90.8%
Simplified90.8%
Taylor expanded in t around inf 36.5%
if 5.00000000000000024e-5 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) Initial program 96.7%
associate-+l+96.7%
associate-+l+96.7%
+-commutative96.7%
+-commutative96.7%
associate-+l-78.2%
+-commutative78.2%
+-commutative78.2%
Simplified78.2%
associate--r-96.7%
+-commutative96.7%
flip--96.7%
flip--96.9%
frac-add96.8%
Applied egg-rr97.3%
Simplified98.4%
Final simplification82.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 (+ x 1.0)) (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y))))
(t_2 (sqrt (+ 1.0 z))))
(if (<= t_1 5e-5)
(+
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y))))
(+ (- t_2 (sqrt z)) (* 0.5 (sqrt (/ 1.0 t)))))
(+ t_1 (+ (/ 1.0 (+ t_2 (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) {
double t_1 = (sqrt((x + 1.0)) - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
double t_2 = sqrt((1.0 + z));
double tmp;
if (t_1 <= 5e-5) {
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + (0.5 * sqrt((1.0 / t))));
} else {
tmp = t_1 + ((1.0 / (t_2 + sqrt(z))) + (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) :: t_2
real(8) :: tmp
t_1 = (sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y))
t_2 = sqrt((1.0d0 + z))
if (t_1 <= 5d-5) then
tmp = (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y)))) + ((t_2 - sqrt(z)) + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = t_1 + ((1.0d0 / (t_2 + sqrt(z))) + (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((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if (t_1 <= 5e-5) {
tmp = (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y)))) + ((t_2 - Math.sqrt(z)) + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = t_1 + ((1.0 / (t_2 + Math.sqrt(z))) + (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((x + 1.0)) - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y)) t_2 = math.sqrt((1.0 + z)) tmp = 0 if t_1 <= 5e-5: tmp = (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y)))) + ((t_2 - math.sqrt(z)) + (0.5 * math.sqrt((1.0 / t)))) else: tmp = t_1 + ((1.0 / (t_2 + math.sqrt(z))) + (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 = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t_1 <= 5e-5) tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))) + Float64(Float64(t_2 - sqrt(z)) + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(t_2 + sqrt(z))) + 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((x + 1.0)) - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
t_2 = sqrt((1.0 + z));
tmp = 0.0;
if (t_1 <= 5e-5)
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + (0.5 * sqrt((1.0 / t))));
else
tmp = t_1 + ((1.0 / (t_2 + sqrt(z))) + (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[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 5e-5], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(t$95$2 + 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])\\
\\
\begin{array}{l}
t_1 := \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right) + \left(\left(t\_2 - \sqrt{z}\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\frac{1}{t\_2 + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 5.00000000000000024e-5Initial program 85.9%
associate-+l+85.9%
associate-+l-85.0%
associate-+l-85.9%
+-commutative85.9%
+-commutative85.9%
+-commutative85.9%
Simplified85.9%
Taylor expanded in y around inf 85.0%
Taylor expanded in x around inf 90.8%
distribute-lft-out90.8%
Simplified90.8%
Taylor expanded in t around inf 36.5%
if 5.00000000000000024e-5 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) Initial program 96.7%
associate-+l+96.7%
associate-+l-74.3%
associate-+l-96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
flip--96.8%
add-sqr-sqrt75.9%
add-sqr-sqrt96.8%
Applied egg-rr96.8%
associate--l+97.2%
+-inverses97.2%
metadata-eval97.2%
Simplified97.2%
Final simplification81.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)))
(t_2 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= t_1 5e-5)
(+
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y))))
(+ t_2 (* 0.5 (sqrt (/ 1.0 t)))))
(+ t_1 (+ t_2 (- (sqrt (+ 1.0 y)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (t_1 <= 5e-5) {
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_2 + (0.5 * sqrt((1.0 / t))));
} else {
tmp = t_1 + (t_2 + (sqrt((1.0 + y)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
if (t_1 <= 5d-5) then
tmp = (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y)))) + (t_2 + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = t_1 + (t_2 + (sqrt((1.0d0 + y)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (t_1 <= 5e-5) {
tmp = (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y)))) + (t_2 + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = t_1 + (t_2 + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if t_1 <= 5e-5: tmp = (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y)))) + (t_2 + (0.5 * math.sqrt((1.0 / t)))) else: tmp = t_1 + (t_2 + (math.sqrt((1.0 + y)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (t_1 <= 5e-5) tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))) + Float64(t_2 + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(t_1 + Float64(t_2 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
t_2 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (t_1 <= 5e-5)
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_2 + (0.5 * sqrt((1.0 / t))));
else
tmp = t_1 + (t_2 + (sqrt((1.0 + y)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-5], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right) + \left(t\_2 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_2 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 5.00000000000000024e-5Initial program 91.4%
associate-+l+91.4%
associate-+l-55.1%
associate-+l-91.4%
+-commutative91.4%
+-commutative91.4%
+-commutative91.4%
Simplified91.4%
Taylor expanded in y around inf 50.7%
Taylor expanded in x around inf 52.5%
distribute-lft-out52.5%
Simplified52.5%
Taylor expanded in t around inf 22.8%
if 5.00000000000000024e-5 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.3%
associate-+l+96.3%
associate-+l+96.3%
+-commutative96.3%
+-commutative96.3%
associate-+l-79.5%
+-commutative79.5%
+-commutative79.5%
Simplified79.5%
Taylor expanded in t around inf 57.7%
Final simplification41.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (sqrt (+ 1.0 z))))
(if (<= y 5.2e-15)
(+
(+ (/ 1.0 (+ t_2 (sqrt z))) (- (sqrt (+ 1.0 t)) (sqrt t)))
(- (+ 1.0 t_1) (+ (sqrt x) (sqrt y))))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (- t_2 (sqrt z)) (/ 1.0 (+ (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 + y));
double t_2 = sqrt((1.0 + z));
double tmp;
if (y <= 5.2e-15) {
tmp = ((1.0 / (t_2 + sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + t_1) - (sqrt(x) + sqrt(y)));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_2 - sqrt(z)) + (1.0 / (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 + y))
t_2 = sqrt((1.0d0 + z))
if (y <= 5.2d-15) then
tmp = ((1.0d0 / (t_2 + sqrt(z))) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((1.0d0 + t_1) - (sqrt(x) + sqrt(y)))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((t_2 - sqrt(z)) + (1.0d0 / (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 + y));
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 5.2e-15) {
tmp = ((1.0 / (t_2 + Math.sqrt(z))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((1.0 + t_1) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((t_2 - Math.sqrt(z)) + (1.0 / (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 + y)) t_2 = math.sqrt((1.0 + z)) tmp = 0 if y <= 5.2e-15: tmp = ((1.0 / (t_2 + math.sqrt(z))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((1.0 + t_1) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((t_2 - math.sqrt(z)) + (1.0 / (math.sqrt(y) + t_1))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 5.2e-15) tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(z))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(1.0 + t_1) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(t_2 - sqrt(z)) + Float64(1.0 / Float64(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 + y));
t_2 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 5.2e-15)
tmp = ((1.0 / (t_2 + sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + t_1) - (sqrt(x) + sqrt(y)));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_2 - sqrt(z)) + (1.0 / (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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 5.2e-15], N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 5.2 \cdot 10^{-15}:\\
\;\;\;\;\left(\frac{1}{t\_2 + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(1 + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(t\_2 - \sqrt{z}\right) + \frac{1}{\sqrt{y} + t\_1}\right)\\
\end{array}
\end{array}
if y < 5.20000000000000009e-15Initial program 97.4%
associate-+l+97.4%
associate-+l-62.2%
associate-+l-97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
flip--97.4%
add-sqr-sqrt74.9%
add-sqr-sqrt97.4%
Applied egg-rr97.4%
associate--l+97.9%
+-inverses97.9%
metadata-eval97.9%
Simplified97.9%
Taylor expanded in x around 0 51.7%
if 5.20000000000000009e-15 < y Initial program 91.1%
associate-+l+91.1%
associate-+l+91.1%
+-commutative91.1%
+-commutative91.1%
associate-+l-74.0%
+-commutative74.0%
+-commutative74.0%
Simplified74.0%
flip--74.1%
add-sqr-sqrt45.9%
add-sqr-sqrt74.4%
Applied egg-rr74.4%
associate--l+77.2%
+-inverses77.2%
metadata-eval77.2%
Simplified77.2%
Taylor expanded in t around inf 46.2%
Final simplification48.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 400000.0)
(+
(- (+ 1.0 t_2) (+ (sqrt x) (sqrt y)))
(+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (+ t_1 (/ 1.0 (+ (sqrt y) t_2)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 400000.0) {
tmp = ((1.0 + t_2) - (sqrt(x) + sqrt(y))) + (t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (t_1 + (1.0 / (sqrt(y) + t_2)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + y))
if (z <= 400000.0d0) then
tmp = ((1.0d0 + t_2) - (sqrt(x) + sqrt(y))) + (t_1 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + (t_1 + (1.0d0 / (sqrt(y) + t_2)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 400000.0) {
tmp = ((1.0 + t_2) - (Math.sqrt(x) + Math.sqrt(y))) + (t_1 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (t_1 + (1.0 / (Math.sqrt(y) + t_2)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 400000.0: tmp = ((1.0 + t_2) - (math.sqrt(x) + math.sqrt(y))) + (t_1 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + (t_1 + (1.0 / (math.sqrt(y) + t_2))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 400000.0) tmp = Float64(Float64(Float64(1.0 + t_2) - Float64(sqrt(x) + sqrt(y))) + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(t_1 + Float64(1.0 / Float64(sqrt(y) + t_2)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 400000.0)
tmp = ((1.0 + t_2) - (sqrt(x) + sqrt(y))) + (t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (t_1 + (1.0 / (sqrt(y) + t_2)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 400000.0], N[(N[(N[(1.0 + t$95$2), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 400000:\\
\;\;\;\;\left(\left(1 + t\_2\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) + \left(t\_1 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(t\_1 + \frac{1}{\sqrt{y} + t\_2}\right)\\
\end{array}
\end{array}
if z < 4e5Initial program 96.6%
associate-+l+96.6%
associate-+l-79.4%
associate-+l-96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
flip--96.7%
add-sqr-sqrt76.3%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified97.7%
Taylor expanded in x around 0 41.6%
if 4e5 < z Initial program 91.0%
associate-+l+91.0%
associate-+l+91.0%
+-commutative91.0%
+-commutative91.0%
associate-+l-90.6%
+-commutative90.6%
+-commutative90.6%
Simplified90.6%
flip--90.8%
add-sqr-sqrt73.7%
add-sqr-sqrt91.1%
Applied egg-rr91.1%
associate--l+93.7%
+-inverses93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in t around inf 50.4%
Final simplification45.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))) (t_2 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= x 3.35e-164)
(+
(+ t_2 (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ 1.0 (- t_1 (+ (sqrt x) (sqrt y)))))
(if (<= x 115000000.0)
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (+ t_2 (/ 1.0 (+ (sqrt y) t_1))))
(+
(* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y))))
(+ t_2 (* 0.5 (sqrt (/ 1.0 t)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (x <= 3.35e-164) {
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (t_1 - (sqrt(x) + sqrt(y))));
} else if (x <= 115000000.0) {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (t_2 + (1.0 / (sqrt(y) + t_1)));
} else {
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_2 + (0.5 * sqrt((1.0 / t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
if (x <= 3.35d-164) then
tmp = (t_2 + (sqrt((1.0d0 + t)) - sqrt(t))) + (1.0d0 + (t_1 - (sqrt(x) + sqrt(y))))
else if (x <= 115000000.0d0) then
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + (t_2 + (1.0d0 / (sqrt(y) + t_1)))
else
tmp = (0.5d0 * (sqrt((1.0d0 / x)) + sqrt((1.0d0 / y)))) + (t_2 + (0.5d0 * sqrt((1.0d0 / t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (x <= 3.35e-164) {
tmp = (t_2 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (1.0 + (t_1 - (Math.sqrt(x) + Math.sqrt(y))));
} else if (x <= 115000000.0) {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (t_2 + (1.0 / (Math.sqrt(y) + t_1)));
} else {
tmp = (0.5 * (Math.sqrt((1.0 / x)) + Math.sqrt((1.0 / y)))) + (t_2 + (0.5 * Math.sqrt((1.0 / t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if x <= 3.35e-164: tmp = (t_2 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (1.0 + (t_1 - (math.sqrt(x) + math.sqrt(y)))) elif x <= 115000000.0: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + (t_2 + (1.0 / (math.sqrt(y) + t_1))) else: tmp = (0.5 * (math.sqrt((1.0 / x)) + math.sqrt((1.0 / y)))) + (t_2 + (0.5 * math.sqrt((1.0 / t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (x <= 3.35e-164) tmp = Float64(Float64(t_2 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(1.0 + Float64(t_1 - Float64(sqrt(x) + sqrt(y))))); elseif (x <= 115000000.0) tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(t_2 + Float64(1.0 / Float64(sqrt(y) + t_1)))); else tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))) + Float64(t_2 + Float64(0.5 * sqrt(Float64(1.0 / t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (x <= 3.35e-164)
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (t_1 - (sqrt(x) + sqrt(y))));
elseif (x <= 115000000.0)
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (t_2 + (1.0 / (sqrt(y) + t_1)));
else
tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_2 + (0.5 * sqrt((1.0 / t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3.35e-164], N[(N[(t$95$2 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 115000000.0], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(0.5 * N[Sqrt[N[(1.0 / t), $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 + y}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;x \leq 3.35 \cdot 10^{-164}:\\
\;\;\;\;\left(t\_2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;x \leq 115000000:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(t\_2 + \frac{1}{\sqrt{y} + t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right) + \left(t\_2 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\end{array}
\end{array}
if x < 3.35e-164Initial program 97.3%
associate-+l+97.3%
associate-+l-97.3%
associate-+l-97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in x around 0 56.8%
associate--l+97.3%
Simplified97.3%
if 3.35e-164 < x < 1.15e8Initial program 95.3%
associate-+l+95.3%
associate-+l+95.3%
+-commutative95.3%
+-commutative95.3%
associate-+l-76.2%
+-commutative76.2%
+-commutative76.2%
Simplified76.2%
flip--76.4%
add-sqr-sqrt61.8%
add-sqr-sqrt76.4%
Applied egg-rr76.4%
associate--l+78.0%
+-inverses78.0%
metadata-eval78.0%
Simplified78.0%
Taylor expanded in t around inf 62.3%
if 1.15e8 < x Initial program 91.4%
associate-+l+91.4%
associate-+l-55.1%
associate-+l-91.4%
+-commutative91.4%
+-commutative91.4%
+-commutative91.4%
Simplified91.4%
Taylor expanded in y around inf 50.7%
Taylor expanded in x around inf 52.5%
distribute-lft-out52.5%
Simplified52.5%
Taylor expanded in t around inf 22.8%
Final simplification52.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 z))))
(if (<= t 7.2e+14)
(-
(+ 2.0 (+ t_1 (sqrt (+ 1.0 t))))
(+ (sqrt t) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (- t_1 (sqrt z)) (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 7.2e+14) {
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(t) + (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 7.2d+14) then
tmp = (2.0d0 + (t_1 + sqrt((1.0d0 + t)))) - (sqrt(t) + (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 7.2e+14) {
tmp = (2.0 + (t_1 + Math.sqrt((1.0 + t)))) - (Math.sqrt(t) + (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((t_1 - Math.sqrt(z)) + (1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 7.2e+14: tmp = (2.0 + (t_1 + math.sqrt((1.0 + t)))) - (math.sqrt(t) + (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((t_1 - math.sqrt(z)) + (1.0 / (math.sqrt(y) + math.sqrt((1.0 + y))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 7.2e+14) tmp = Float64(Float64(2.0 + Float64(t_1 + sqrt(Float64(1.0 + t)))) - Float64(sqrt(t) + Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(t_1 - sqrt(z)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 7.2e+14)
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(t) + (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 7.2e+14], N[(N[(2.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 7.2 \cdot 10^{+14}:\\
\;\;\;\;\left(2 + \left(t\_1 + \sqrt{1 + t}\right)\right) - \left(\sqrt{t} + \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(t\_1 - \sqrt{z}\right) + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right)\\
\end{array}
\end{array}
if t < 7.2e14Initial program 96.3%
associate-+l+96.3%
associate-+l-82.5%
associate-+l-96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in y around 0 15.5%
associate-+r+15.5%
+-commutative15.5%
Simplified15.5%
Taylor expanded in x around 0 13.4%
if 7.2e14 < t Initial program 91.2%
associate-+l+91.2%
associate-+l+91.2%
+-commutative91.2%
+-commutative91.2%
associate-+l-50.7%
+-commutative50.7%
+-commutative50.7%
Simplified50.7%
flip--50.8%
add-sqr-sqrt44.0%
add-sqr-sqrt51.2%
Applied egg-rr51.2%
associate--l+53.7%
+-inverses53.7%
metadata-eval53.7%
Simplified53.7%
Taylor expanded in t around inf 93.9%
Final simplification50.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= t 7.2e+14)
(-
(+ 2.0 (+ t_1 (sqrt (+ 1.0 t))))
(+ (sqrt t) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (- t_1 (sqrt z)) (- (sqrt (+ 1.0 y)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 7.2e+14) {
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(t) + (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 7.2d+14) then
tmp = (2.0d0 + (t_1 + sqrt((1.0d0 + t)))) - (sqrt(t) + (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (sqrt((1.0d0 + y)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 7.2e+14) {
tmp = (2.0 + (t_1 + Math.sqrt((1.0 + t)))) - (Math.sqrt(t) + (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((t_1 - Math.sqrt(z)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 7.2e+14: tmp = (2.0 + (t_1 + math.sqrt((1.0 + t)))) - (math.sqrt(t) + (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((t_1 - math.sqrt(z)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 7.2e+14) tmp = Float64(Float64(2.0 + Float64(t_1 + sqrt(Float64(1.0 + t)))) - Float64(sqrt(t) + Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(t_1 - sqrt(z)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 7.2e+14)
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - (sqrt(t) + (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 7.2e+14], N[(N[(2.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 7.2 \cdot 10^{+14}:\\
\;\;\;\;\left(2 + \left(t\_1 + \sqrt{1 + t}\right)\right) - \left(\sqrt{t} + \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(t\_1 - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 7.2e14Initial program 96.3%
associate-+l+96.3%
associate-+l-82.5%
associate-+l-96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in y around 0 15.5%
associate-+r+15.5%
+-commutative15.5%
Simplified15.5%
Taylor expanded in x around 0 13.4%
if 7.2e14 < t Initial program 91.2%
associate-+l+91.2%
associate-+l+91.2%
+-commutative91.2%
+-commutative91.2%
associate-+l-50.7%
+-commutative50.7%
+-commutative50.7%
Simplified50.7%
Taylor expanded in t around inf 91.2%
Final simplification49.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt x) (sqrt y))))
(if (<= z 7400000.0)
(+ 2.0 (- (hypot 1.0 (sqrt z)) (+ (sqrt z) t_1)))
(+
(sqrt (+ x 1.0))
(- (+ (sqrt (+ 1.0 y)) (* 0.5 (sqrt (/ 1.0 z)))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (z <= 7400000.0) {
tmp = 2.0 + (hypot(1.0, sqrt(z)) - (sqrt(z) + t_1));
} else {
tmp = sqrt((x + 1.0)) + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - t_1);
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (z <= 7400000.0) {
tmp = 2.0 + (Math.hypot(1.0, Math.sqrt(z)) - (Math.sqrt(z) + t_1));
} else {
tmp = Math.sqrt((x + 1.0)) + ((Math.sqrt((1.0 + y)) + (0.5 * Math.sqrt((1.0 / z)))) - t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if z <= 7400000.0: tmp = 2.0 + (math.hypot(1.0, math.sqrt(z)) - (math.sqrt(z) + t_1)) else: tmp = math.sqrt((x + 1.0)) + ((math.sqrt((1.0 + y)) + (0.5 * math.sqrt((1.0 / z)))) - t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (z <= 7400000.0) tmp = Float64(2.0 + Float64(hypot(1.0, sqrt(z)) - Float64(sqrt(z) + t_1))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - 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) + sqrt(y);
tmp = 0.0;
if (z <= 7400000.0)
tmp = 2.0 + (hypot(1.0, sqrt(z)) - (sqrt(z) + t_1));
else
tmp = sqrt((x + 1.0)) + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - 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[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 7400000.0], N[(2.0 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[z], $MachinePrecision] ^ 2], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $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{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 7400000:\\
\;\;\;\;2 + \left(\mathsf{hypot}\left(1, \sqrt{z}\right) - \left(\sqrt{z} + t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - t\_1\right)\\
\end{array}
\end{array}
if z < 7.4e6Initial program 96.5%
associate-+l+96.5%
associate-+l-79.5%
associate-+l-96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in t around inf 19.5%
associate--l+23.4%
Simplified23.4%
Taylor expanded in y around 0 17.6%
associate--l+26.6%
+-commutative26.6%
+-commutative26.6%
Simplified26.6%
Taylor expanded in x around 0 15.6%
associate--l+15.6%
metadata-eval15.6%
rem-square-sqrt15.6%
hypot-undefine15.6%
associate-+r+15.6%
Simplified15.6%
if 7.4e6 < z Initial program 91.0%
associate-+l+91.0%
associate-+l-74.1%
associate-+l-91.0%
+-commutative91.0%
+-commutative91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in t around inf 3.3%
associate--l+22.3%
Simplified22.3%
Taylor expanded in z around inf 35.1%
Final simplification24.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 x) (sqrt y))))
(if (<= z 5.8e+14)
(+ 2.0 (- (hypot 1.0 (sqrt z)) (+ (sqrt z) t_1)))
(+ (- (sqrt (+ 1.0 y)) t_1) (sqrt (+ x 1.0))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (z <= 5.8e+14) {
tmp = 2.0 + (hypot(1.0, sqrt(z)) - (sqrt(z) + t_1));
} else {
tmp = (sqrt((1.0 + y)) - t_1) + sqrt((x + 1.0));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (z <= 5.8e+14) {
tmp = 2.0 + (Math.hypot(1.0, Math.sqrt(z)) - (Math.sqrt(z) + t_1));
} else {
tmp = (Math.sqrt((1.0 + y)) - t_1) + Math.sqrt((x + 1.0));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if z <= 5.8e+14: tmp = 2.0 + (math.hypot(1.0, math.sqrt(z)) - (math.sqrt(z) + t_1)) else: tmp = (math.sqrt((1.0 + y)) - t_1) + math.sqrt((x + 1.0)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (z <= 5.8e+14) tmp = Float64(2.0 + Float64(hypot(1.0, sqrt(z)) - Float64(sqrt(z) + t_1))); else tmp = Float64(Float64(sqrt(Float64(1.0 + y)) - t_1) + sqrt(Float64(x + 1.0))); 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) + sqrt(y);
tmp = 0.0;
if (z <= 5.8e+14)
tmp = 2.0 + (hypot(1.0, sqrt(z)) - (sqrt(z) + t_1));
else
tmp = (sqrt((1.0 + y)) - t_1) + sqrt((x + 1.0));
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[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 5.8e+14], N[(2.0 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[z], $MachinePrecision] ^ 2], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 5.8 \cdot 10^{+14}:\\
\;\;\;\;2 + \left(\mathsf{hypot}\left(1, \sqrt{z}\right) - \left(\sqrt{z} + t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + y} - t\_1\right) + \sqrt{x + 1}\\
\end{array}
\end{array}
if z < 5.8e14Initial program 96.2%
associate-+l+96.2%
associate-+l-79.4%
associate-+l-96.2%
+-commutative96.2%
+-commutative96.2%
+-commutative96.2%
Simplified96.2%
Taylor expanded in t around inf 19.2%
associate--l+23.2%
Simplified23.2%
Taylor expanded in y around 0 17.3%
associate--l+26.2%
+-commutative26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in x around 0 15.4%
associate--l+15.4%
metadata-eval15.4%
rem-square-sqrt15.4%
hypot-undefine15.4%
associate-+r+15.4%
Simplified15.4%
if 5.8e14 < z Initial program 91.3%
associate-+l+91.3%
associate-+l-74.1%
associate-+l-91.3%
+-commutative91.3%
+-commutative91.3%
+-commutative91.3%
Simplified91.3%
Taylor expanded in t around inf 3.3%
associate--l+22.6%
Simplified22.6%
Taylor expanded in z around inf 23.4%
associate--l+35.6%
Simplified35.6%
Final simplification24.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 x) (sqrt y))))
(if (<= z 5.8e+14)
(+ 2.0 (+ (sqrt (+ 1.0 z)) (* z (- (* t_1 (/ -1.0 z)) (sqrt (/ 1.0 z))))))
(+ (- (sqrt (+ 1.0 y)) t_1) (sqrt (+ x 1.0))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (z <= 5.8e+14) {
tmp = 2.0 + (sqrt((1.0 + z)) + (z * ((t_1 * (-1.0 / z)) - sqrt((1.0 / z)))));
} else {
tmp = (sqrt((1.0 + y)) - t_1) + sqrt((x + 1.0));
}
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) + sqrt(y)
if (z <= 5.8d+14) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) + (z * ((t_1 * ((-1.0d0) / z)) - sqrt((1.0d0 / z)))))
else
tmp = (sqrt((1.0d0 + y)) - t_1) + sqrt((x + 1.0d0))
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) + Math.sqrt(y);
double tmp;
if (z <= 5.8e+14) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) + (z * ((t_1 * (-1.0 / z)) - Math.sqrt((1.0 / z)))));
} else {
tmp = (Math.sqrt((1.0 + y)) - t_1) + Math.sqrt((x + 1.0));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if z <= 5.8e+14: tmp = 2.0 + (math.sqrt((1.0 + z)) + (z * ((t_1 * (-1.0 / z)) - math.sqrt((1.0 / z))))) else: tmp = (math.sqrt((1.0 + y)) - t_1) + math.sqrt((x + 1.0)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (z <= 5.8e+14) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) + Float64(z * Float64(Float64(t_1 * Float64(-1.0 / z)) - sqrt(Float64(1.0 / z)))))); else tmp = Float64(Float64(sqrt(Float64(1.0 + y)) - t_1) + sqrt(Float64(x + 1.0))); 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) + sqrt(y);
tmp = 0.0;
if (z <= 5.8e+14)
tmp = 2.0 + (sqrt((1.0 + z)) + (z * ((t_1 * (-1.0 / z)) - sqrt((1.0 / z)))));
else
tmp = (sqrt((1.0 + y)) - t_1) + sqrt((x + 1.0));
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[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 5.8e+14], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(z * N[(N[(t$95$1 * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 5.8 \cdot 10^{+14}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} + z \cdot \left(t\_1 \cdot \frac{-1}{z} - \sqrt{\frac{1}{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + y} - t\_1\right) + \sqrt{x + 1}\\
\end{array}
\end{array}
if z < 5.8e14Initial program 96.2%
associate-+l+96.2%
associate-+l-79.4%
associate-+l-96.2%
+-commutative96.2%
+-commutative96.2%
+-commutative96.2%
Simplified96.2%
Taylor expanded in t around inf 19.2%
associate--l+23.2%
Simplified23.2%
Taylor expanded in y around 0 17.3%
associate--l+26.2%
+-commutative26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in x around 0 15.4%
associate--l+15.4%
associate-+r+15.4%
Simplified15.4%
Taylor expanded in z around inf 15.3%
distribute-rgt-out15.3%
+-commutative15.3%
Simplified15.3%
if 5.8e14 < z Initial program 91.3%
associate-+l+91.3%
associate-+l-74.1%
associate-+l-91.3%
+-commutative91.3%
+-commutative91.3%
+-commutative91.3%
Simplified91.3%
Taylor expanded in t around inf 3.3%
associate--l+22.6%
Simplified22.6%
Taylor expanded in z around inf 23.4%
associate--l+35.6%
Simplified35.6%
Final simplification24.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 x) (sqrt y))))
(if (<= z 5.8e+14)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) t_1)))
(+ (- (sqrt (+ 1.0 y)) t_1) (sqrt (+ x 1.0))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (z <= 5.8e+14) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
} else {
tmp = (sqrt((1.0 + y)) - t_1) + sqrt((x + 1.0));
}
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) + sqrt(y)
if (z <= 5.8d+14) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + t_1))
else
tmp = (sqrt((1.0d0 + y)) - t_1) + sqrt((x + 1.0d0))
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) + Math.sqrt(y);
double tmp;
if (z <= 5.8e+14) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + t_1));
} else {
tmp = (Math.sqrt((1.0 + y)) - t_1) + Math.sqrt((x + 1.0));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if z <= 5.8e+14: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + t_1)) else: tmp = (math.sqrt((1.0 + y)) - t_1) + math.sqrt((x + 1.0)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (z <= 5.8e+14) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + t_1))); else tmp = Float64(Float64(sqrt(Float64(1.0 + y)) - t_1) + sqrt(Float64(x + 1.0))); 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) + sqrt(y);
tmp = 0.0;
if (z <= 5.8e+14)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
else
tmp = (sqrt((1.0 + y)) - t_1) + sqrt((x + 1.0));
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[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 5.8e+14], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 5.8 \cdot 10^{+14}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + y} - t\_1\right) + \sqrt{x + 1}\\
\end{array}
\end{array}
if z < 5.8e14Initial program 96.2%
associate-+l+96.2%
associate-+l-79.4%
associate-+l-96.2%
+-commutative96.2%
+-commutative96.2%
+-commutative96.2%
Simplified96.2%
Taylor expanded in t around inf 19.2%
associate--l+23.2%
Simplified23.2%
Taylor expanded in y around 0 17.3%
associate--l+26.2%
+-commutative26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in x around 0 15.4%
associate--l+15.4%
associate-+r+15.4%
Simplified15.4%
if 5.8e14 < z Initial program 91.3%
associate-+l+91.3%
associate-+l-74.1%
associate-+l-91.3%
+-commutative91.3%
+-commutative91.3%
+-commutative91.3%
Simplified91.3%
Taylor expanded in t around inf 3.3%
associate--l+22.6%
Simplified22.6%
Taylor expanded in z around inf 23.4%
associate--l+35.6%
Simplified35.6%
Final simplification24.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 3.0) (+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) (+ (sqrt x) (sqrt y))))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.0) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(x) + sqrt(y))));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3.0d0) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + (sqrt(x) + sqrt(y))))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.0) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y))));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3.0: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y)))) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 3.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y))))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 3.0)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(x) + sqrt(y))));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 3.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 3Initial program 97.5%
associate-+l+97.5%
associate-+l-62.9%
associate-+l-97.5%
+-commutative97.5%
+-commutative97.5%
+-commutative97.5%
Simplified97.5%
Taylor expanded in t around inf 20.5%
associate--l+24.9%
Simplified24.9%
Taylor expanded in y around 0 20.0%
associate--l+38.3%
+-commutative38.3%
+-commutative38.3%
Simplified38.3%
Taylor expanded in x around 0 17.9%
associate--l+35.9%
associate-+r+35.9%
Simplified35.9%
if 3 < y Initial program 90.7%
associate-+l+90.7%
associate-+l-90.2%
associate-+l-90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in t around inf 3.9%
associate--l+21.0%
Simplified21.0%
Taylor expanded in x around inf 20.2%
neg-mul-120.2%
Simplified20.2%
Final simplification27.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 1.45) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.45) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.45d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.45) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.45: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.45) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.45)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.45], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.45:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.44999999999999996Initial program 97.5%
associate-+l+97.5%
associate-+l-62.9%
associate-+l-97.5%
+-commutative97.5%
+-commutative97.5%
+-commutative97.5%
Simplified97.5%
Taylor expanded in t around inf 20.5%
associate--l+24.9%
Simplified24.9%
Taylor expanded in y around 0 20.0%
associate--l+38.3%
+-commutative38.3%
+-commutative38.3%
Simplified38.3%
Taylor expanded in x around 0 17.9%
associate--l+35.9%
associate-+r+35.9%
Simplified35.9%
Taylor expanded in z around inf 53.7%
if 1.44999999999999996 < y Initial program 90.7%
associate-+l+90.7%
associate-+l-90.2%
associate-+l-90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in t around inf 3.9%
associate--l+21.0%
Simplified21.0%
Taylor expanded in x around inf 20.2%
neg-mul-120.2%
Simplified20.2%
Final simplification36.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 (<= y 1.0) (- 2.0 (+ (sqrt x) (sqrt y))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.0) {
tmp = 2.0 - (sqrt(x) + sqrt(y));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.0d0) then
tmp = 2.0d0 - (sqrt(x) + sqrt(y))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.0) {
tmp = 2.0 - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.0: tmp = 2.0 - (math.sqrt(x) + math.sqrt(y)) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.0) tmp = Float64(2.0 - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.0)
tmp = 2.0 - (sqrt(x) + sqrt(y));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.0], N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;2 - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 1Initial program 97.5%
associate-+l+97.5%
associate-+l-62.9%
associate-+l-97.5%
+-commutative97.5%
+-commutative97.5%
+-commutative97.5%
Simplified97.5%
Taylor expanded in t around inf 20.5%
associate--l+24.9%
Simplified24.9%
Taylor expanded in y around 0 20.0%
associate--l+38.3%
+-commutative38.3%
+-commutative38.3%
Simplified38.3%
Taylor expanded in x around 0 17.9%
associate--l+35.9%
associate-+r+35.9%
Simplified35.9%
Taylor expanded in z around inf 21.9%
+-commutative21.9%
Simplified21.9%
if 1 < y Initial program 90.7%
associate-+l+90.7%
associate-+l-90.2%
associate-+l-90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in t around inf 3.9%
associate--l+21.0%
Simplified21.0%
Taylor expanded in x around inf 20.2%
neg-mul-120.2%
Simplified20.2%
Final simplification21.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 0.25) (- 2.0 (+ (sqrt x) (sqrt y))) (+ 1.0 (* y (sqrt (/ 1.0 y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.25) {
tmp = 2.0 - (sqrt(x) + sqrt(y));
} else {
tmp = 1.0 + (y * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 0.25d0) then
tmp = 2.0d0 - (sqrt(x) + sqrt(y))
else
tmp = 1.0d0 + (y * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.25) {
tmp = 2.0 - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = 1.0 + (y * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.25: tmp = 2.0 - (math.sqrt(x) + math.sqrt(y)) else: tmp = 1.0 + (y * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.25) tmp = Float64(2.0 - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(1.0 + Float64(y * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 0.25)
tmp = 2.0 - (sqrt(x) + sqrt(y));
else
tmp = 1.0 + (y * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 0.25], N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.25:\\
\;\;\;\;2 - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 0.25Initial program 97.5%
associate-+l+97.5%
associate-+l-62.9%
associate-+l-97.5%
+-commutative97.5%
+-commutative97.5%
+-commutative97.5%
Simplified97.5%
Taylor expanded in t around inf 20.5%
associate--l+24.9%
Simplified24.9%
Taylor expanded in y around 0 20.0%
associate--l+38.3%
+-commutative38.3%
+-commutative38.3%
Simplified38.3%
Taylor expanded in x around 0 17.9%
associate--l+35.9%
associate-+r+35.9%
Simplified35.9%
Taylor expanded in z around inf 21.9%
+-commutative21.9%
Simplified21.9%
if 0.25 < y Initial program 90.7%
associate-+l+90.7%
associate-+l-90.2%
associate-+l-90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in t around inf 3.9%
associate--l+21.0%
Simplified21.0%
Taylor expanded in y around 0 1.9%
associate--l+22.4%
+-commutative22.4%
+-commutative22.4%
Simplified22.4%
Taylor expanded in y around inf 22.4%
distribute-lft-out21.7%
+-commutative21.7%
associate-*r/18.1%
*-rgt-identity18.1%
*-commutative18.1%
Simplified18.1%
Taylor expanded in y around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt6.9%
distribute-lft-neg-in6.9%
metadata-eval6.9%
*-lft-identity6.9%
Simplified6.9%
Final simplification14.1%
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 (* y (sqrt (/ 1.0 y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (y * 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 + (y * 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 + (y * Math.sqrt((1.0 / y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (y * math.sqrt((1.0 / y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(y * 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 + (y * 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[(y * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + y \cdot \sqrt{\frac{1}{y}}
\end{array}
Initial program 94.0%
associate-+l+94.0%
associate-+l-77.0%
associate-+l-94.0%
+-commutative94.0%
+-commutative94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in t around inf 11.9%
associate--l+22.9%
Simplified22.9%
Taylor expanded in y around 0 10.7%
associate--l+30.1%
+-commutative30.1%
+-commutative30.1%
Simplified30.1%
Taylor expanded in y around inf 27.8%
distribute-lft-out27.1%
+-commutative27.1%
associate-*r/24.5%
*-rgt-identity24.5%
*-commutative24.5%
Simplified24.5%
Taylor expanded in y around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt16.1%
distribute-lft-neg-in16.1%
metadata-eval16.1%
*-lft-identity16.1%
Simplified16.1%
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 y) -1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (sqrt(y) - -1.0);
}
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(y) - (-1.0d0))
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(y) - -1.0);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - (math.sqrt(y) - -1.0)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(sqrt(y) - -1.0)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (sqrt(y) - -1.0);
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[y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \left(\sqrt{y} - -1\right)
\end{array}
Initial program 94.0%
associate-+l+94.0%
associate-+l-77.0%
associate-+l-94.0%
+-commutative94.0%
+-commutative94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in y around 0 10.0%
associate-+r+10.0%
+-commutative10.0%
Simplified10.0%
Taylor expanded in y around inf 1.6%
mul-1-neg1.6%
Simplified1.6%
expm1-log1p-u0.9%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log2.1%
unsub-neg2.1%
metadata-eval2.1%
Simplified2.1%
associate-+l-2.1%
Applied egg-rr2.1%
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 (- 1.0 (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -1.0 + (1.0 - 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) + (1.0d0 - 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 + (1.0 - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -1.0 + (1.0 - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-1.0 + Float64(1.0 - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -1.0 + (1.0 - 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[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-1 + \left(1 - \sqrt{y}\right)
\end{array}
Initial program 94.0%
associate-+l+94.0%
associate-+l-77.0%
associate-+l-94.0%
+-commutative94.0%
+-commutative94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in y around 0 10.0%
associate-+r+10.0%
+-commutative10.0%
Simplified10.0%
Taylor expanded in y around inf 1.6%
mul-1-neg1.6%
Simplified1.6%
expm1-log1p-u0.9%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log2.1%
unsub-neg2.1%
metadata-eval2.1%
Simplified2.1%
Final simplification2.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 94.0%
associate-+l+94.0%
associate-+l-77.0%
associate-+l-94.0%
+-commutative94.0%
+-commutative94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in t around inf 11.9%
associate--l+22.9%
Simplified22.9%
Taylor expanded in y around 0 10.7%
associate--l+30.1%
+-commutative30.1%
+-commutative30.1%
Simplified30.1%
Taylor expanded in x around 0 9.4%
associate--l+21.1%
associate-+r+21.1%
Simplified21.1%
Taylor expanded in x around inf 1.6%
mul-1-neg1.6%
Simplified1.6%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024147
(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))))