
(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 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 t)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- (sqrt (+ z 1.0)) (sqrt z)))
(t_4 (+ (sqrt y) (sqrt (+ 1.0 y)))))
(if (<= t_3 5e-5)
(+
(/ 1.0 (/ (* (+ (sqrt x) t_2) t_4) (+ (sqrt x) (+ t_2 t_4))))
(+ (* 0.5 (sqrt (/ 1.0 z))) (- t_1 (sqrt t))))
(+
(+ 2.0 (- (* y (+ 0.5 (* y -0.125))) (sqrt y)))
(+ t_3 (/ 1.0 (+ t_1 (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t));
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((z + 1.0)) - sqrt(z);
double t_4 = sqrt(y) + sqrt((1.0 + y));
double tmp;
if (t_3 <= 5e-5) {
tmp = (1.0 / (((sqrt(x) + t_2) * t_4) / (sqrt(x) + (t_2 + t_4)))) + ((0.5 * sqrt((1.0 / z))) + (t_1 - sqrt(t)));
} else {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + (t_3 + (1.0 / (t_1 + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + t))
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((z + 1.0d0)) - sqrt(z)
t_4 = sqrt(y) + sqrt((1.0d0 + y))
if (t_3 <= 5d-5) then
tmp = (1.0d0 / (((sqrt(x) + t_2) * t_4) / (sqrt(x) + (t_2 + t_4)))) + ((0.5d0 * sqrt((1.0d0 / z))) + (t_1 - sqrt(t)))
else
tmp = (2.0d0 + ((y * (0.5d0 + (y * (-0.125d0)))) - sqrt(y))) + (t_3 + (1.0d0 / (t_1 + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((z + 1.0)) - Math.sqrt(z);
double t_4 = Math.sqrt(y) + Math.sqrt((1.0 + y));
double tmp;
if (t_3 <= 5e-5) {
tmp = (1.0 / (((Math.sqrt(x) + t_2) * t_4) / (Math.sqrt(x) + (t_2 + t_4)))) + ((0.5 * Math.sqrt((1.0 / z))) + (t_1 - Math.sqrt(t)));
} else {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - Math.sqrt(y))) + (t_3 + (1.0 / (t_1 + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((z + 1.0)) - math.sqrt(z) t_4 = math.sqrt(y) + math.sqrt((1.0 + y)) tmp = 0 if t_3 <= 5e-5: tmp = (1.0 / (((math.sqrt(x) + t_2) * t_4) / (math.sqrt(x) + (t_2 + t_4)))) + ((0.5 * math.sqrt((1.0 / z))) + (t_1 - math.sqrt(t))) else: tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - math.sqrt(y))) + (t_3 + (1.0 / (t_1 + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + t)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) t_4 = Float64(sqrt(y) + sqrt(Float64(1.0 + y))) tmp = 0.0 if (t_3 <= 5e-5) tmp = Float64(Float64(1.0 / Float64(Float64(Float64(sqrt(x) + t_2) * t_4) / Float64(sqrt(x) + Float64(t_2 + t_4)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_1 - sqrt(t)))); else tmp = Float64(Float64(2.0 + Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) - sqrt(y))) + Float64(t_3 + Float64(1.0 / Float64(t_1 + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t));
t_2 = sqrt((1.0 + x));
t_3 = sqrt((z + 1.0)) - sqrt(z);
t_4 = sqrt(y) + sqrt((1.0 + y));
tmp = 0.0;
if (t_3 <= 5e-5)
tmp = (1.0 / (((sqrt(x) + t_2) * t_4) / (sqrt(x) + (t_2 + t_4)))) + ((0.5 * sqrt((1.0 / z))) + (t_1 - sqrt(t)));
else
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + (t_3 + (1.0 / (t_1 + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 5e-5], N[(N[(1.0 / N[(N[(N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision] * t$95$4), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[(t$95$2 + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(t$95$1 + N[Sqrt[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 + t}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{z + 1} - \sqrt{z}\\
t_4 := \sqrt{y} + \sqrt{1 + y}\\
\mathbf{if}\;t\_3 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\frac{\left(\sqrt{x} + t\_2\right) \cdot t\_4}{\sqrt{x} + \left(t\_2 + t\_4\right)}} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_1 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(2 + \left(y \cdot \left(0.5 + y \cdot -0.125\right) - \sqrt{y}\right)\right) + \left(t\_3 + \frac{1}{t\_1 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) < 5.00000000000000024e-5Initial program 86.0%
associate-+l+86.0%
sub-neg86.0%
sub-neg86.0%
+-commutative86.0%
+-commutative86.0%
+-commutative86.0%
Simplified86.0%
flip--86.0%
flip--86.0%
frac-add86.1%
Applied egg-rr86.5%
+-commutative86.5%
*-commutative86.5%
*-commutative86.5%
fma-define86.5%
associate--l+90.0%
+-commutative90.0%
+-commutative90.0%
associate--l+90.0%
*-commutative90.0%
Simplified90.0%
expm1-log1p-u88.3%
expm1-undefine88.3%
associate-+r-88.3%
+-commutative88.3%
Applied egg-rr88.3%
expm1-define88.3%
+-commutative88.3%
associate--l+90.9%
Simplified90.9%
clear-num90.9%
inv-pow90.9%
Applied egg-rr92.8%
unpow-192.8%
associate-+l+92.8%
Simplified92.8%
Taylor expanded in z around inf 96.6%
if 5.00000000000000024e-5 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) Initial program 95.6%
associate-+l+95.6%
sub-neg95.6%
sub-neg95.6%
+-commutative95.6%
+-commutative95.6%
+-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 45.8%
Taylor expanded in y around 0 28.4%
associate--l+28.4%
*-commutative28.4%
Simplified28.4%
Taylor expanded in y around inf 31.3%
flip--32.0%
div-inv32.0%
add-sqr-sqrt25.4%
add-sqr-sqrt32.0%
Applied egg-rr32.0%
associate-*r/32.0%
*-rgt-identity32.0%
associate--l+32.2%
+-inverses32.2%
metadata-eval32.2%
Simplified32.2%
Final simplification66.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 (+ z 1.0)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (+ (- t_2 (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y))))
(t_4 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_3 1.0000001)
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_2)))
(+ t_4 (- t_1 (sqrt z))))
(+ (+ t_4 (/ 1.0 (+ (sqrt z) t_1))) t_3))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double t_2 = sqrt((1.0 + x));
double t_3 = (t_2 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
double t_4 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_3 <= 1.0000001) {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))) + (t_4 + (t_1 - sqrt(z)));
} else {
tmp = (t_4 + (1.0 / (sqrt(z) + t_1))) + 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((z + 1.0d0))
t_2 = sqrt((1.0d0 + x))
t_3 = (t_2 - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y))
t_4 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_3 <= 1.0000001d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_2))) + (t_4 + (t_1 - sqrt(z)))
else
tmp = (t_4 + (1.0d0 / (sqrt(z) + t_1))) + 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((z + 1.0));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = (t_2 - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
double t_4 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_3 <= 1.0000001) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_2))) + (t_4 + (t_1 - Math.sqrt(z)));
} else {
tmp = (t_4 + (1.0 / (Math.sqrt(z) + t_1))) + t_3;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) t_2 = math.sqrt((1.0 + x)) t_3 = (t_2 - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y)) t_4 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_3 <= 1.0000001: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_2))) + (t_4 + (t_1 - math.sqrt(z))) else: tmp = (t_4 + (1.0 / (math.sqrt(z) + t_1))) + t_3 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(Float64(t_2 - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) t_4 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_3 <= 1.0000001) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_2))) + Float64(t_4 + Float64(t_1 - sqrt(z)))); else tmp = Float64(Float64(t_4 + Float64(1.0 / Float64(sqrt(z) + t_1))) + 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((z + 1.0));
t_2 = sqrt((1.0 + x));
t_3 = (t_2 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y));
t_4 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_3 <= 1.0000001)
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))) + (t_4 + (t_1 - sqrt(z)));
else
tmp = (t_4 + (1.0 / (sqrt(z) + t_1))) + 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[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 1.0000001], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$4 + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1}\\
t_2 := \sqrt{1 + x}\\
t_3 := \left(t\_2 - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
t_4 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_3 \leq 1.0000001:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_2}\right) + \left(t\_4 + \left(t\_1 - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_4 + \frac{1}{\sqrt{z} + t\_1}\right) + t\_3\\
\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))) < 1.00000010000000006Initial program 88.4%
associate-+l+88.4%
sub-neg88.4%
sub-neg88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
Simplified88.4%
flip--88.7%
flip--88.7%
frac-add88.7%
Applied egg-rr89.2%
+-commutative89.2%
*-commutative89.2%
*-commutative89.2%
fma-define89.2%
associate--l+92.3%
+-commutative92.3%
+-commutative92.3%
associate--l+92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in y around inf 68.7%
if 1.00000010000000006 < (+.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 95.8%
associate-+l+95.8%
sub-neg95.8%
sub-neg95.8%
+-commutative95.8%
+-commutative95.8%
+-commutative95.8%
Simplified95.8%
flip--89.4%
div-inv89.4%
add-sqr-sqrt63.6%
add-sqr-sqrt89.3%
Applied egg-rr95.7%
associate-*r/89.3%
*-rgt-identity89.3%
associate--l+89.3%
+-inverses89.3%
metadata-eval89.3%
Simplified96.0%
Final simplification76.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 (+ z 1.0)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_4 (sqrt (+ 1.0 y))))
(if (<= (+ (- t_2 (sqrt x)) (- t_4 (sqrt y))) 1.0000001)
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_2)))
(+ t_3 (- t_1 (sqrt z))))
(+
(- (+ 1.0 t_4) (+ (sqrt x) (sqrt y)))
(+ t_3 (/ 1.0 (+ (sqrt z) t_1)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double t_4 = sqrt((1.0 + y));
double tmp;
if (((t_2 - sqrt(x)) + (t_4 - sqrt(y))) <= 1.0000001) {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))) + (t_3 + (t_1 - sqrt(z)));
} else {
tmp = ((1.0 + t_4) - (sqrt(x) + sqrt(y))) + (t_3 + (1.0 / (sqrt(z) + t_1)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
t_4 = sqrt((1.0d0 + y))
if (((t_2 - sqrt(x)) + (t_4 - sqrt(y))) <= 1.0000001d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_2))) + (t_3 + (t_1 - sqrt(z)))
else
tmp = ((1.0d0 + t_4) - (sqrt(x) + sqrt(y))) + (t_3 + (1.0d0 / (sqrt(z) + 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((z + 1.0));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_4 = Math.sqrt((1.0 + y));
double tmp;
if (((t_2 - Math.sqrt(x)) + (t_4 - Math.sqrt(y))) <= 1.0000001) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_2))) + (t_3 + (t_1 - Math.sqrt(z)));
} else {
tmp = ((1.0 + t_4) - (Math.sqrt(x) + Math.sqrt(y))) + (t_3 + (1.0 / (Math.sqrt(z) + t_1)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) t_4 = math.sqrt((1.0 + y)) tmp = 0 if ((t_2 - math.sqrt(x)) + (t_4 - math.sqrt(y))) <= 1.0000001: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_2))) + (t_3 + (t_1 - math.sqrt(z))) else: tmp = ((1.0 + t_4) - (math.sqrt(x) + math.sqrt(y))) + (t_3 + (1.0 / (math.sqrt(z) + t_1))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_4 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (Float64(Float64(t_2 - sqrt(x)) + Float64(t_4 - sqrt(y))) <= 1.0000001) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_2))) + Float64(t_3 + Float64(t_1 - sqrt(z)))); else tmp = Float64(Float64(Float64(1.0 + t_4) - Float64(sqrt(x) + sqrt(y))) + Float64(t_3 + Float64(1.0 / Float64(sqrt(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((z + 1.0));
t_2 = sqrt((1.0 + x));
t_3 = sqrt((1.0 + t)) - sqrt(t);
t_4 = sqrt((1.0 + y));
tmp = 0.0;
if (((t_2 - sqrt(x)) + (t_4 - sqrt(y))) <= 1.0000001)
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_2))) + (t_3 + (t_1 - sqrt(z)));
else
tmp = ((1.0 + t_4) - (sqrt(x) + sqrt(y))) + (t_3 + (1.0 / (sqrt(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[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0000001], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$4), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[z], $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{z + 1}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
t_4 := \sqrt{1 + y}\\
\mathbf{if}\;\left(t\_2 - \sqrt{x}\right) + \left(t\_4 - \sqrt{y}\right) \leq 1.0000001:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_2}\right) + \left(t\_3 + \left(t\_1 - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t\_4\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) + \left(t\_3 + \frac{1}{\sqrt{z} + t\_1}\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))) < 1.00000010000000006Initial program 88.4%
associate-+l+88.4%
sub-neg88.4%
sub-neg88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
Simplified88.4%
flip--88.7%
flip--88.7%
frac-add88.7%
Applied egg-rr89.2%
+-commutative89.2%
*-commutative89.2%
*-commutative89.2%
fma-define89.2%
associate--l+92.3%
+-commutative92.3%
+-commutative92.3%
associate--l+92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in y around inf 68.7%
if 1.00000010000000006 < (+.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 95.8%
associate-+l+95.8%
sub-neg95.8%
sub-neg95.8%
+-commutative95.8%
+-commutative95.8%
+-commutative95.8%
Simplified95.8%
Taylor expanded in x around 0 89.4%
flip--89.4%
div-inv89.4%
add-sqr-sqrt63.6%
add-sqr-sqrt89.3%
Applied egg-rr89.3%
associate-*r/89.3%
*-rgt-identity89.3%
associate--l+89.3%
+-inverses89.3%
metadata-eval89.3%
Simplified89.3%
Final simplification74.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 x)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (+ (sqrt y) t_2))
(t_4 (sqrt (+ z 1.0))))
(if (<= z 6.2e+24)
(+
(- (+ 1.0 t_2) (+ (sqrt x) (sqrt y)))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt z) t_4))))
(+
(/ 1.0 (/ (* (+ (sqrt x) t_1) t_3) (+ (sqrt x) (+ t_1 t_3))))
(- t_4 (sqrt z))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y));
double t_3 = sqrt(y) + t_2;
double t_4 = sqrt((z + 1.0));
double tmp;
if (z <= 6.2e+24) {
tmp = ((1.0 + t_2) - (sqrt(x) + sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt(z) + t_4)));
} else {
tmp = (1.0 / (((sqrt(x) + t_1) * t_3) / (sqrt(x) + (t_1 + t_3)))) + (t_4 - sqrt(z));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
t_3 = sqrt(y) + t_2
t_4 = sqrt((z + 1.0d0))
if (z <= 6.2d+24) then
tmp = ((1.0d0 + t_2) - (sqrt(x) + sqrt(y))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt(z) + t_4)))
else
tmp = (1.0d0 / (((sqrt(x) + t_1) * t_3) / (sqrt(x) + (t_1 + t_3)))) + (t_4 - sqrt(z))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + y));
double t_3 = Math.sqrt(y) + t_2;
double t_4 = Math.sqrt((z + 1.0));
double tmp;
if (z <= 6.2e+24) {
tmp = ((1.0 + t_2) - (Math.sqrt(x) + Math.sqrt(y))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt(z) + t_4)));
} else {
tmp = (1.0 / (((Math.sqrt(x) + t_1) * t_3) / (Math.sqrt(x) + (t_1 + t_3)))) + (t_4 - Math.sqrt(z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) t_3 = math.sqrt(y) + t_2 t_4 = math.sqrt((z + 1.0)) tmp = 0 if z <= 6.2e+24: tmp = ((1.0 + t_2) - (math.sqrt(x) + math.sqrt(y))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt(z) + t_4))) else: tmp = (1.0 / (((math.sqrt(x) + t_1) * t_3) / (math.sqrt(x) + (t_1 + t_3)))) + (t_4 - math.sqrt(z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) t_3 = Float64(sqrt(y) + t_2) t_4 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (z <= 6.2e+24) tmp = Float64(Float64(Float64(1.0 + t_2) - Float64(sqrt(x) + sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(z) + t_4)))); else tmp = Float64(Float64(1.0 / Float64(Float64(Float64(sqrt(x) + t_1) * t_3) / Float64(sqrt(x) + Float64(t_1 + t_3)))) + Float64(t_4 - sqrt(z))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + y));
t_3 = sqrt(y) + t_2;
t_4 = sqrt((z + 1.0));
tmp = 0.0;
if (z <= 6.2e+24)
tmp = ((1.0 + t_2) - (sqrt(x) + sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt(z) + t_4)));
else
tmp = (1.0 / (((sqrt(x) + t_1) * t_3) / (sqrt(x) + (t_1 + t_3)))) + (t_4 - sqrt(z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 6.2e+24], N[(N[(N[(1.0 + t$95$2), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[(N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision] * t$95$3), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[(t$95$1 + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - N[Sqrt[z], $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 + y}\\
t_3 := \sqrt{y} + t\_2\\
t_4 := \sqrt{z + 1}\\
\mathbf{if}\;z \leq 6.2 \cdot 10^{+24}:\\
\;\;\;\;\left(\left(1 + t\_2\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{z} + t\_4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\left(\sqrt{x} + t\_1\right) \cdot t\_3}{\sqrt{x} + \left(t\_1 + t\_3\right)}} + \left(t\_4 - \sqrt{z}\right)\\
\end{array}
\end{array}
if z < 6.20000000000000022e24Initial program 92.0%
associate-+l+92.0%
sub-neg92.0%
sub-neg92.0%
+-commutative92.0%
+-commutative92.0%
+-commutative92.0%
Simplified92.0%
Taylor expanded in x around 0 42.4%
flip--42.4%
div-inv42.4%
add-sqr-sqrt42.4%
add-sqr-sqrt42.9%
Applied egg-rr42.9%
associate-*r/42.9%
*-rgt-identity42.9%
associate--l+43.1%
+-inverses43.1%
metadata-eval43.1%
Simplified43.1%
if 6.20000000000000022e24 < z Initial program 88.7%
associate-+l+88.7%
sub-neg88.7%
sub-neg88.7%
+-commutative88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
flip--88.8%
flip--88.8%
frac-add88.8%
Applied egg-rr89.3%
+-commutative89.3%
*-commutative89.3%
*-commutative89.3%
fma-define89.3%
associate--l+93.2%
+-commutative93.2%
+-commutative93.2%
associate--l+93.2%
*-commutative93.2%
Simplified93.2%
expm1-log1p-u91.3%
expm1-undefine91.3%
associate-+r-91.3%
+-commutative91.3%
Applied egg-rr91.3%
expm1-define91.3%
+-commutative91.3%
associate--l+94.1%
Simplified94.1%
clear-num94.1%
inv-pow94.1%
Applied egg-rr96.2%
unpow-196.2%
associate-+l+96.2%
Simplified96.2%
Taylor expanded in t around inf 47.1%
Final simplification45.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 6.2e+15)
(+
(- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y)))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt z) (sqrt (+ z 1.0))))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.2e+15) {
tmp = ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt(z) + sqrt((z + 1.0)))));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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 <= 6.2d+15) then
tmp = ((1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt(z) + sqrt((z + 1.0d0)))))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + 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 <= 6.2e+15) {
tmp = ((1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt(z) + Math.sqrt((z + 1.0)))));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 6.2e+15: tmp = ((1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt(z) + math.sqrt((z + 1.0))))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 6.2e+15) tmp = Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(z + 1.0)))))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 <= 6.2e+15)
tmp = ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt(z) + sqrt((z + 1.0)))));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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, 6.2e+15], N[(N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.2 \cdot 10^{+15}:\\
\;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{z} + \sqrt{z + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 6.2e15Initial program 95.7%
associate-+l+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in x around 0 51.3%
flip--51.3%
div-inv51.3%
add-sqr-sqrt36.7%
add-sqr-sqrt51.3%
Applied egg-rr51.3%
associate-*r/51.3%
*-rgt-identity51.3%
associate--l+51.3%
+-inverses51.3%
metadata-eval51.3%
Simplified51.3%
if 6.2e15 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.8%
associate--l+19.1%
Simplified19.1%
Taylor expanded in x around inf 18.9%
mul-1-neg18.9%
Simplified18.9%
flip-+18.9%
add-sqr-sqrt19.5%
pow219.5%
Applied egg-rr19.5%
associate--l+21.5%
unpow221.5%
sqr-neg21.5%
rem-square-sqrt23.5%
sub-neg23.5%
remove-double-neg23.5%
+-commutative23.5%
Simplified23.5%
Final simplification37.1%
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 6.2e+15)
(+
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))
(- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.2e+15) {
tmp = ((sqrt((z + 1.0)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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 <= 6.2d+15) then
tmp = ((sqrt((z + 1.0d0)) - sqrt(z)) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t)))) + ((1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + 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 <= 6.2e+15) {
tmp = ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t)))) + ((1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 6.2e+15: tmp = ((math.sqrt((z + 1.0)) - math.sqrt(z)) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) + ((1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 6.2e+15) tmp = Float64(Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t)))) + Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 <= 6.2e+15)
tmp = ((sqrt((z + 1.0)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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, 6.2e+15], N[(N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.2 \cdot 10^{+15}:\\
\;\;\;\;\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) + \left(\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 6.2e15Initial program 95.7%
associate-+l+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in x around 0 51.3%
flip--57.9%
div-inv57.9%
add-sqr-sqrt42.8%
add-sqr-sqrt58.4%
Applied egg-rr52.4%
associate-*r/58.4%
*-rgt-identity58.4%
associate--l+58.6%
+-inverses58.6%
metadata-eval58.6%
Simplified52.6%
if 6.2e15 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.8%
associate--l+19.1%
Simplified19.1%
Taylor expanded in x around inf 18.9%
mul-1-neg18.9%
Simplified18.9%
flip-+18.9%
add-sqr-sqrt19.5%
pow219.5%
Applied egg-rr19.5%
associate--l+21.5%
unpow221.5%
sqr-neg21.5%
rem-square-sqrt23.5%
sub-neg23.5%
remove-double-neg23.5%
+-commutative23.5%
Simplified23.5%
Final simplification37.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 6.2e+15)
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ z 1.0)) (sqrt z)))
(+ (- (sqrt (+ 1.0 y)) (sqrt y)) (- 1.0 (sqrt x))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.2e+15) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((z + 1.0)) - sqrt(z))) + ((sqrt((1.0 + y)) - sqrt(y)) + (1.0 - sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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 <= 6.2d+15) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((z + 1.0d0)) - sqrt(z))) + ((sqrt((1.0d0 + y)) - sqrt(y)) + (1.0d0 - sqrt(x)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + 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 <= 6.2e+15) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + (1.0 - Math.sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 6.2e+15: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + ((math.sqrt((1.0 + y)) - math.sqrt(y)) + (1.0 - math.sqrt(x))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 6.2e+15) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + Float64(1.0 - sqrt(x)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 <= 6.2e+15)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((z + 1.0)) - sqrt(z))) + ((sqrt((1.0 + y)) - sqrt(y)) + (1.0 - sqrt(x)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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, 6.2e+15], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.2 \cdot 10^{+15}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 6.2e15Initial program 95.7%
associate-+l+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in x around 0 51.4%
if 6.2e15 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.8%
associate--l+19.1%
Simplified19.1%
Taylor expanded in x around inf 18.9%
mul-1-neg18.9%
Simplified18.9%
flip-+18.9%
add-sqr-sqrt19.5%
pow219.5%
Applied egg-rr19.5%
associate--l+21.5%
unpow221.5%
sqr-neg21.5%
rem-square-sqrt23.5%
sub-neg23.5%
remove-double-neg23.5%
+-commutative23.5%
Simplified23.5%
Final simplification37.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 3.6e-13)
(+
(+ 2.0 (- (* y (+ 0.5 (* y -0.125))) (sqrt y)))
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(if (<= y 4.5e+15)
(+
t_1
(-
(+ (sqrt (+ 1.0 y)) (* 0.5 (sqrt (/ 1.0 z))))
(+ (sqrt x) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) 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 + x));
double tmp;
if (y <= 3.6e-13) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + ((sqrt((z + 1.0)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
} else if (y <= 4.5e+15) {
tmp = t_1 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 3.6d-13) then
tmp = (2.0d0 + ((y * (0.5d0 + (y * (-0.125d0)))) - sqrt(y))) + ((sqrt((z + 1.0d0)) - sqrt(z)) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
else if (y <= 4.5d+15) then
tmp = t_1 + ((sqrt((1.0d0 + y)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + 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 + x));
double tmp;
if (y <= 3.6e-13) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - Math.sqrt(y))) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
} else if (y <= 4.5e+15) {
tmp = t_1 + ((Math.sqrt((1.0 + y)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + 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 + x)) tmp = 0 if y <= 3.6e-13: tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - math.sqrt(y))) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) elif y <= 4.5e+15: tmp = t_1 + ((math.sqrt((1.0 + y)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + 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 + x)) tmp = 0.0 if (y <= 3.6e-13) tmp = Float64(Float64(2.0 + Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) - sqrt(y))) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); elseif (y <= 4.5e+15) tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + 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 + x));
tmp = 0.0;
if (y <= 3.6e-13)
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + ((sqrt((z + 1.0)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
elseif (y <= 4.5e+15)
tmp = t_1 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + 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 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3.6e-13], N[(N[(2.0 + N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+15], N[(t$95$1 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 3.6 \cdot 10^{-13}:\\
\;\;\;\;\left(2 + \left(y \cdot \left(0.5 + y \cdot -0.125\right) - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 3.5999999999999998e-13Initial program 95.7%
associate-+l+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in x around 0 51.2%
Taylor expanded in y around 0 51.2%
associate--l+51.2%
*-commutative51.2%
Simplified51.2%
Taylor expanded in y around inf 58.8%
flip--59.5%
div-inv59.5%
add-sqr-sqrt43.7%
add-sqr-sqrt60.0%
Applied egg-rr60.0%
associate-*r/60.0%
*-rgt-identity60.0%
associate--l+60.2%
+-inverses60.2%
metadata-eval60.2%
Simplified60.2%
if 3.5999999999999998e-13 < y < 4.5e15Initial program 95.4%
associate-+l+95.4%
sub-neg95.4%
sub-neg95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in t around inf 19.2%
associate--l+25.0%
Simplified25.0%
Taylor expanded in z around inf 20.6%
if 4.5e15 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.8%
associate--l+19.1%
Simplified19.1%
Taylor expanded in x around inf 18.9%
mul-1-neg18.9%
Simplified18.9%
flip-+18.9%
add-sqr-sqrt19.5%
pow219.5%
Applied egg-rr19.5%
associate--l+21.5%
unpow221.5%
sqr-neg21.5%
rem-square-sqrt23.5%
sub-neg23.5%
remove-double-neg23.5%
+-commutative23.5%
Simplified23.5%
Final simplification40.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 x))))
(if (<= y 2.6e-13)
(+
(+ 2.0 (- (* y (+ 0.5 (* y -0.125))) (sqrt y)))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ z 1.0)) (sqrt z))))
(if (<= y 2.5e+15)
(+
t_1
(-
(+ (sqrt (+ 1.0 y)) (* 0.5 (sqrt (/ 1.0 z))))
(+ (sqrt x) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) 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 + x));
double tmp;
if (y <= 2.6e-13) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((z + 1.0)) - sqrt(z)));
} else if (y <= 2.5e+15) {
tmp = t_1 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 2.6d-13) then
tmp = (2.0d0 + ((y * (0.5d0 + (y * (-0.125d0)))) - sqrt(y))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((z + 1.0d0)) - sqrt(z)))
else if (y <= 2.5d+15) then
tmp = t_1 + ((sqrt((1.0d0 + y)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + 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 + x));
double tmp;
if (y <= 2.6e-13) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - Math.sqrt(y))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((z + 1.0)) - Math.sqrt(z)));
} else if (y <= 2.5e+15) {
tmp = t_1 + ((Math.sqrt((1.0 + y)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + 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 + x)) tmp = 0 if y <= 2.6e-13: tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - math.sqrt(y))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((z + 1.0)) - math.sqrt(z))) elif y <= 2.5e+15: tmp = t_1 + ((math.sqrt((1.0 + y)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + 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 + x)) tmp = 0.0 if (y <= 2.6e-13) tmp = Float64(Float64(2.0 + Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) - sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z)))); elseif (y <= 2.5e+15) tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + 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 + x));
tmp = 0.0;
if (y <= 2.6e-13)
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((z + 1.0)) - sqrt(z)));
elseif (y <= 2.5e+15)
tmp = t_1 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + 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 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.6e-13], N[(N[(2.0 + N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+15], N[(t$95$1 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 2.6 \cdot 10^{-13}:\\
\;\;\;\;\left(2 + \left(y \cdot \left(0.5 + y \cdot -0.125\right) - \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 2.6e-13Initial program 95.7%
associate-+l+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in x around 0 51.2%
Taylor expanded in y around 0 51.2%
associate--l+51.2%
*-commutative51.2%
Simplified51.2%
Taylor expanded in y around inf 58.8%
if 2.6e-13 < y < 2.5e15Initial program 95.4%
associate-+l+95.4%
sub-neg95.4%
sub-neg95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in t around inf 19.2%
associate--l+25.0%
Simplified25.0%
Taylor expanded in z around inf 20.6%
if 2.5e15 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.8%
associate--l+19.1%
Simplified19.1%
Taylor expanded in x around inf 18.9%
mul-1-neg18.9%
Simplified18.9%
flip-+18.9%
add-sqr-sqrt19.5%
pow219.5%
Applied egg-rr19.5%
associate--l+21.5%
unpow221.5%
sqr-neg21.5%
rem-square-sqrt23.5%
sub-neg23.5%
remove-double-neg23.5%
+-commutative23.5%
Simplified23.5%
Final simplification39.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 x))))
(if (<= y 1.2e-29)
(+
(/ 1.0 (+ (sqrt z) (sqrt (+ z 1.0))))
(+ (- t_1 (sqrt x)) (+ 1.0 (- (* y 0.5) (sqrt y)))))
(if (<= y 2.3e+15)
(+
t_1
(-
(+ (sqrt (+ 1.0 y)) (* 0.5 (sqrt (/ 1.0 z))))
(+ (sqrt x) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) 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 + x));
double tmp;
if (y <= 1.2e-29) {
tmp = (1.0 / (sqrt(z) + sqrt((z + 1.0)))) + ((t_1 - sqrt(x)) + (1.0 + ((y * 0.5) - sqrt(y))));
} else if (y <= 2.3e+15) {
tmp = t_1 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 1.2d-29) then
tmp = (1.0d0 / (sqrt(z) + sqrt((z + 1.0d0)))) + ((t_1 - sqrt(x)) + (1.0d0 + ((y * 0.5d0) - sqrt(y))))
else if (y <= 2.3d+15) then
tmp = t_1 + ((sqrt((1.0d0 + y)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + 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 + x));
double tmp;
if (y <= 1.2e-29) {
tmp = (1.0 / (Math.sqrt(z) + Math.sqrt((z + 1.0)))) + ((t_1 - Math.sqrt(x)) + (1.0 + ((y * 0.5) - Math.sqrt(y))));
} else if (y <= 2.3e+15) {
tmp = t_1 + ((Math.sqrt((1.0 + y)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + 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 + x)) tmp = 0 if y <= 1.2e-29: tmp = (1.0 / (math.sqrt(z) + math.sqrt((z + 1.0)))) + ((t_1 - math.sqrt(x)) + (1.0 + ((y * 0.5) - math.sqrt(y)))) elif y <= 2.3e+15: tmp = t_1 + ((math.sqrt((1.0 + y)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + 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 + x)) tmp = 0.0 if (y <= 1.2e-29) tmp = Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(z + 1.0)))) + Float64(Float64(t_1 - sqrt(x)) + Float64(1.0 + Float64(Float64(y * 0.5) - sqrt(y))))); elseif (y <= 2.3e+15) tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + 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 + x));
tmp = 0.0;
if (y <= 1.2e-29)
tmp = (1.0 / (sqrt(z) + sqrt((z + 1.0)))) + ((t_1 - sqrt(x)) + (1.0 + ((y * 0.5) - sqrt(y))));
elseif (y <= 2.3e+15)
tmp = t_1 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + 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 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.2e-29], N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e+15], N[(t$95$1 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.2 \cdot 10^{-29}:\\
\;\;\;\;\frac{1}{\sqrt{z} + \sqrt{z + 1}} + \left(\left(t\_1 - \sqrt{x}\right) + \left(1 + \left(y \cdot 0.5 - \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 1.19999999999999996e-29Initial program 95.4%
associate-+l+95.4%
sub-neg95.4%
sub-neg95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in y around 0 95.4%
associate--l+95.4%
*-commutative95.4%
Simplified95.4%
Taylor expanded in t around inf 53.4%
flip--51.2%
div-inv51.2%
add-sqr-sqrt35.5%
add-sqr-sqrt51.2%
Applied egg-rr53.4%
associate-*r/51.2%
*-rgt-identity51.2%
associate--l+51.2%
+-inverses51.2%
metadata-eval51.2%
Simplified53.7%
if 1.19999999999999996e-29 < y < 2.3e15Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 20.5%
associate--l+23.4%
Simplified23.4%
Taylor expanded in z around inf 12.1%
if 2.3e15 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.8%
associate--l+19.1%
Simplified19.1%
Taylor expanded in x around inf 18.9%
mul-1-neg18.9%
Simplified18.9%
flip-+18.9%
add-sqr-sqrt19.5%
pow219.5%
Applied egg-rr19.5%
associate--l+21.5%
unpow221.5%
sqr-neg21.5%
rem-square-sqrt23.5%
sub-neg23.5%
remove-double-neg23.5%
+-commutative23.5%
Simplified23.5%
Final simplification35.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.8e+15)
(+
(- (sqrt (+ z 1.0)) (sqrt z))
(- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.8e+15) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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.8d+15) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + ((1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + 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.8e+15) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + ((1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5.8e+15: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + ((1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5.8e+15) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + 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.8e+15)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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.8e+15], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.8 \cdot 10^{+15}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 5.8e15Initial program 95.7%
associate-+l+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in x around 0 51.3%
Taylor expanded in t around inf 33.6%
if 5.8e15 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.8%
associate--l+19.1%
Simplified19.1%
Taylor expanded in x around inf 18.9%
mul-1-neg18.9%
Simplified18.9%
flip-+18.9%
add-sqr-sqrt19.5%
pow219.5%
Applied egg-rr19.5%
associate--l+21.5%
unpow221.5%
sqr-neg21.5%
rem-square-sqrt23.5%
sub-neg23.5%
remove-double-neg23.5%
+-commutative23.5%
Simplified23.5%
Final simplification28.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 x))))
(if (<= y 1.05e-13)
(+
(+ 2.0 (- (* y (+ 0.5 (* y -0.125))) (sqrt y)))
(- (+ (sqrt (+ z 1.0)) (* 0.5 (sqrt (/ 1.0 t)))) (sqrt z)))
(if (<= y 5.8e+15)
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) 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 + x));
double tmp;
if (y <= 1.05e-13) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + ((sqrt((z + 1.0)) + (0.5 * sqrt((1.0 / t)))) - sqrt(z));
} else if (y <= 5.8e+15) {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 1.05d-13) then
tmp = (2.0d0 + ((y * (0.5d0 + (y * (-0.125d0)))) - sqrt(y))) + ((sqrt((z + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / t)))) - sqrt(z))
else if (y <= 5.8d+15) then
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + 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 + x));
double tmp;
if (y <= 1.05e-13) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - Math.sqrt(y))) + ((Math.sqrt((z + 1.0)) + (0.5 * Math.sqrt((1.0 / t)))) - Math.sqrt(z));
} else if (y <= 5.8e+15) {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + 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 + x)) tmp = 0 if y <= 1.05e-13: tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - math.sqrt(y))) + ((math.sqrt((z + 1.0)) + (0.5 * math.sqrt((1.0 / t)))) - math.sqrt(z)) elif y <= 5.8e+15: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + 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 + x)) tmp = 0.0 if (y <= 1.05e-13) tmp = Float64(Float64(2.0 + Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) - sqrt(y))) + Float64(Float64(sqrt(Float64(z + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / t)))) - sqrt(z))); elseif (y <= 5.8e+15) tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + 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 + x));
tmp = 0.0;
if (y <= 1.05e-13)
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + ((sqrt((z + 1.0)) + (0.5 * sqrt((1.0 / t)))) - sqrt(z));
elseif (y <= 5.8e+15)
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + 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 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.05e-13], N[(N[(2.0 + N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+15], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.05 \cdot 10^{-13}:\\
\;\;\;\;\left(2 + \left(y \cdot \left(0.5 + y \cdot -0.125\right) - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} + 0.5 \cdot \sqrt{\frac{1}{t}}\right) - \sqrt{z}\right)\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 1.04999999999999994e-13Initial program 95.7%
associate-+l+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in x around 0 51.2%
Taylor expanded in y around 0 51.2%
associate--l+51.2%
*-commutative51.2%
Simplified51.2%
Taylor expanded in y around inf 58.8%
Taylor expanded in t around inf 42.1%
if 1.04999999999999994e-13 < y < 5.8e15Initial program 95.4%
associate-+l+95.4%
sub-neg95.4%
sub-neg95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in t around inf 19.2%
associate--l+25.0%
Simplified25.0%
Taylor expanded in z around inf 23.7%
associate--l+23.9%
Simplified23.9%
if 5.8e15 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.8%
associate--l+19.1%
Simplified19.1%
Taylor expanded in x around inf 18.9%
mul-1-neg18.9%
Simplified18.9%
flip-+18.9%
add-sqr-sqrt19.5%
pow219.5%
Applied egg-rr19.5%
associate--l+21.5%
unpow221.5%
sqr-neg21.5%
rem-square-sqrt23.5%
sub-neg23.5%
remove-double-neg23.5%
+-commutative23.5%
Simplified23.5%
Final simplification32.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 2.8e-13)
(+
(+ 2.0 (- (* y (+ 0.5 (* y -0.125))) (sqrt y)))
(- (sqrt (+ z 1.0)) (sqrt z)))
(if (<= y 4.5e+15)
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (sqrt x) 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 + x));
double tmp;
if (y <= 2.8e-13) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z));
} else if (y <= 4.5e+15) {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 2.8d-13) then
tmp = (2.0d0 + ((y * (0.5d0 + (y * (-0.125d0)))) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))
else if (y <= 4.5d+15) then
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + 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 + x));
double tmp;
if (y <= 2.8e-13) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z));
} else if (y <= 4.5e+15) {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + 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 + x)) tmp = 0 if y <= 2.8e-13: tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z)) elif y <= 4.5e+15: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + 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 + x)) tmp = 0.0 if (y <= 2.8e-13) tmp = Float64(Float64(2.0 + Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))); elseif (y <= 4.5e+15) tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + 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 + x));
tmp = 0.0;
if (y <= 2.8e-13)
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z));
elseif (y <= 4.5e+15)
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + 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 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.8e-13], N[(N[(2.0 + N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+15], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 2.8 \cdot 10^{-13}:\\
\;\;\;\;\left(2 + \left(y \cdot \left(0.5 + y \cdot -0.125\right) - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 2.8000000000000002e-13Initial program 95.7%
associate-+l+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in x around 0 51.2%
Taylor expanded in y around 0 51.2%
associate--l+51.2%
*-commutative51.2%
Simplified51.2%
Taylor expanded in y around inf 58.8%
Taylor expanded in t around inf 65.9%
if 2.8000000000000002e-13 < y < 4.5e15Initial program 95.4%
associate-+l+95.4%
sub-neg95.4%
sub-neg95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in t around inf 19.2%
associate--l+25.0%
Simplified25.0%
Taylor expanded in z around inf 23.7%
associate--l+23.9%
Simplified23.9%
if 4.5e15 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.8%
associate--l+19.1%
Simplified19.1%
Taylor expanded in x around inf 18.9%
mul-1-neg18.9%
Simplified18.9%
flip-+18.9%
add-sqr-sqrt19.5%
pow219.5%
Applied egg-rr19.5%
associate--l+21.5%
unpow221.5%
sqr-neg21.5%
rem-square-sqrt23.5%
sub-neg23.5%
remove-double-neg23.5%
+-commutative23.5%
Simplified23.5%
Final simplification43.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 2.6)
(+
(+ 2.0 (- (* y (+ 0.5 (* y -0.125))) (sqrt y)))
(- (sqrt (+ z 1.0)) (sqrt z)))
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.6) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z));
} else {
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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.6d0) then
tmp = (2.0d0 + ((y * (0.5d0 + (y * (-0.125d0)))) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))
else
tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + 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.6) {
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z));
} else {
tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.6: tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z)) else: tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.6) tmp = Float64(Float64(2.0 + Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + 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.6)
tmp = (2.0 + ((y * (0.5 + (y * -0.125))) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z));
else
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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.6], N[(N[(2.0 + N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $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[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6:\\
\;\;\;\;\left(2 + \left(y \cdot \left(0.5 + y \cdot -0.125\right) - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 2.60000000000000009Initial program 95.9%
associate-+l+95.9%
sub-neg95.9%
sub-neg95.9%
+-commutative95.9%
+-commutative95.9%
+-commutative95.9%
Simplified95.9%
Taylor expanded in x around 0 51.5%
Taylor expanded in y around 0 50.6%
associate--l+50.6%
*-commutative50.6%
Simplified50.6%
Taylor expanded in y around inf 58.2%
Taylor expanded in t around inf 64.3%
if 2.60000000000000009 < y Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 3.9%
associate--l+19.0%
Simplified19.0%
Taylor expanded in x around inf 18.8%
mul-1-neg18.8%
Simplified18.8%
flip-+18.8%
add-sqr-sqrt19.4%
pow219.4%
Applied egg-rr19.4%
associate--l+21.3%
unpow221.3%
sqr-neg21.3%
rem-square-sqrt23.3%
sub-neg23.3%
remove-double-neg23.3%
+-commutative23.3%
Simplified23.3%
Final simplification43.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 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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 = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + x)))
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 - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + 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[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}
\end{array}
Initial program 90.5%
associate-+l+90.5%
sub-neg90.5%
sub-neg90.5%
+-commutative90.5%
+-commutative90.5%
+-commutative90.5%
Simplified90.5%
Taylor expanded in t around inf 11.9%
associate--l+21.8%
Simplified21.8%
Taylor expanded in x around inf 15.2%
mul-1-neg15.2%
Simplified15.2%
flip-+15.2%
add-sqr-sqrt15.8%
pow215.8%
Applied egg-rr15.8%
associate--l+17.2%
unpow217.2%
sqr-neg17.2%
rem-square-sqrt18.3%
sub-neg18.3%
remove-double-neg18.3%
+-commutative18.3%
Simplified18.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 105000000.0) (- (sqrt (+ 1.0 x)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 105000000.0) {
tmp = sqrt((1.0 + x)) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 105000000.0d0) then
tmp = sqrt((1.0d0 + x)) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 105000000.0) {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 105000000.0: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 105000000.0) tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 105000000.0)
tmp = sqrt((1.0 + x)) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 105000000.0], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 105000000:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.05e8Initial program 97.0%
associate-+l+97.0%
sub-neg97.0%
sub-neg97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
Taylor expanded in t around inf 19.9%
associate--l+38.1%
Simplified38.1%
Taylor expanded in x around inf 26.8%
mul-1-neg26.8%
Simplified26.8%
unsub-neg26.8%
Applied egg-rr26.8%
if 1.05e8 < x Initial program 84.2%
associate-+l+84.2%
sub-neg84.2%
sub-neg84.2%
+-commutative84.2%
+-commutative84.2%
+-commutative84.2%
Simplified84.2%
Taylor expanded in t around inf 4.2%
associate--l+6.0%
Simplified6.0%
Taylor expanded in x around inf 4.0%
mul-1-neg4.0%
Simplified4.0%
Taylor expanded in x around inf 9.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 1.32) (- (+ 1.0 (* x (+ 0.5 (* x (- (* x 0.0625) 0.125))))) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.32) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.32d0) then
tmp = (1.0d0 + (x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0))))) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.32) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.32: tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.32) tmp = Float64(Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.0625) - 0.125))))) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.32)
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.32], N[(N[(1.0 + N[(x * N[(0.5 + N[(x * N[(N[(x * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.32:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.32000000000000006Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 20.1%
associate--l+38.7%
Simplified38.7%
Taylor expanded in x around inf 26.9%
mul-1-neg26.9%
Simplified26.9%
Taylor expanded in x around 0 26.9%
if 1.32000000000000006 < x Initial program 84.1%
associate-+l+84.1%
sub-neg84.1%
sub-neg84.1%
+-commutative84.1%
+-commutative84.1%
+-commutative84.1%
Simplified84.1%
Taylor expanded in t around inf 4.6%
associate--l+6.7%
Simplified6.7%
Taylor expanded in x around inf 4.7%
mul-1-neg4.7%
Simplified4.7%
Taylor expanded in x around inf 10.4%
Final simplification18.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 (<= x 0.74) (+ 1.0 (- (* x (+ 0.5 (* x -0.125))) (sqrt x))) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.74) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 0.74d0) then
tmp = 1.0d0 + ((x * (0.5d0 + (x * (-0.125d0)))) - sqrt(x))
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.74) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.74: tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - math.sqrt(x)) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.74) tmp = Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - sqrt(x))); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 0.74)
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.74], N[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.74:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.73999999999999999Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 20.1%
associate--l+38.7%
Simplified38.7%
Taylor expanded in x around inf 26.9%
mul-1-neg26.9%
Simplified26.9%
Taylor expanded in x around 0 26.9%
associate--l+26.9%
*-commutative26.9%
Simplified26.9%
if 0.73999999999999999 < x Initial program 84.1%
associate-+l+84.1%
sub-neg84.1%
sub-neg84.1%
+-commutative84.1%
+-commutative84.1%
+-commutative84.1%
Simplified84.1%
Taylor expanded in t around inf 4.6%
associate--l+6.7%
Simplified6.7%
Taylor expanded in x around inf 4.7%
mul-1-neg4.7%
Simplified4.7%
Taylor expanded in x around inf 10.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.88) (+ 1.0 (- (* x 0.5) (sqrt x))) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.88) {
tmp = 1.0 + ((x * 0.5) - sqrt(x));
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 0.88d0) then
tmp = 1.0d0 + ((x * 0.5d0) - sqrt(x))
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.88) {
tmp = 1.0 + ((x * 0.5) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.88: tmp = 1.0 + ((x * 0.5) - math.sqrt(x)) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.88) tmp = Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 0.88)
tmp = 1.0 + ((x * 0.5) - sqrt(x));
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.88], N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.88:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.880000000000000004Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 20.1%
associate--l+38.7%
Simplified38.7%
Taylor expanded in x around inf 26.9%
mul-1-neg26.9%
Simplified26.9%
Taylor expanded in x around 0 26.9%
associate--l+26.9%
*-commutative26.9%
Simplified26.9%
if 0.880000000000000004 < x Initial program 84.1%
associate-+l+84.1%
sub-neg84.1%
sub-neg84.1%
+-commutative84.1%
+-commutative84.1%
+-commutative84.1%
Simplified84.1%
Taylor expanded in t around inf 4.6%
associate--l+6.7%
Simplified6.7%
Taylor expanded in x around inf 4.7%
mul-1-neg4.7%
Simplified4.7%
Taylor expanded in x around inf 10.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.24) (- 1.0 (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.24) {
tmp = 1.0 - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 0.24d0) then
tmp = 1.0d0 - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.24) {
tmp = 1.0 - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.24: tmp = 1.0 - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.24) tmp = Float64(1.0 - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 0.24)
tmp = 1.0 - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.24], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.24:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.23999999999999999Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 20.1%
associate--l+38.7%
Simplified38.7%
Taylor expanded in x around inf 26.9%
mul-1-neg26.9%
Simplified26.9%
Taylor expanded in x around 0 26.7%
if 0.23999999999999999 < x Initial program 84.1%
associate-+l+84.1%
sub-neg84.1%
sub-neg84.1%
+-commutative84.1%
+-commutative84.1%
+-commutative84.1%
Simplified84.1%
Taylor expanded in t around inf 4.6%
associate--l+6.7%
Simplified6.7%
Taylor expanded in x around inf 4.7%
mul-1-neg4.7%
Simplified4.7%
Taylor expanded in x around inf 10.4%
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 x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Initial program 90.5%
associate-+l+90.5%
sub-neg90.5%
sub-neg90.5%
+-commutative90.5%
+-commutative90.5%
+-commutative90.5%
Simplified90.5%
Taylor expanded in t around inf 11.9%
associate--l+21.8%
Simplified21.8%
Taylor expanded in x around inf 15.2%
mul-1-neg15.2%
Simplified15.2%
Taylor expanded in x around 0 13.3%
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 90.5%
associate-+l+90.5%
sub-neg90.5%
sub-neg90.5%
+-commutative90.5%
+-commutative90.5%
+-commutative90.5%
Simplified90.5%
Taylor expanded in t around inf 11.9%
associate--l+21.8%
Simplified21.8%
Taylor expanded in x around inf 15.2%
mul-1-neg15.2%
Simplified15.2%
Taylor expanded in x around 0 13.3%
Taylor expanded in x around inf 1.6%
neg-mul-11.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 2024163
(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))))