
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(- (sqrt (+ 1.0 t)) (sqrt t))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + (sqrt((1.0 + t)) - sqrt(t));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + (sqrt((1.0d0 + t)) - sqrt(t))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + (math.sqrt((1.0 + t)) - math.sqrt(t))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + (sqrt((1.0 + t)) - sqrt(t));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)
\end{array}
Initial program 90.9%
+-commutative90.9%
flip--90.8%
add-sqr-sqrt77.2%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate--l+93.5%
+-inverses93.5%
metadata-eval93.5%
Simplified93.5%
flip--93.4%
add-sqr-sqrt78.1%
+-commutative78.1%
add-sqr-sqrt93.8%
+-commutative93.8%
Applied egg-rr93.8%
associate--l+96.3%
+-inverses96.3%
metadata-eval96.3%
Simplified96.3%
flip--96.4%
add-sqr-sqrt72.5%
+-commutative72.5%
add-sqr-sqrt96.4%
+-commutative96.4%
Applied egg-rr96.4%
associate--l+97.3%
+-inverses97.3%
metadata-eval97.3%
Simplified97.3%
Final simplification97.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (sqrt (+ 1.0 y)))
(t_4 (+ (- t_2 (sqrt x)) (- t_3 (sqrt y)))))
(if (<= t_4 1.012)
(+
t_1
(+
(+ (/ 1.0 (+ t_2 (sqrt x))) (/ 1.0 (+ t_3 (sqrt y))))
(/ 1.0 (+ (sqrt z) (+ 1.0 (* z 0.5))))))
(+ t_1 (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) t_4)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((1.0 + y));
double t_4 = (t_2 - sqrt(x)) + (t_3 - sqrt(y));
double tmp;
if (t_4 <= 1.012) {
tmp = t_1 + (((1.0 / (t_2 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (1.0 / (sqrt(z) + (1.0 + (z * 0.5)))));
} else {
tmp = t_1 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + t_4);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((1.0d0 + y))
t_4 = (t_2 - sqrt(x)) + (t_3 - sqrt(y))
if (t_4 <= 1.012d0) then
tmp = t_1 + (((1.0d0 / (t_2 + sqrt(x))) + (1.0d0 / (t_3 + sqrt(y)))) + (1.0d0 / (sqrt(z) + (1.0d0 + (z * 0.5d0)))))
else
tmp = t_1 + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + t_4)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((1.0 + y));
double t_4 = (t_2 - Math.sqrt(x)) + (t_3 - Math.sqrt(y));
double tmp;
if (t_4 <= 1.012) {
tmp = t_1 + (((1.0 / (t_2 + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y)))) + (1.0 / (Math.sqrt(z) + (1.0 + (z * 0.5)))));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + t_4);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((1.0 + y)) t_4 = (t_2 - math.sqrt(x)) + (t_3 - math.sqrt(y)) tmp = 0 if t_4 <= 1.012: tmp = t_1 + (((1.0 / (t_2 + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) + (1.0 / (math.sqrt(z) + (1.0 + (z * 0.5))))) else: tmp = t_1 + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + t_4) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + x)) t_3 = sqrt(Float64(1.0 + y)) t_4 = Float64(Float64(t_2 - sqrt(x)) + Float64(t_3 - sqrt(y))) tmp = 0.0 if (t_4 <= 1.012) tmp = Float64(t_1 + Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + Float64(1.0 / Float64(t_3 + sqrt(y)))) + Float64(1.0 / Float64(sqrt(z) + Float64(1.0 + Float64(z * 0.5)))))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + t_4)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
t_2 = sqrt((1.0 + x));
t_3 = sqrt((1.0 + y));
t_4 = (t_2 - sqrt(x)) + (t_3 - sqrt(y));
tmp = 0.0;
if (t_4 <= 1.012)
tmp = t_1 + (((1.0 / (t_2 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (1.0 / (sqrt(z) + (1.0 + (z * 0.5)))));
else
tmp = t_1 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + t_4);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, 1.012], N[(t$95$1 + N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[(1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{1 + y}\\
t_4 := \left(t_2 - \sqrt{x}\right) + \left(t_3 - \sqrt{y}\right)\\
\mathbf{if}\;t_4 \leq 1.012:\\
\;\;\;\;t_1 + \left(\left(\frac{1}{t_2 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right) + \frac{1}{\sqrt{z} + \left(1 + z \cdot 0.5\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + t_4\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 1.012Initial program 87.5%
+-commutative87.5%
flip--87.4%
add-sqr-sqrt67.7%
add-sqr-sqrt88.0%
Applied egg-rr88.0%
associate--l+91.2%
+-inverses91.2%
metadata-eval91.2%
Simplified91.2%
flip--91.2%
add-sqr-sqrt69.1%
+-commutative69.1%
add-sqr-sqrt91.7%
+-commutative91.7%
Applied egg-rr91.7%
associate--l+95.3%
+-inverses95.3%
metadata-eval95.3%
Simplified95.3%
flip--95.3%
add-sqr-sqrt72.6%
+-commutative72.6%
add-sqr-sqrt95.3%
+-commutative95.3%
Applied egg-rr95.3%
associate--l+96.4%
+-inverses96.4%
metadata-eval96.4%
Simplified96.4%
Taylor expanded in z around 0 93.5%
*-commutative93.5%
Simplified93.5%
if 1.012 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 98.6%
flip--98.8%
add-sqr-sqrt72.3%
+-commutative72.3%
add-sqr-sqrt98.8%
+-commutative98.8%
Applied egg-rr98.7%
associate--l+99.3%
+-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Final simplification95.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (sqrt (+ 1.0 y)))
(t_4 (/ 1.0 (+ t_3 (sqrt y)))))
(if (<= (+ (- t_2 (sqrt x)) (- t_3 (sqrt y))) 1.0)
(+
t_1
(+
(+ (/ 1.0 (+ t_2 (sqrt x))) t_4)
(/ 1.0 (+ (sqrt z) (+ 1.0 (* z 0.5))))))
(+ t_1 (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) (+ 1.0 t_4))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((1.0 + y));
double t_4 = 1.0 / (t_3 + sqrt(y));
double tmp;
if (((t_2 - sqrt(x)) + (t_3 - sqrt(y))) <= 1.0) {
tmp = t_1 + (((1.0 / (t_2 + sqrt(x))) + t_4) + (1.0 / (sqrt(z) + (1.0 + (z * 0.5)))));
} else {
tmp = t_1 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 + t_4));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((1.0d0 + y))
t_4 = 1.0d0 / (t_3 + sqrt(y))
if (((t_2 - sqrt(x)) + (t_3 - sqrt(y))) <= 1.0d0) then
tmp = t_1 + (((1.0d0 / (t_2 + sqrt(x))) + t_4) + (1.0d0 / (sqrt(z) + (1.0d0 + (z * 0.5d0)))))
else
tmp = t_1 + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (1.0d0 + t_4))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((1.0 + y));
double t_4 = 1.0 / (t_3 + Math.sqrt(y));
double tmp;
if (((t_2 - Math.sqrt(x)) + (t_3 - Math.sqrt(y))) <= 1.0) {
tmp = t_1 + (((1.0 / (t_2 + Math.sqrt(x))) + t_4) + (1.0 / (Math.sqrt(z) + (1.0 + (z * 0.5)))));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (1.0 + t_4));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((1.0 + y)) t_4 = 1.0 / (t_3 + math.sqrt(y)) tmp = 0 if ((t_2 - math.sqrt(x)) + (t_3 - math.sqrt(y))) <= 1.0: tmp = t_1 + (((1.0 / (t_2 + math.sqrt(x))) + t_4) + (1.0 / (math.sqrt(z) + (1.0 + (z * 0.5))))) else: tmp = t_1 + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (1.0 + t_4)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + x)) t_3 = sqrt(Float64(1.0 + y)) t_4 = Float64(1.0 / Float64(t_3 + sqrt(y))) tmp = 0.0 if (Float64(Float64(t_2 - sqrt(x)) + Float64(t_3 - sqrt(y))) <= 1.0) tmp = Float64(t_1 + Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + t_4) + Float64(1.0 / Float64(sqrt(z) + Float64(1.0 + Float64(z * 0.5)))))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(1.0 + t_4))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
t_2 = sqrt((1.0 + x));
t_3 = sqrt((1.0 + y));
t_4 = 1.0 / (t_3 + sqrt(y));
tmp = 0.0;
if (((t_2 - sqrt(x)) + (t_3 - sqrt(y))) <= 1.0)
tmp = t_1 + (((1.0 / (t_2 + sqrt(x))) + t_4) + (1.0 / (sqrt(z) + (1.0 + (z * 0.5)))));
else
tmp = t_1 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 + t_4));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0], N[(t$95$1 + N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[(1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + t$95$4), $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{1 + x}\\
t_3 := \sqrt{1 + y}\\
t_4 := \frac{1}{t_3 + \sqrt{y}}\\
\mathbf{if}\;\left(t_2 - \sqrt{x}\right) + \left(t_3 - \sqrt{y}\right) \leq 1:\\
\;\;\;\;t_1 + \left(\left(\frac{1}{t_2 + \sqrt{x}} + t_4\right) + \frac{1}{\sqrt{z} + \left(1 + z \cdot 0.5\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(1 + t_4\right)\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 1Initial program 87.6%
+-commutative87.6%
flip--87.6%
add-sqr-sqrt67.3%
add-sqr-sqrt87.8%
Applied egg-rr87.8%
associate--l+91.1%
+-inverses91.1%
metadata-eval91.1%
Simplified91.1%
flip--91.0%
add-sqr-sqrt68.3%
+-commutative68.3%
add-sqr-sqrt91.5%
+-commutative91.5%
Applied egg-rr91.5%
associate--l+95.2%
+-inverses95.2%
metadata-eval95.2%
Simplified95.2%
flip--95.2%
add-sqr-sqrt72.4%
+-commutative72.4%
add-sqr-sqrt95.2%
+-commutative95.2%
Applied egg-rr95.2%
associate--l+96.3%
+-inverses96.3%
metadata-eval96.3%
Simplified96.3%
Taylor expanded in z around 0 93.8%
*-commutative93.8%
Simplified93.8%
if 1 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 97.6%
+-commutative97.6%
flip--97.5%
add-sqr-sqrt97.7%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
associate--l+98.5%
+-inverses98.5%
metadata-eval98.5%
Simplified98.5%
flip--98.4%
add-sqr-sqrt98.7%
+-commutative98.7%
add-sqr-sqrt98.7%
+-commutative98.7%
Applied egg-rr98.7%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.7%
flip--98.8%
add-sqr-sqrt72.7%
+-commutative72.7%
add-sqr-sqrt98.8%
+-commutative98.8%
Applied egg-rr98.8%
associate--l+99.3%
+-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 94.8%
Final simplification94.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- t_2 (sqrt x)))
(t_4 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(if (<= t_3 5e-8)
(+
t_1
(+
(+ (/ 1.0 (+ t_2 (sqrt x))) t_4)
(/ 1.0 (+ (sqrt z) (+ 1.0 (* z 0.5))))))
(+ t_1 (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) (+ t_4 t_3))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + x));
double t_3 = t_2 - sqrt(x);
double t_4 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
double tmp;
if (t_3 <= 5e-8) {
tmp = t_1 + (((1.0 / (t_2 + sqrt(x))) + t_4) + (1.0 / (sqrt(z) + (1.0 + (z * 0.5)))));
} else {
tmp = t_1 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (t_4 + t_3));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + x))
t_3 = t_2 - sqrt(x)
t_4 = 1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))
if (t_3 <= 5d-8) then
tmp = t_1 + (((1.0d0 / (t_2 + sqrt(x))) + t_4) + (1.0d0 / (sqrt(z) + (1.0d0 + (z * 0.5d0)))))
else
tmp = t_1 + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (t_4 + t_3))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + x));
double t_3 = t_2 - Math.sqrt(x);
double t_4 = 1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y));
double tmp;
if (t_3 <= 5e-8) {
tmp = t_1 + (((1.0 / (t_2 + Math.sqrt(x))) + t_4) + (1.0 / (Math.sqrt(z) + (1.0 + (z * 0.5)))));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (t_4 + t_3));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + x)) t_3 = t_2 - math.sqrt(x) t_4 = 1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)) tmp = 0 if t_3 <= 5e-8: tmp = t_1 + (((1.0 / (t_2 + math.sqrt(x))) + t_4) + (1.0 / (math.sqrt(z) + (1.0 + (z * 0.5))))) else: tmp = t_1 + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (t_4 + t_3)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(t_2 - sqrt(x)) t_4 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) tmp = 0.0 if (t_3 <= 5e-8) tmp = Float64(t_1 + Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + t_4) + Float64(1.0 / Float64(sqrt(z) + Float64(1.0 + Float64(z * 0.5)))))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(t_4 + t_3))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
t_2 = sqrt((1.0 + x));
t_3 = t_2 - sqrt(x);
t_4 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
tmp = 0.0;
if (t_3 <= 5e-8)
tmp = t_1 + (((1.0 / (t_2 + sqrt(x))) + t_4) + (1.0 / (sqrt(z) + (1.0 + (z * 0.5)))));
else
tmp = t_1 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (t_4 + t_3));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 5e-8], N[(t$95$1 + N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[(1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + t$95$3), $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{1 + x}\\
t_3 := t_2 - \sqrt{x}\\
t_4 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\mathbf{if}\;t_3 \leq 5 \cdot 10^{-8}:\\
\;\;\;\;t_1 + \left(\left(\frac{1}{t_2 + \sqrt{x}} + t_4\right) + \frac{1}{\sqrt{z} + \left(1 + z \cdot 0.5\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(t_4 + t_3\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 4.9999999999999998e-8Initial program 84.1%
+-commutative84.1%
flip--84.0%
add-sqr-sqrt71.9%
add-sqr-sqrt84.2%
Applied egg-rr84.2%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
Simplified88.3%
flip--88.3%
add-sqr-sqrt52.8%
+-commutative52.8%
add-sqr-sqrt88.3%
+-commutative88.3%
Applied egg-rr88.3%
associate--l+93.9%
+-inverses93.9%
metadata-eval93.9%
Simplified93.9%
flip--94.0%
add-sqr-sqrt70.9%
+-commutative70.9%
add-sqr-sqrt94.0%
+-commutative94.0%
Applied egg-rr94.0%
associate--l+95.7%
+-inverses95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in z around 0 93.0%
*-commutative93.0%
Simplified93.0%
if 4.9999999999999998e-8 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.2%
flip--98.3%
add-sqr-sqrt73.8%
+-commutative73.8%
add-sqr-sqrt98.3%
+-commutative98.3%
Applied egg-rr96.3%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
Simplified96.6%
+-commutative96.2%
flip--96.2%
add-sqr-sqrt81.3%
add-sqr-sqrt96.8%
Applied egg-rr97.2%
associate--l+97.6%
+-inverses97.6%
metadata-eval97.6%
Simplified98.0%
Final simplification95.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_3 (sqrt (+ 1.0 z))))
(if (<= (- t_1 (sqrt x)) 1.0)
(+
t_2
(+
(+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ (sqrt y) (+ 1.0 (* y 0.5)))))
(- t_3 (sqrt z))))
(+
t_2
(+
(/ 1.0 (+ t_3 (sqrt z)))
(+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + t)) - sqrt(t);
double t_3 = sqrt((1.0 + z));
double tmp;
if ((t_1 - sqrt(x)) <= 1.0) {
tmp = t_2 + (((1.0 / (t_1 + sqrt(x))) + (1.0 / (sqrt(y) + (1.0 + (y * 0.5))))) + (t_3 - sqrt(z)));
} else {
tmp = t_2 + ((1.0 / (t_3 + sqrt(z))) + (1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
t_3 = sqrt((1.0d0 + z))
if ((t_1 - sqrt(x)) <= 1.0d0) then
tmp = t_2 + (((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (sqrt(y) + (1.0d0 + (y * 0.5d0))))) + (t_3 - sqrt(z)))
else
tmp = t_2 + ((1.0d0 / (t_3 + sqrt(z))) + (1.0d0 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_3 = Math.sqrt((1.0 + z));
double tmp;
if ((t_1 - Math.sqrt(x)) <= 1.0) {
tmp = t_2 + (((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (Math.sqrt(y) + (1.0 + (y * 0.5))))) + (t_3 - Math.sqrt(z)));
} else {
tmp = t_2 + ((1.0 / (t_3 + Math.sqrt(z))) + (1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + t)) - math.sqrt(t) t_3 = math.sqrt((1.0 + z)) tmp = 0 if (t_1 - math.sqrt(x)) <= 1.0: tmp = t_2 + (((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (math.sqrt(y) + (1.0 + (y * 0.5))))) + (t_3 - math.sqrt(z))) else: tmp = t_2 + ((1.0 / (t_3 + math.sqrt(z))) + (1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_3 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(t_1 - sqrt(x)) <= 1.0) tmp = Float64(t_2 + Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(sqrt(y) + Float64(1.0 + Float64(y * 0.5))))) + Float64(t_3 - sqrt(z)))); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(t_3 + sqrt(z))) + Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + t)) - sqrt(t);
t_3 = sqrt((1.0 + z));
tmp = 0.0;
if ((t_1 - sqrt(x)) <= 1.0)
tmp = t_2 + (((1.0 / (t_1 + sqrt(x))) + (1.0 / (sqrt(y) + (1.0 + (y * 0.5))))) + (t_3 - sqrt(z)));
else
tmp = t_2 + ((1.0 / (t_3 + sqrt(z))) + (1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1.0], N[(t$95$2 + N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(1.0 / N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + t} - \sqrt{t}\\
t_3 := \sqrt{1 + z}\\
\mathbf{if}\;t_1 - \sqrt{x} \leq 1:\\
\;\;\;\;t_2 + \left(\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{\sqrt{y} + \left(1 + y \cdot 0.5\right)}\right) + \left(t_3 - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(\frac{1}{t_3 + \sqrt{z}} + \left(1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 1Initial program 90.9%
+-commutative90.9%
flip--90.8%
add-sqr-sqrt77.2%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate--l+93.5%
+-inverses93.5%
metadata-eval93.5%
Simplified93.5%
flip--93.4%
add-sqr-sqrt78.1%
+-commutative78.1%
add-sqr-sqrt93.8%
+-commutative93.8%
Applied egg-rr93.8%
associate--l+96.3%
+-inverses96.3%
metadata-eval96.3%
Simplified96.3%
Taylor expanded in y around 0 90.8%
*-commutative90.8%
Simplified90.8%
if 1 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 90.9%
+-commutative90.9%
flip--90.8%
add-sqr-sqrt77.2%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate--l+93.5%
+-inverses93.5%
metadata-eval93.5%
Simplified93.5%
flip--93.4%
add-sqr-sqrt78.1%
+-commutative78.1%
add-sqr-sqrt93.8%
+-commutative93.8%
Applied egg-rr93.8%
associate--l+96.3%
+-inverses96.3%
metadata-eval96.3%
Simplified96.3%
flip--96.4%
add-sqr-sqrt72.5%
+-commutative72.5%
add-sqr-sqrt96.4%
+-commutative96.4%
Applied egg-rr96.4%
associate--l+97.3%
+-inverses97.3%
metadata-eval97.3%
Simplified97.3%
Taylor expanded in x around 0 59.5%
Final simplification90.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 5.7e+29)
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))
(+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.7e+29) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 5.7d+29) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (1.0d0 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.7e+29) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5.7e+29: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5.7e+29) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 5.7e+29)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 5.7e+29], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.7 \cdot 10^{+29}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5.6999999999999999e29Initial program 95.3%
+-commutative95.3%
flip--95.3%
add-sqr-sqrt94.4%
add-sqr-sqrt96.0%
Applied egg-rr96.0%
associate--l+97.0%
+-inverses97.0%
metadata-eval97.0%
Simplified97.0%
flip--97.0%
add-sqr-sqrt84.0%
+-commutative84.0%
add-sqr-sqrt97.2%
+-commutative97.2%
Applied egg-rr97.2%
associate--l+98.9%
+-inverses98.9%
metadata-eval98.9%
Simplified98.9%
flip--99.1%
add-sqr-sqrt72.1%
+-commutative72.1%
add-sqr-sqrt99.1%
+-commutative99.1%
Applied egg-rr99.1%
associate--l+99.3%
+-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 63.6%
if 5.6999999999999999e29 < y Initial program 84.4%
+-commutative84.4%
associate-+r+84.4%
associate-+r-43.8%
associate-+l-20.2%
associate-+r-4.1%
Simplified3.7%
Taylor expanded in t around inf 3.2%
associate--l+20.5%
+-commutative20.5%
associate--l+25.6%
+-commutative25.6%
Simplified25.6%
Taylor expanded in z around inf 20.3%
Taylor expanded in y around inf 19.9%
flip--19.9%
add-sqr-sqrt20.4%
add-sqr-sqrt19.9%
Applied egg-rr19.9%
associate--l+24.6%
+-inverses24.6%
metadata-eval24.6%
Simplified24.6%
Final simplification47.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 5.7e+29)
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+
(+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
(- (sqrt (+ 1.0 z)) (sqrt z))))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.7e+29) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (sqrt((1.0 + z)) - sqrt(z)));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 5.7d+29) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + ((1.0d0 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + (sqrt((1.0d0 + z)) - sqrt(z)))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.7e+29) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5.7e+29: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + ((1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + (math.sqrt((1.0 + z)) - math.sqrt(z))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5.7e+29) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 5.7e+29)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + ((1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (sqrt((1.0 + z)) - sqrt(z)));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 5.7e+29], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.7 \cdot 10^{+29}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5.6999999999999999e29Initial program 95.3%
+-commutative95.3%
flip--95.3%
add-sqr-sqrt94.4%
add-sqr-sqrt96.0%
Applied egg-rr96.0%
associate--l+97.0%
+-inverses97.0%
metadata-eval97.0%
Simplified97.0%
flip--97.0%
add-sqr-sqrt84.0%
+-commutative84.0%
add-sqr-sqrt97.2%
+-commutative97.2%
Applied egg-rr97.2%
associate--l+98.9%
+-inverses98.9%
metadata-eval98.9%
Simplified98.9%
Taylor expanded in x around 0 63.3%
if 5.6999999999999999e29 < y Initial program 84.4%
+-commutative84.4%
associate-+r+84.4%
associate-+r-43.8%
associate-+l-20.2%
associate-+r-4.1%
Simplified3.7%
Taylor expanded in t around inf 3.2%
associate--l+20.5%
+-commutative20.5%
associate--l+25.6%
+-commutative25.6%
Simplified25.6%
Taylor expanded in z around inf 20.3%
Taylor expanded in y around inf 19.9%
flip--19.9%
add-sqr-sqrt20.4%
add-sqr-sqrt19.9%
Applied egg-rr19.9%
associate--l+24.6%
+-inverses24.6%
metadata-eval24.6%
Simplified24.6%
Final simplification47.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))) (t_2 (sqrt (+ 1.0 x))))
(if (<= y 1.05e-85)
(+ 2.0 (+ (/ 1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))) t_1))
(if (<= y 2.7e+17)
(+ (- t_2 (sqrt x)) (+ t_1 (- (sqrt (+ 1.0 y)) (sqrt y))))
(/ 1.0 (+ t_2 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + x));
double tmp;
if (y <= 1.05e-85) {
tmp = 2.0 + ((1.0 / (sqrt(t) + sqrt((1.0 + t)))) + t_1);
} else if (y <= 2.7e+17) {
tmp = (t_2 - sqrt(x)) + (t_1 + (sqrt((1.0 + y)) - sqrt(y)));
} else {
tmp = 1.0 / (t_2 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + x))
if (y <= 1.05d-85) then
tmp = 2.0d0 + ((1.0d0 / (sqrt(t) + sqrt((1.0d0 + t)))) + t_1)
else if (y <= 2.7d+17) then
tmp = (t_2 - sqrt(x)) + (t_1 + (sqrt((1.0d0 + y)) - sqrt(y)))
else
tmp = 1.0d0 / (t_2 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.05e-85) {
tmp = 2.0 + ((1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t)))) + t_1);
} else if (y <= 2.7e+17) {
tmp = (t_2 - Math.sqrt(x)) + (t_1 + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
} else {
tmp = 1.0 / (t_2 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.05e-85: tmp = 2.0 + ((1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))) + t_1) elif y <= 2.7e+17: tmp = (t_2 - math.sqrt(x)) + (t_1 + (math.sqrt((1.0 + y)) - math.sqrt(y))) else: tmp = 1.0 / (t_2 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.05e-85) tmp = Float64(2.0 + Float64(Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t)))) + t_1)); elseif (y <= 2.7e+17) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); else tmp = Float64(1.0 / Float64(t_2 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.05e-85)
tmp = 2.0 + ((1.0 / (sqrt(t) + sqrt((1.0 + t)))) + t_1);
elseif (y <= 2.7e+17)
tmp = (t_2 - sqrt(x)) + (t_1 + (sqrt((1.0 + y)) - sqrt(y)));
else
tmp = 1.0 / (t_2 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.05e-85], N[(2.0 + N[(N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.7e+17], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.05 \cdot 10^{-85}:\\
\;\;\;\;2 + \left(\frac{1}{\sqrt{t} + \sqrt{1 + t}} + t_1\right)\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+17}:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(t_1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_2 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.05e-85Initial program 97.4%
+-commutative97.4%
associate-+r+97.4%
associate-+r-97.4%
associate-+l-97.4%
associate-+r-97.4%
Simplified50.1%
Taylor expanded in x around 0 35.4%
flip--35.4%
add-sqr-sqrt28.7%
add-sqr-sqrt35.4%
Applied egg-rr35.4%
associate--l+36.5%
+-inverses36.5%
metadata-eval36.5%
Simplified36.5%
Taylor expanded in y around 0 31.7%
associate--l+63.2%
+-commutative63.2%
+-commutative63.2%
associate--l+62.4%
+-commutative62.4%
Simplified62.4%
if 1.05e-85 < y < 2.7e17Initial program 94.0%
associate-+l+94.0%
associate-+l+94.0%
+-commutative94.0%
+-commutative94.0%
associate-+l-78.1%
+-commutative78.1%
+-commutative78.1%
Simplified78.1%
Taylor expanded in t around inf 57.1%
if 2.7e17 < y Initial program 83.9%
+-commutative83.9%
associate-+r+83.9%
associate-+r-46.2%
associate-+l-23.8%
associate-+r-8.7%
Simplified6.5%
Taylor expanded in t around inf 4.1%
associate--l+20.5%
+-commutative20.5%
associate--l+25.2%
+-commutative25.2%
Simplified25.2%
Taylor expanded in z around inf 19.7%
Taylor expanded in y around inf 19.4%
flip--19.4%
add-sqr-sqrt19.9%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
Simplified23.8%
Final simplification44.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 1.32e-21)
(+
2.0
(+ (/ 1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))) (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 4.5e+15)
(+ t_1 (- (hypot 1.0 (sqrt y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 1.32e-21) {
tmp = 2.0 + ((1.0 / (sqrt(t) + sqrt((1.0 + t)))) + (sqrt((1.0 + z)) - sqrt(z)));
} else if (y <= 4.5e+15) {
tmp = t_1 + (hypot(1.0, sqrt(y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
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((1.0 + x));
double tmp;
if (y <= 1.32e-21) {
tmp = 2.0 + ((1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t)))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else if (y <= 4.5e+15) {
tmp = t_1 + (Math.hypot(1.0, Math.sqrt(y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.32e-21: tmp = 2.0 + ((1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))) + (math.sqrt((1.0 + z)) - math.sqrt(z))) elif y <= 4.5e+15: tmp = t_1 + (math.hypot(1.0, math.sqrt(y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.32e-21) tmp = Float64(2.0 + Float64(Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t)))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); elseif (y <= 4.5e+15) tmp = Float64(t_1 + Float64(hypot(1.0, sqrt(y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.32e-21)
tmp = 2.0 + ((1.0 / (sqrt(t) + sqrt((1.0 + t)))) + (sqrt((1.0 + z)) - sqrt(z)));
elseif (y <= 4.5e+15)
tmp = t_1 + (hypot(1.0, sqrt(y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.32e-21], N[(2.0 + N[(N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+15], N[(t$95$1 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.32 \cdot 10^{-21}:\\
\;\;\;\;2 + \left(\frac{1}{\sqrt{t} + \sqrt{1 + t}} + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\
\;\;\;\;t_1 + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.32e-21Initial program 97.5%
+-commutative97.5%
associate-+r+97.5%
associate-+r-97.6%
associate-+l-97.6%
associate-+r-97.6%
Simplified51.3%
Taylor expanded in x around 0 37.5%
flip--37.5%
add-sqr-sqrt28.9%
add-sqr-sqrt37.5%
Applied egg-rr37.5%
associate--l+38.4%
+-inverses38.4%
metadata-eval38.4%
Simplified38.4%
Taylor expanded in y around 0 33.9%
associate--l+65.3%
+-commutative65.3%
+-commutative65.3%
associate--l+64.3%
+-commutative64.3%
Simplified64.3%
if 1.32e-21 < y < 4.5e15Initial program 89.6%
+-commutative89.6%
associate-+r+89.6%
associate-+r-89.4%
associate-+l-89.8%
associate-+r-89.6%
Simplified50.6%
Taylor expanded in t around inf 11.4%
associate--l+18.8%
+-commutative18.8%
associate--l+18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in z around inf 27.3%
add-sqr-sqrt27.3%
hypot-1-def27.3%
Applied egg-rr27.3%
if 4.5e15 < y Initial program 83.9%
+-commutative83.9%
associate-+r+83.9%
associate-+r-46.2%
associate-+l-23.8%
associate-+r-8.7%
Simplified6.5%
Taylor expanded in t around inf 4.1%
associate--l+20.5%
+-commutative20.5%
associate--l+25.2%
+-commutative25.2%
Simplified25.2%
Taylor expanded in z around inf 19.7%
Taylor expanded in y around inf 19.4%
flip--19.4%
add-sqr-sqrt19.9%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
Simplified23.8%
Final simplification43.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 x))))
(if (<= y 7.6e-20)
(+
2.0
(+ (/ 1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))) (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 5e+16)
(- (+ t_1 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y)))
(/ 1.0 (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 7.6e-20) {
tmp = 2.0 + ((1.0 / (sqrt(t) + sqrt((1.0 + t)))) + (sqrt((1.0 + z)) - sqrt(z)));
} else if (y <= 5e+16) {
tmp = (t_1 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 7.6d-20) then
tmp = 2.0d0 + ((1.0d0 / (sqrt(t) + sqrt((1.0d0 + t)))) + (sqrt((1.0d0 + z)) - sqrt(z)))
else if (y <= 5d+16) then
tmp = (t_1 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 7.6e-20) {
tmp = 2.0 + ((1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t)))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else if (y <= 5e+16) {
tmp = (t_1 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 7.6e-20: tmp = 2.0 + ((1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))) + (math.sqrt((1.0 + z)) - math.sqrt(z))) elif y <= 5e+16: tmp = (t_1 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 7.6e-20) tmp = Float64(2.0 + Float64(Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t)))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); elseif (y <= 5e+16) tmp = Float64(Float64(t_1 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 7.6e-20)
tmp = 2.0 + ((1.0 / (sqrt(t) + sqrt((1.0 + t)))) + (sqrt((1.0 + z)) - sqrt(z)));
elseif (y <= 5e+16)
tmp = (t_1 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 7.6e-20], N[(2.0 + N[(N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+16], N[(N[(t$95$1 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 7.6 \cdot 10^{-20}:\\
\;\;\;\;2 + \left(\frac{1}{\sqrt{t} + \sqrt{1 + t}} + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+16}:\\
\;\;\;\;\left(t_1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 7.5999999999999995e-20Initial program 97.5%
+-commutative97.5%
associate-+r+97.5%
associate-+r-97.6%
associate-+l-97.6%
associate-+r-97.6%
Simplified51.3%
Taylor expanded in x around 0 37.5%
flip--37.5%
add-sqr-sqrt28.9%
add-sqr-sqrt37.5%
Applied egg-rr37.5%
associate--l+38.4%
+-inverses38.4%
metadata-eval38.4%
Simplified38.4%
Taylor expanded in y around 0 33.9%
associate--l+65.3%
+-commutative65.3%
+-commutative65.3%
associate--l+64.3%
+-commutative64.3%
Simplified64.3%
if 7.5999999999999995e-20 < y < 5e16Initial program 89.6%
+-commutative89.6%
associate-+r+89.6%
associate-+r-89.4%
associate-+l-89.8%
associate-+r-89.6%
Simplified50.6%
Taylor expanded in t around inf 11.4%
associate--l+18.8%
+-commutative18.8%
associate--l+18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in z around inf 27.2%
+-commutative27.2%
Simplified27.2%
if 5e16 < y Initial program 83.9%
+-commutative83.9%
associate-+r+83.9%
associate-+r-46.2%
associate-+l-23.8%
associate-+r-8.7%
Simplified6.5%
Taylor expanded in t around inf 4.1%
associate--l+20.5%
+-commutative20.5%
associate--l+25.2%
+-commutative25.2%
Simplified25.2%
Taylor expanded in z around inf 19.7%
Taylor expanded in y around inf 19.4%
flip--19.4%
add-sqr-sqrt19.9%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
Simplified23.8%
Final simplification43.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 x))))
(if (<= y 2.85e-21)
(+ 2.0 (- (sqrt (+ 1.0 z)) (sqrt z)))
(if (<= y 3.2e+16)
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 2.85e-21) {
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
} else if (y <= 3.2e+16) {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 2.85d-21) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - sqrt(z))
else if (y <= 3.2d+16) then
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 2.85e-21) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
} else if (y <= 3.2e+16) {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 2.85e-21: tmp = 2.0 + (math.sqrt((1.0 + z)) - math.sqrt(z)) elif y <= 3.2e+16: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 2.85e-21) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))); elseif (y <= 3.2e+16) tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 2.85e-21)
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
elseif (y <= 3.2e+16)
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.85e-21], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+16], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 2.85 \cdot 10^{-21}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{+16}:\\
\;\;\;\;t_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.8499999999999998e-21Initial program 97.5%
+-commutative97.5%
associate-+r+97.5%
associate-+r-97.6%
associate-+l-97.6%
associate-+r-97.6%
Simplified51.3%
Taylor expanded in t around inf 23.8%
associate--l+28.5%
+-commutative28.5%
associate--l+28.5%
+-commutative28.5%
Simplified28.5%
Taylor expanded in y around 0 23.8%
+-commutative23.8%
associate--l+23.8%
+-commutative23.8%
+-commutative23.8%
associate--r+23.8%
Simplified23.8%
Taylor expanded in x around 0 29.4%
associate--l+60.7%
Simplified60.7%
if 2.8499999999999998e-21 < y < 3.2e16Initial program 89.6%
+-commutative89.6%
associate-+r+89.6%
associate-+r-89.4%
associate-+l-89.8%
associate-+r-89.6%
Simplified50.6%
Taylor expanded in t around inf 11.4%
associate--l+18.8%
+-commutative18.8%
associate--l+18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in z around inf 27.3%
if 3.2e16 < y Initial program 83.9%
+-commutative83.9%
associate-+r+83.9%
associate-+r-46.2%
associate-+l-23.8%
associate-+r-8.7%
Simplified6.5%
Taylor expanded in t around inf 4.1%
associate--l+20.5%
+-commutative20.5%
associate--l+25.2%
+-commutative25.2%
Simplified25.2%
Taylor expanded in z around inf 19.7%
Taylor expanded in y around inf 19.4%
flip--19.4%
add-sqr-sqrt19.9%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
Simplified23.8%
Final simplification41.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 2.5e-20)
(+ 2.0 (- (sqrt (+ 1.0 z)) (sqrt z)))
(if (<= y 5e+15)
(- (+ t_1 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y)))
(/ 1.0 (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 2.5e-20) {
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
} else if (y <= 5e+15) {
tmp = (t_1 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 2.5d-20) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - sqrt(z))
else if (y <= 5d+15) then
tmp = (t_1 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 2.5e-20) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
} else if (y <= 5e+15) {
tmp = (t_1 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 2.5e-20: tmp = 2.0 + (math.sqrt((1.0 + z)) - math.sqrt(z)) elif y <= 5e+15: tmp = (t_1 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 2.5e-20) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))); elseif (y <= 5e+15) tmp = Float64(Float64(t_1 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 2.5e-20)
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
elseif (y <= 5e+15)
tmp = (t_1 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.5e-20], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+15], N[(N[(t$95$1 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 2.5 \cdot 10^{-20}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+15}:\\
\;\;\;\;\left(t_1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.4999999999999999e-20Initial program 97.5%
+-commutative97.5%
associate-+r+97.5%
associate-+r-97.6%
associate-+l-97.6%
associate-+r-97.6%
Simplified51.3%
Taylor expanded in t around inf 23.8%
associate--l+28.5%
+-commutative28.5%
associate--l+28.5%
+-commutative28.5%
Simplified28.5%
Taylor expanded in y around 0 23.8%
+-commutative23.8%
associate--l+23.8%
+-commutative23.8%
+-commutative23.8%
associate--r+23.8%
Simplified23.8%
Taylor expanded in x around 0 29.4%
associate--l+60.7%
Simplified60.7%
if 2.4999999999999999e-20 < y < 5e15Initial program 89.6%
+-commutative89.6%
associate-+r+89.6%
associate-+r-89.4%
associate-+l-89.8%
associate-+r-89.6%
Simplified50.6%
Taylor expanded in t around inf 11.4%
associate--l+18.8%
+-commutative18.8%
associate--l+18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in z around inf 27.2%
+-commutative27.2%
Simplified27.2%
if 5e15 < y Initial program 83.9%
+-commutative83.9%
associate-+r+83.9%
associate-+r-46.2%
associate-+l-23.8%
associate-+r-8.7%
Simplified6.5%
Taylor expanded in t around inf 4.1%
associate--l+20.5%
+-commutative20.5%
associate--l+25.2%
+-commutative25.2%
Simplified25.2%
Taylor expanded in z around inf 19.7%
Taylor expanded in y around inf 19.4%
flip--19.4%
add-sqr-sqrt19.9%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
Simplified23.8%
Final simplification41.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 2.65e-21)
(+ 2.0 (- (sqrt (+ 1.0 z)) (sqrt z)))
(if (<= y 2e+15)
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.65e-21) {
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
} else if (y <= 2e+15) {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.65d-21) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - sqrt(z))
else if (y <= 2d+15) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.65e-21) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
} else if (y <= 2e+15) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.65e-21: tmp = 2.0 + (math.sqrt((1.0 + z)) - math.sqrt(z)) elif y <= 2e+15: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.65e-21) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))); elseif (y <= 2e+15) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.65e-21)
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
elseif (y <= 2e+15)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.65e-21], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+15], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.65 \cdot 10^{-21}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.65e-21Initial program 97.5%
+-commutative97.5%
associate-+r+97.5%
associate-+r-97.6%
associate-+l-97.6%
associate-+r-97.6%
Simplified51.3%
Taylor expanded in t around inf 23.8%
associate--l+28.5%
+-commutative28.5%
associate--l+28.5%
+-commutative28.5%
Simplified28.5%
Taylor expanded in y around 0 23.8%
+-commutative23.8%
associate--l+23.8%
+-commutative23.8%
+-commutative23.8%
associate--r+23.8%
Simplified23.8%
Taylor expanded in x around 0 29.4%
associate--l+60.7%
Simplified60.7%
if 2.65e-21 < y < 2e15Initial program 89.6%
+-commutative89.6%
associate-+r+89.6%
associate-+r-89.4%
associate-+l-89.8%
associate-+r-89.6%
Simplified50.6%
Taylor expanded in t around inf 11.4%
associate--l+18.8%
+-commutative18.8%
associate--l+18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in z around inf 27.3%
Taylor expanded in x around 0 34.9%
associate--l+34.9%
Simplified34.9%
if 2e15 < y Initial program 83.9%
+-commutative83.9%
associate-+r+83.9%
associate-+r-46.2%
associate-+l-23.8%
associate-+r-8.7%
Simplified6.5%
Taylor expanded in t around inf 4.1%
associate--l+20.5%
+-commutative20.5%
associate--l+25.2%
+-commutative25.2%
Simplified25.2%
Taylor expanded in z around inf 19.7%
Taylor expanded in y around inf 19.4%
flip--19.4%
add-sqr-sqrt19.9%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
Simplified23.8%
Final simplification42.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 6800000000000.0) (+ 2.0 (- (sqrt (+ 1.0 z)) (sqrt z))) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6800000000000.0) {
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 6800000000000.0d0) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - sqrt(z))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6800000000000.0) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 6800000000000.0: tmp = 2.0 + (math.sqrt((1.0 + z)) - math.sqrt(z)) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 6800000000000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 6800000000000.0)
tmp = 2.0 + (sqrt((1.0 + z)) - sqrt(z));
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 6800000000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6800000000000:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 6.8e12Initial program 95.9%
+-commutative95.9%
associate-+r+95.9%
associate-+r-78.7%
associate-+l-70.9%
associate-+r-56.7%
Simplified56.7%
Taylor expanded in t around inf 24.7%
associate--l+28.5%
+-commutative28.5%
associate--l+37.0%
+-commutative37.0%
Simplified37.0%
Taylor expanded in y around 0 37.7%
+-commutative37.7%
associate--l+37.7%
+-commutative37.7%
+-commutative37.7%
associate--r+37.7%
Simplified37.7%
Taylor expanded in x around 0 44.4%
associate--l+44.4%
Simplified44.4%
if 6.8e12 < z Initial program 86.3%
+-commutative86.3%
associate-+r+86.3%
associate-+r-70.1%
associate-+l-58.4%
associate-+r-58.4%
Simplified8.8%
Taylor expanded in t around inf 4.4%
associate--l+20.2%
+-commutative20.2%
associate--l+16.6%
+-commutative16.6%
Simplified16.6%
Taylor expanded in z around inf 33.4%
Taylor expanded in x around 0 37.3%
associate--l+56.9%
Simplified56.9%
Final simplification51.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \sqrt{y}\right)
\end{array}
Initial program 90.9%
+-commutative90.9%
associate-+r+90.9%
associate-+r-74.2%
associate-+l-64.3%
associate-+r-57.6%
Simplified31.5%
Taylor expanded in t around inf 14.0%
associate--l+24.2%
+-commutative24.2%
associate--l+26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in z around inf 24.1%
Taylor expanded in x around 0 29.4%
associate--l+46.1%
Simplified46.1%
Final simplification46.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 (+ 1.0 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + x)) - 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((1.0d0 + x)) - 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((1.0 + x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + x)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + x} - \sqrt{x}
\end{array}
Initial program 90.9%
+-commutative90.9%
associate-+r+90.9%
associate-+r-74.2%
associate-+l-64.3%
associate-+r-57.6%
Simplified31.5%
Taylor expanded in t around inf 14.0%
associate--l+24.2%
+-commutative24.2%
associate--l+26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in z around inf 24.1%
Taylor expanded in y around inf 15.3%
Final simplification15.3%
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)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 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
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 90.9%
+-commutative90.9%
associate-+r+90.9%
associate-+r-74.2%
associate-+l-64.3%
associate-+r-57.6%
Simplified31.5%
Taylor expanded in t around inf 14.0%
associate--l+24.2%
+-commutative24.2%
associate--l+26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in z around inf 24.1%
Taylor expanded in y around inf 15.3%
Taylor expanded in x around 0 34.3%
Final simplification34.3%
(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 2023334
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:herbie-target
(+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))