
(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 19 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 y) (sqrt (+ 1.0 y))))
(t_2 (sqrt (+ 1.0 t)))
(t_3 (+ (sqrt x) (sqrt (+ 1.0 x)))))
(if (<= z 360000.0)
(-
(+ (+ (sqrt (+ z 1.0)) 2.0) (fma 0.5 y (/ 1.0 (+ t_2 (sqrt t)))))
(+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
(* (+ t_1 t_3) (/ 1.0 (* t_1 t_3)))
(+ (* 0.5 (sqrt (/ 1.0 z))) (- t_2 (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(y) + sqrt((1.0 + y));
double t_2 = sqrt((1.0 + t));
double t_3 = sqrt(x) + sqrt((1.0 + x));
double tmp;
if (z <= 360000.0) {
tmp = ((sqrt((z + 1.0)) + 2.0) + fma(0.5, y, (1.0 / (t_2 + sqrt(t))))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = ((t_1 + t_3) * (1.0 / (t_1 * t_3))) + ((0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t)));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(y) + sqrt(Float64(1.0 + y))) t_2 = sqrt(Float64(1.0 + t)) t_3 = Float64(sqrt(x) + sqrt(Float64(1.0 + x))) tmp = 0.0 if (z <= 360000.0) tmp = Float64(Float64(Float64(sqrt(Float64(z + 1.0)) + 2.0) + fma(0.5, y, Float64(1.0 / Float64(t_2 + sqrt(t))))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(Float64(Float64(t_1 + t_3) * Float64(1.0 / Float64(t_1 * t_3))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_2 - sqrt(t)))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 360000.0], N[(N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] + N[(0.5 * y + N[(1.0 / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 + t$95$3), $MachinePrecision] * N[(1.0 / N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y} + \sqrt{1 + y}\\
t_2 := \sqrt{1 + t}\\
t_3 := \sqrt{x} + \sqrt{1 + x}\\
\mathbf{if}\;z \leq 360000:\\
\;\;\;\;\left(\left(\sqrt{z + 1} + 2\right) + \mathsf{fma}\left(0.5, y, \frac{1}{t\_2 + \sqrt{t}}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + t\_3\right) \cdot \frac{1}{t\_1 \cdot t\_3} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_2 - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if z < 3.6e5Initial program 97.0%
associate-+l+97.0%
sub-neg97.0%
sub-neg97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
Taylor expanded in x around 0 50.7%
flip--50.7%
div-inv50.7%
add-sqr-sqrt36.3%
add-sqr-sqrt50.7%
Applied egg-rr50.7%
associate-*r/50.7%
*-rgt-identity50.7%
associate--l+51.3%
+-inverses51.3%
metadata-eval51.3%
Simplified51.3%
Taylor expanded in y around 0 32.4%
associate-+r+32.5%
+-commutative32.5%
fma-define32.5%
+-commutative32.5%
Simplified32.5%
if 3.6e5 < z Initial program 87.7%
associate-+l+87.7%
sub-neg87.7%
sub-neg87.7%
+-commutative87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
flip--87.9%
flip--87.9%
frac-add87.8%
Applied egg-rr88.4%
Simplified91.5%
expm1-log1p-u88.1%
expm1-undefine88.1%
hypot-undefine88.1%
metadata-eval88.1%
add-sqr-sqrt88.1%
+-commutative88.1%
Applied egg-rr88.1%
expm1-define88.1%
+-commutative88.1%
associate-+l-89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
div-inv89.2%
expm1-log1p-u92.7%
fma-undefine92.7%
+-inverses92.7%
metadata-eval92.7%
*-un-lft-identity92.7%
+-commutative92.7%
hypot-undefine92.7%
metadata-eval92.7%
add-sqr-sqrt92.7%
Applied egg-rr92.7%
Taylor expanded in z around inf 95.6%
Final simplification62.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (- (sqrt (+ 1.0 y)) (sqrt y)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_4 (sqrt (+ z 1.0)))
(t_5 (- t_4 (sqrt z))))
(if (<= (+ t_3 (+ (+ (- t_1 (sqrt x)) t_2) t_5)) 1.0001)
(+ (+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_1))) (+ t_3 t_5))
(+ (+ (- 1.0 (sqrt x)) t_2) (+ t_3 (/ 1.0 (+ 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)) - sqrt(y);
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double t_4 = sqrt((z + 1.0));
double t_5 = t_4 - sqrt(z);
double tmp;
if ((t_3 + (((t_1 - sqrt(x)) + t_2) + t_5)) <= 1.0001) {
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_1))) + (t_3 + t_5);
} else {
tmp = ((1.0 - sqrt(x)) + t_2) + (t_3 + (1.0 / (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) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y)) - sqrt(y)
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
t_4 = sqrt((z + 1.0d0))
t_5 = t_4 - sqrt(z)
if ((t_3 + (((t_1 - sqrt(x)) + t_2) + t_5)) <= 1.0001d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt(x) + t_1))) + (t_3 + t_5)
else
tmp = ((1.0d0 - sqrt(x)) + t_2) + (t_3 + (1.0d0 / (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)) - Math.sqrt(y);
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_4 = Math.sqrt((z + 1.0));
double t_5 = t_4 - Math.sqrt(z);
double tmp;
if ((t_3 + (((t_1 - Math.sqrt(x)) + t_2) + t_5)) <= 1.0001) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt(x) + t_1))) + (t_3 + t_5);
} else {
tmp = ((1.0 - Math.sqrt(x)) + t_2) + (t_3 + (1.0 / (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)) - math.sqrt(y) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) t_4 = math.sqrt((z + 1.0)) t_5 = t_4 - math.sqrt(z) tmp = 0 if (t_3 + (((t_1 - math.sqrt(x)) + t_2) + t_5)) <= 1.0001: tmp = ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt(x) + t_1))) + (t_3 + t_5) else: tmp = ((1.0 - math.sqrt(x)) + t_2) + (t_3 + (1.0 / (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 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_4 = sqrt(Float64(z + 1.0)) t_5 = Float64(t_4 - sqrt(z)) tmp = 0.0 if (Float64(t_3 + Float64(Float64(Float64(t_1 - sqrt(x)) + t_2) + t_5)) <= 1.0001) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_1))) + Float64(t_3 + t_5)); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + t_2) + Float64(t_3 + Float64(1.0 / 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)) - sqrt(y);
t_3 = sqrt((1.0 + t)) - sqrt(t);
t_4 = sqrt((z + 1.0));
t_5 = t_4 - sqrt(z);
tmp = 0.0;
if ((t_3 + (((t_1 - sqrt(x)) + t_2) + t_5)) <= 1.0001)
tmp = ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_1))) + (t_3 + t_5);
else
tmp = ((1.0 - sqrt(x)) + t_2) + (t_3 + (1.0 / (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[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$3 + N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + t$95$5), $MachinePrecision]), $MachinePrecision], 1.0001], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + t$95$5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y} - \sqrt{y}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
t_4 := \sqrt{z + 1}\\
t_5 := t\_4 - \sqrt{z}\\
\mathbf{if}\;t\_3 + \left(\left(\left(t\_1 - \sqrt{x}\right) + t\_2\right) + t\_5\right) \leq 1.0001:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_1}\right) + \left(t\_3 + t\_5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + t\_2\right) + \left(t\_3 + \frac{1}{t\_4 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 1.00009999999999999Initial program 80.6%
associate-+l+80.6%
sub-neg80.6%
sub-neg80.6%
+-commutative80.6%
+-commutative80.6%
+-commutative80.6%
Simplified80.6%
flip--80.9%
flip--80.8%
frac-add80.9%
Applied egg-rr82.1%
Simplified87.1%
Taylor expanded in y around inf 67.2%
if 1.00009999999999999 < (+.f64 (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in x around 0 58.9%
flip--58.9%
div-inv58.9%
add-sqr-sqrt46.4%
add-sqr-sqrt59.1%
Applied egg-rr59.1%
associate-*r/59.1%
*-rgt-identity59.1%
associate--l+59.3%
+-inverses59.3%
metadata-eval59.3%
Simplified59.3%
Final simplification61.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (sqrt (+ z 1.0))))
(if (<= (- t_2 (sqrt x)) 0.999)
(+ (/ 1.0 (+ (sqrt x) t_2)) (+ t_1 (- t_3 (sqrt z))))
(+
(+ (- 1.0 (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y)))
(+ t_1 (/ 1.0 (+ t_3 (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 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((z + 1.0));
double tmp;
if ((t_2 - sqrt(x)) <= 0.999) {
tmp = (1.0 / (sqrt(x) + t_2)) + (t_1 + (t_3 - sqrt(z)));
} else {
tmp = ((1.0 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y))) + (t_1 + (1.0 / (t_3 + 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) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((z + 1.0d0))
if ((t_2 - sqrt(x)) <= 0.999d0) then
tmp = (1.0d0 / (sqrt(x) + t_2)) + (t_1 + (t_3 - sqrt(z)))
else
tmp = ((1.0d0 - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y))) + (t_1 + (1.0d0 / (t_3 + 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 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((z + 1.0));
double tmp;
if ((t_2 - Math.sqrt(x)) <= 0.999) {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + (t_1 + (t_3 - Math.sqrt(z)));
} else {
tmp = ((1.0 - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + (t_1 + (1.0 / (t_3 + 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 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((z + 1.0)) tmp = 0 if (t_2 - math.sqrt(x)) <= 0.999: tmp = (1.0 / (math.sqrt(x) + t_2)) + (t_1 + (t_3 - math.sqrt(z))) else: tmp = ((1.0 - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) + (t_1 + (1.0 / (t_3 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + x)) t_3 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (Float64(t_2 - sqrt(x)) <= 0.999) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(t_1 + Float64(t_3 - sqrt(z)))); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(t_1 + Float64(1.0 / Float64(t_3 + 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 + t)) - sqrt(t);
t_2 = sqrt((1.0 + x));
t_3 = sqrt((z + 1.0));
tmp = 0.0;
if ((t_2 - sqrt(x)) <= 0.999)
tmp = (1.0 / (sqrt(x) + t_2)) + (t_1 + (t_3 - sqrt(z)));
else
tmp = ((1.0 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y))) + (t_1 + (1.0 / (t_3 + 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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.999], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(t$95$3 + N[Sqrt[z], $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} - \sqrt{t}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{z + 1}\\
\mathbf{if}\;t\_2 - \sqrt{x} \leq 0.999:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(t\_1 + \left(t\_3 - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(t\_1 + \frac{1}{t\_3 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.998999999999999999Initial program 88.1%
associate-+l+88.1%
sub-neg88.1%
sub-neg88.1%
+-commutative88.1%
+-commutative88.1%
+-commutative88.1%
Simplified88.1%
flip--88.4%
flip--88.4%
frac-add88.4%
Applied egg-rr89.4%
Simplified91.9%
Taylor expanded in y around inf 47.6%
if 0.998999999999999999 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 96.9%
flip--96.9%
div-inv96.9%
add-sqr-sqrt73.7%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
associate-*r/97.2%
*-rgt-identity97.2%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
Simplified97.5%
Final simplification71.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ z 1.0)) (sqrt z))))
(t_2 (sqrt (+ 1.0 x))))
(if (<= (- t_2 (sqrt x)) 0.999)
(+ (/ 1.0 (+ (sqrt x) t_2)) t_1)
(+ t_1 (+ (- 1.0 (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = (sqrt((1.0 + t)) - sqrt(t)) + (sqrt((z + 1.0)) - sqrt(z));
double t_2 = sqrt((1.0 + x));
double tmp;
if ((t_2 - sqrt(x)) <= 0.999) {
tmp = (1.0 / (sqrt(x) + t_2)) + t_1;
} else {
tmp = t_1 + ((1.0 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((z + 1.0d0)) - sqrt(z))
t_2 = sqrt((1.0d0 + x))
if ((t_2 - sqrt(x)) <= 0.999d0) then
tmp = (1.0d0 / (sqrt(x) + t_2)) + t_1
else
tmp = t_1 + ((1.0d0 - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((z + 1.0)) - Math.sqrt(z));
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if ((t_2 - Math.sqrt(x)) <= 0.999) {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + t_1;
} else {
tmp = t_1 + ((1.0 - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((z + 1.0)) - math.sqrt(z)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if (t_2 - math.sqrt(x)) <= 0.999: tmp = (1.0 / (math.sqrt(x) + t_2)) + t_1 else: tmp = t_1 + ((1.0 - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(t_2 - sqrt(x)) <= 0.999) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + t_1); else tmp = Float64(t_1 + Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = (sqrt((1.0 + t)) - sqrt(t)) + (sqrt((z + 1.0)) - sqrt(z));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if ((t_2 - sqrt(x)) <= 0.999)
tmp = (1.0 / (sqrt(x) + t_2)) + t_1;
else
tmp = t_1 + ((1.0 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(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]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.999], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;t\_2 - \sqrt{x} \leq 0.999:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(1 - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.998999999999999999Initial program 88.1%
associate-+l+88.1%
sub-neg88.1%
sub-neg88.1%
+-commutative88.1%
+-commutative88.1%
+-commutative88.1%
Simplified88.1%
flip--88.4%
flip--88.4%
frac-add88.4%
Applied egg-rr89.4%
Simplified91.9%
Taylor expanded in y around inf 47.6%
if 0.998999999999999999 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 96.9%
Final simplification70.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 t))) (t_2 (- (sqrt (+ z 1.0)) (sqrt z))))
(if (<= x 8.5e-7)
(+
(+ (- 1.0 (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y)))
(+ (/ 1.0 (+ t_1 (sqrt t))) t_2))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (+ (- t_1 (sqrt t)) t_2)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t));
double t_2 = sqrt((z + 1.0)) - sqrt(z);
double tmp;
if (x <= 8.5e-7) {
tmp = ((1.0 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y))) + ((1.0 / (t_1 + sqrt(t))) + t_2);
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + ((t_1 - sqrt(t)) + t_2);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + t))
t_2 = sqrt((z + 1.0d0)) - sqrt(z)
if (x <= 8.5d-7) then
tmp = ((1.0d0 - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y))) + ((1.0d0 / (t_1 + sqrt(t))) + t_2)
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + ((t_1 - sqrt(t)) + t_2)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t));
double t_2 = Math.sqrt((z + 1.0)) - Math.sqrt(z);
double tmp;
if (x <= 8.5e-7) {
tmp = ((1.0 - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + ((1.0 / (t_1 + Math.sqrt(t))) + t_2);
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + ((t_1 - Math.sqrt(t)) + t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) t_2 = math.sqrt((z + 1.0)) - math.sqrt(z) tmp = 0 if x <= 8.5e-7: tmp = ((1.0 - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) + ((1.0 / (t_1 + math.sqrt(t))) + t_2) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + ((t_1 - math.sqrt(t)) + t_2) 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 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) tmp = 0.0 if (x <= 8.5e-7) tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(Float64(1.0 / Float64(t_1 + sqrt(t))) + t_2)); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(Float64(t_1 - sqrt(t)) + t_2)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t));
t_2 = sqrt((z + 1.0)) - sqrt(z);
tmp = 0.0;
if (x <= 8.5e-7)
tmp = ((1.0 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y))) + ((1.0 / (t_1 + sqrt(t))) + t_2);
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + ((t_1 - sqrt(t)) + t_2);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 8.5e-7], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t}\\
t_2 := \sqrt{z + 1} - \sqrt{z}\\
\mathbf{if}\;x \leq 8.5 \cdot 10^{-7}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\frac{1}{t\_1 + \sqrt{t}} + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\left(t\_1 - \sqrt{t}\right) + t\_2\right)\\
\end{array}
\end{array}
if x < 8.50000000000000014e-7Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 96.9%
flip--97.0%
div-inv97.0%
add-sqr-sqrt65.9%
add-sqr-sqrt97.0%
Applied egg-rr97.0%
associate-*r/97.0%
*-rgt-identity97.0%
associate--l+97.8%
+-inverses97.8%
metadata-eval97.8%
Simplified97.8%
if 8.50000000000000014e-7 < x Initial program 88.1%
associate-+l+88.1%
sub-neg88.1%
sub-neg88.1%
+-commutative88.1%
+-commutative88.1%
+-commutative88.1%
Simplified88.1%
flip--88.4%
flip--88.4%
frac-add88.4%
Applied egg-rr89.4%
Simplified91.9%
Taylor expanded in y around inf 47.6%
Final simplification71.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ z 1.0)) (sqrt z)))))
(if (<= y 1.5e+22)
(+ t_1 (+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 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 + t)) - sqrt(t)) + (sqrt((z + 1.0)) - sqrt(z));
double tmp;
if (y <= 1.5e+22) {
tmp = t_1 + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + 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 + t)) - sqrt(t)) + (sqrt((z + 1.0d0)) - sqrt(z))
if (y <= 1.5d+22) then
tmp = t_1 + (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + 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 + t)) - Math.sqrt(t)) + (Math.sqrt((z + 1.0)) - Math.sqrt(z));
double tmp;
if (y <= 1.5e+22) {
tmp = t_1 + (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + 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 + t)) - math.sqrt(t)) + (math.sqrt((z + 1.0)) - math.sqrt(z)) tmp = 0 if y <= 1.5e+22: tmp = t_1 + (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) tmp = 0.0 if (y <= 1.5e+22) tmp = Float64(t_1 + Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 + t)) - sqrt(t)) + (sqrt((z + 1.0)) - sqrt(z));
tmp = 0.0;
if (y <= 1.5e+22)
tmp = t_1 + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + 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[(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]}, If[LessEqual[y, 1.5e+22], N[(t$95$1 + N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\\
\mathbf{if}\;y \leq 1.5 \cdot 10^{+22}:\\
\;\;\;\;t\_1 + \left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + t\_1\\
\end{array}
\end{array}
if y < 1.5e22Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in x around 0 48.0%
associate--l+48.1%
Simplified48.1%
if 1.5e22 < y Initial program 87.5%
associate-+l+87.5%
sub-neg87.5%
sub-neg87.5%
+-commutative87.5%
+-commutative87.5%
+-commutative87.5%
Simplified87.5%
flip--87.9%
flip--87.9%
frac-add87.9%
Applied egg-rr88.7%
Simplified92.2%
Taylor expanded in y around inf 90.1%
Final simplification67.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ z 1.0)) (sqrt z)))
(t_2 (+ (- (sqrt (+ 1.0 t)) (sqrt t)) t_1)))
(if (<= y 5e-63)
(+ t_2 (- 2.0 (+ (sqrt x) (sqrt y))))
(if (<= y 6.3e+29)
(+ t_1 (+ (- 1.0 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y))))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) t_2)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0)) - sqrt(z);
double t_2 = (sqrt((1.0 + t)) - sqrt(t)) + t_1;
double tmp;
if (y <= 5e-63) {
tmp = t_2 + (2.0 - (sqrt(x) + sqrt(y)));
} else if (y <= 6.3e+29) {
tmp = t_1 + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + t_2;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((z + 1.0d0)) - sqrt(z)
t_2 = (sqrt((1.0d0 + t)) - sqrt(t)) + t_1
if (y <= 5d-63) then
tmp = t_2 + (2.0d0 - (sqrt(x) + sqrt(y)))
else if (y <= 6.3d+29) then
tmp = t_1 + ((1.0d0 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + t_2
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + 1.0)) - Math.sqrt(z);
double t_2 = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + t_1;
double tmp;
if (y <= 5e-63) {
tmp = t_2 + (2.0 - (Math.sqrt(x) + Math.sqrt(y)));
} else if (y <= 6.3e+29) {
tmp = t_1 + ((1.0 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)))));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + t_2;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) - math.sqrt(z) t_2 = (math.sqrt((1.0 + t)) - math.sqrt(t)) + t_1 tmp = 0 if y <= 5e-63: tmp = t_2 + (2.0 - (math.sqrt(x) + math.sqrt(y))) elif y <= 6.3e+29: tmp = t_1 + ((1.0 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((1.0 + y))))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + t_2 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) t_2 = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + t_1) tmp = 0.0 if (y <= 5e-63) tmp = Float64(t_2 + Float64(2.0 - Float64(sqrt(x) + sqrt(y)))); elseif (y <= 6.3e+29) tmp = Float64(t_1 + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + t_2); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((z + 1.0)) - sqrt(z);
t_2 = (sqrt((1.0 + t)) - sqrt(t)) + t_1;
tmp = 0.0;
if (y <= 5e-63)
tmp = t_2 + (2.0 - (sqrt(x) + sqrt(y)));
elseif (y <= 6.3e+29)
tmp = t_1 + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[y, 5e-63], N[(t$95$2 + N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.3e+29], N[(t$95$1 + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1} - \sqrt{z}\\
t_2 := \left(\sqrt{1 + t} - \sqrt{t}\right) + t\_1\\
\mathbf{if}\;y \leq 5 \cdot 10^{-63}:\\
\;\;\;\;t\_2 + \left(2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{elif}\;y \leq 6.3 \cdot 10^{+29}:\\
\;\;\;\;t\_1 + \left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + t\_2\\
\end{array}
\end{array}
if y < 5.0000000000000002e-63Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 48.6%
Taylor expanded in y around 0 48.6%
if 5.0000000000000002e-63 < y < 6.2999999999999998e29Initial program 93.2%
associate-+l+93.2%
sub-neg93.2%
sub-neg93.2%
+-commutative93.2%
+-commutative93.2%
+-commutative93.2%
Simplified93.2%
Taylor expanded in x around 0 49.1%
flip--49.1%
div-inv49.1%
add-sqr-sqrt46.9%
add-sqr-sqrt49.1%
Applied egg-rr49.1%
associate-*r/49.1%
*-rgt-identity49.1%
associate--l+50.9%
+-inverses50.9%
metadata-eval50.9%
Simplified50.9%
Taylor expanded in t around inf 42.3%
if 6.2999999999999998e29 < y Initial program 88.2%
associate-+l+88.2%
sub-neg88.2%
sub-neg88.2%
+-commutative88.2%
+-commutative88.2%
+-commutative88.2%
Simplified88.2%
flip--88.7%
flip--88.7%
frac-add88.7%
Applied egg-rr89.4%
Simplified91.7%
Taylor expanded in y around inf 91.0%
Final simplification65.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)) (sqrt z))))
(if (<= y 1e-63)
(+ (+ (- (sqrt (+ 1.0 t)) (sqrt t)) t_1) (- 2.0 (+ (sqrt x) (sqrt y))))
(+ t_1 (+ (- 1.0 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0)) - sqrt(z);
double tmp;
if (y <= 1e-63) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (2.0 - (sqrt(x) + sqrt(y)));
} else {
tmp = t_1 + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z + 1.0d0)) - sqrt(z)
if (y <= 1d-63) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + t_1) + (2.0d0 - (sqrt(x) + sqrt(y)))
else
tmp = t_1 + ((1.0d0 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + 1.0)) - Math.sqrt(z);
double tmp;
if (y <= 1e-63) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + t_1) + (2.0 - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = t_1 + ((1.0 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) - math.sqrt(z) tmp = 0 if y <= 1e-63: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + t_1) + (2.0 - (math.sqrt(x) + math.sqrt(y))) else: tmp = t_1 + ((1.0 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((1.0 + y))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) tmp = 0.0 if (y <= 1e-63) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + t_1) + Float64(2.0 - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(t_1 + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((z + 1.0)) - sqrt(z);
tmp = 0.0;
if (y <= 1e-63)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_1) + (2.0 - (sqrt(x) + sqrt(y)));
else
tmp = t_1 + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1e-63], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1} - \sqrt{z}\\
\mathbf{if}\;y \leq 10^{-63}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + t\_1\right) + \left(2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right)\\
\end{array}
\end{array}
if y < 1.00000000000000007e-63Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 48.6%
Taylor expanded in y around 0 48.6%
if 1.00000000000000007e-63 < y Initial program 89.7%
associate-+l+89.7%
sub-neg89.7%
sub-neg89.7%
+-commutative89.7%
+-commutative89.7%
+-commutative89.7%
Simplified89.7%
Taylor expanded in x around 0 45.5%
flip--45.5%
div-inv45.5%
add-sqr-sqrt37.2%
add-sqr-sqrt45.6%
Applied egg-rr45.6%
associate-*r/45.6%
*-rgt-identity45.6%
associate--l+46.1%
+-inverses46.1%
metadata-eval46.1%
Simplified46.1%
Taylor expanded in t around inf 31.7%
Final simplification38.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 0.96)
(+
(- (sqrt (+ z 1.0)) (sqrt z))
(+ (- 1.0 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y))))))
(/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* 0.5 (sqrt x))) x)))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.96) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))));
} else {
tmp = ((-0.125 * sqrt((1.0 / x))) + (0.5 * sqrt(x))) / 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.96d0) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + ((1.0d0 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))))
else
tmp = (((-0.125d0) * sqrt((1.0d0 / x))) + (0.5d0 * sqrt(x))) / 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.96) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)))));
} else {
tmp = ((-0.125 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt(x))) / x;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.96: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((1.0 + y))))) else: tmp = ((-0.125 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt(x))) / x return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.96) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))))); else tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(x))) / 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.96)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((1.0 + y)))));
else
tmp = ((-0.125 * sqrt((1.0 / x))) + (0.5 * sqrt(x))) / 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.96], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.96:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{x}}{x}\\
\end{array}
\end{array}
if x < 0.95999999999999996Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 96.5%
flip--96.5%
div-inv96.5%
add-sqr-sqrt85.9%
add-sqr-sqrt96.6%
Applied egg-rr96.6%
associate-*r/96.6%
*-rgt-identity96.6%
associate--l+97.2%
+-inverses97.2%
metadata-eval97.2%
Simplified97.2%
Taylor expanded in t around inf 63.9%
if 0.95999999999999996 < x Initial program 88.0%
associate-+l+88.0%
sub-neg88.0%
sub-neg88.0%
+-commutative88.0%
+-commutative88.0%
+-commutative88.0%
Simplified88.0%
Taylor expanded in t around inf 6.6%
associate--l+8.6%
Simplified8.6%
Taylor expanded in x around inf 3.9%
neg-mul-13.9%
Simplified3.9%
Taylor expanded in x around inf 8.5%
Final simplification34.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.0)
(+
(- (sqrt (+ z 1.0)) (sqrt z))
(+ (- 1.0 (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y))))
(/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* 0.5 (sqrt x))) x)))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((1.0 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y)));
} else {
tmp = ((-0.125 * sqrt((1.0 / x))) + (0.5 * sqrt(x))) / 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.0d0) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + ((1.0d0 - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y)))
else
tmp = (((-0.125d0) * sqrt((1.0d0 / x))) + (0.5d0 * sqrt(x))) / 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.0) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
} else {
tmp = ((-0.125 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt(x))) / x;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.0: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) else: tmp = ((-0.125 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt(x))) / x return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); else tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(x))) / 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.0)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((1.0 - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y)));
else
tmp = ((-0.125 * sqrt((1.0 / x))) + (0.5 * sqrt(x))) / 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.0], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{x}}{x}\\
\end{array}
\end{array}
if x < 1Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 96.5%
Taylor expanded in t around inf 63.5%
if 1 < x Initial program 88.0%
associate-+l+88.0%
sub-neg88.0%
sub-neg88.0%
+-commutative88.0%
+-commutative88.0%
+-commutative88.0%
Simplified88.0%
Taylor expanded in t around inf 6.6%
associate--l+8.6%
Simplified8.6%
Taylor expanded in x around inf 3.9%
neg-mul-13.9%
Simplified3.9%
Taylor expanded in x around inf 8.5%
Final simplification34.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 1400000.0)
(-
(+ (+ (sqrt (+ z 1.0)) 2.0) (* 0.5 y))
(+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
1.0
(- (+ (sqrt (+ 1.0 y)) (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1400000.0) {
tmp = ((sqrt((z + 1.0)) + 2.0) + (0.5 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = 1.0 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1400000.0d0) then
tmp = ((sqrt((z + 1.0d0)) + 2.0d0) + (0.5d0 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = 1.0d0 + ((sqrt((1.0d0 + y)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1400000.0) {
tmp = ((Math.sqrt((z + 1.0)) + 2.0) + (0.5 * y)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 1.0 + ((Math.sqrt((1.0 + y)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1400000.0: tmp = ((math.sqrt((z + 1.0)) + 2.0) + (0.5 * y)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = 1.0 + ((math.sqrt((1.0 + y)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1400000.0) tmp = Float64(Float64(Float64(sqrt(Float64(z + 1.0)) + 2.0) + Float64(0.5 * y)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 1400000.0)
tmp = ((sqrt((z + 1.0)) + 2.0) + (0.5 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = 1.0 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1400000.0], N[(N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] + N[(0.5 * y), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + 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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1400000:\\
\;\;\;\;\left(\left(\sqrt{z + 1} + 2\right) + 0.5 \cdot y\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1.4e6Initial 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 27.2%
associate--l+30.5%
Simplified30.5%
Taylor expanded in x around 0 23.5%
Taylor expanded in y around 0 22.3%
associate-+r+22.3%
+-commutative22.3%
*-commutative22.3%
Simplified22.3%
if 1.4e6 < z Initial program 87.7%
associate-+l+87.7%
sub-neg87.7%
sub-neg87.7%
+-commutative87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in t around inf 4.3%
associate--l+19.6%
Simplified19.6%
Taylor expanded in z around inf 20.4%
associate--l+30.5%
Simplified30.5%
Taylor expanded in x around 0 17.2%
associate--l+31.4%
Simplified31.4%
Final simplification26.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 450000.0)
(+ 2.0 (- (sqrt (+ z 1.0)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
1.0
(- (+ (sqrt (+ 1.0 y)) (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 450000.0) {
tmp = 2.0 + (sqrt((z + 1.0)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = 1.0 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 450000.0d0) then
tmp = 2.0d0 + (sqrt((z + 1.0d0)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = 1.0d0 + ((sqrt((1.0d0 + y)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 450000.0) {
tmp = 2.0 + (Math.sqrt((z + 1.0)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = 1.0 + ((Math.sqrt((1.0 + y)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 450000.0: tmp = 2.0 + (math.sqrt((z + 1.0)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = 1.0 + ((math.sqrt((1.0 + y)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 450000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 450000.0)
tmp = 2.0 + (sqrt((z + 1.0)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = 1.0 + ((sqrt((1.0 + y)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 450000.0], N[(2.0 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + 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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 450000:\\
\;\;\;\;2 + \left(\sqrt{z + 1} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 4.5e5Initial 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 27.2%
associate--l+30.5%
Simplified30.5%
Taylor expanded in x around 0 23.5%
Taylor expanded in y around 0 20.5%
associate--l+20.5%
Simplified20.5%
if 4.5e5 < z Initial program 87.7%
associate-+l+87.7%
sub-neg87.7%
sub-neg87.7%
+-commutative87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in t around inf 4.3%
associate--l+19.6%
Simplified19.6%
Taylor expanded in z around inf 20.4%
associate--l+30.5%
Simplified30.5%
Taylor expanded in x around 0 17.2%
associate--l+31.4%
Simplified31.4%
Final simplification25.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 2.2e-22)
(+ 2.0 (- (sqrt (+ z 1.0)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(if (<= y 42000000.0)
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(- (+ (sqrt (+ 1.0 x)) (* 0.5 (sqrt (/ 1.0 y)))) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.2e-22) {
tmp = 2.0 + (sqrt((z + 1.0)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else if (y <= 42000000.0) {
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = (sqrt((1.0 + x)) + (0.5 * sqrt((1.0 / y)))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.2d-22) then
tmp = 2.0d0 + (sqrt((z + 1.0d0)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else if (y <= 42000000.0d0) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = (sqrt((1.0d0 + x)) + (0.5d0 * sqrt((1.0d0 / y)))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.2e-22) {
tmp = 2.0 + (Math.sqrt((z + 1.0)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else if (y <= 42000000.0) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (Math.sqrt((1.0 + x)) + (0.5 * Math.sqrt((1.0 / y)))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.2e-22: tmp = 2.0 + (math.sqrt((z + 1.0)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) elif y <= 42000000.0: tmp = 1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (math.sqrt((1.0 + x)) + (0.5 * math.sqrt((1.0 / y)))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.2e-22) tmp = Float64(2.0 + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); elseif (y <= 42000000.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(sqrt(Float64(1.0 + x)) + Float64(0.5 * sqrt(Float64(1.0 / y)))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.2e-22)
tmp = 2.0 + (sqrt((z + 1.0)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
elseif (y <= 42000000.0)
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = (sqrt((1.0 + x)) + (0.5 * sqrt((1.0 / y)))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.2e-22], N[(2.0 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 42000000.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{-22}:\\
\;\;\;\;2 + \left(\sqrt{z + 1} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 42000000:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + x} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.2000000000000001e-22Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in t around inf 24.8%
associate--l+28.5%
Simplified28.5%
Taylor expanded in x around 0 20.7%
Taylor expanded in y around 0 20.7%
associate--l+39.6%
Simplified39.6%
if 2.2000000000000001e-22 < y < 4.2e7Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in t around inf 31.5%
associate--l+34.6%
Simplified34.6%
Taylor expanded in z around inf 22.8%
associate--l+22.8%
Simplified22.8%
Taylor expanded in x around 0 20.6%
associate--l+20.6%
Simplified20.6%
if 4.2e7 < y Initial program 87.4%
associate-+l+87.4%
sub-neg87.4%
sub-neg87.4%
+-commutative87.4%
+-commutative87.4%
+-commutative87.4%
Simplified87.4%
Taylor expanded in t around inf 5.4%
associate--l+20.8%
Simplified20.8%
Taylor expanded in z around inf 4.5%
associate--l+18.9%
Simplified18.9%
Taylor expanded in y around inf 18.9%
Final simplification29.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 (<= x 1.0) (+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))) (/ (+ (* -0.125 (sqrt (/ 1.0 x))) (* 0.5 (sqrt x))) x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = ((-0.125 * sqrt((1.0 / x))) + (0.5 * sqrt(x))) / 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.0d0) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = (((-0.125d0) * sqrt((1.0d0 / x))) + (0.5d0 * sqrt(x))) / 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.0) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = ((-0.125 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt(x))) / x;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.0: tmp = 1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = ((-0.125 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt(x))) / x return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(x))) / 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.0)
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = ((-0.125 * sqrt((1.0 / x))) + (0.5 * sqrt(x))) / 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.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.125 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{x}}{x}\\
\end{array}
\end{array}
if x < 1Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 27.1%
associate--l+43.7%
Simplified43.7%
Taylor expanded in z around inf 24.0%
associate--l+36.7%
Simplified36.7%
Taylor expanded in x around 0 24.0%
associate--l+36.7%
Simplified36.7%
if 1 < x Initial program 88.0%
associate-+l+88.0%
sub-neg88.0%
sub-neg88.0%
+-commutative88.0%
+-commutative88.0%
+-commutative88.0%
Simplified88.0%
Taylor expanded in t around inf 6.6%
associate--l+8.6%
Simplified8.6%
Taylor expanded in x around inf 3.9%
neg-mul-13.9%
Simplified3.9%
Taylor expanded in x around inf 8.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 70000000.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 <= 70000000.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 <= 70000000.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 <= 70000000.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 <= 70000000.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 <= 70000000.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 <= 70000000.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, 70000000.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 70000000:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 7e7Initial 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 27.8%
associate--l+44.1%
Simplified44.1%
Taylor expanded in x around inf 25.2%
neg-mul-125.2%
Simplified25.2%
unsub-neg25.2%
Applied egg-rr25.2%
if 7e7 < x Initial program 87.7%
associate-+l+87.7%
sub-neg87.7%
sub-neg87.7%
+-commutative87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in t around inf 5.3%
associate--l+7.2%
Simplified7.2%
Taylor expanded in x around inf 3.6%
neg-mul-13.6%
Simplified3.6%
Taylor expanded in x around inf 8.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 1.0) (- (+ 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 <= 1.0) {
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 <= 1.0d0) 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 <= 1.0) {
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 <= 1.0: 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 <= 1.0) tmp = Float64(Float64(1.0 + 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 <= 1.0)
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, 1.0], N[(N[(1.0 + N[(x * N[(0.5 + N[(x * -0.125), $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:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot -0.125\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 27.1%
associate--l+43.7%
Simplified43.7%
Taylor expanded in x around inf 25.5%
neg-mul-125.5%
Simplified25.5%
Taylor expanded in x around 0 25.5%
if 1 < x Initial program 88.0%
associate-+l+88.0%
sub-neg88.0%
sub-neg88.0%
+-commutative88.0%
+-commutative88.0%
+-commutative88.0%
Simplified88.0%
Taylor expanded in t around inf 6.6%
associate--l+8.6%
Simplified8.6%
Taylor expanded in x around inf 3.9%
neg-mul-13.9%
Simplified3.9%
Taylor expanded in x around inf 8.5%
Final simplification16.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 8.0) (- (+ 1.0 (* 0.5 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 <= 8.0) {
tmp = (1.0 + (0.5 * 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 <= 8.0d0) then
tmp = (1.0d0 + (0.5d0 * 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 <= 8.0) {
tmp = (1.0 + (0.5 * 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 <= 8.0: tmp = (1.0 + (0.5 * 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 <= 8.0) tmp = Float64(Float64(1.0 + Float64(0.5 * 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 <= 8.0)
tmp = (1.0 + (0.5 * 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, 8.0], N[(N[(1.0 + N[(0.5 * 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 8:\\
\;\;\;\;\left(1 + 0.5 \cdot x\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 8Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 27.0%
associate--l+43.5%
Simplified43.5%
Taylor expanded in x around inf 25.4%
neg-mul-125.4%
Simplified25.4%
Taylor expanded in x around 0 25.5%
if 8 < x Initial program 87.9%
associate-+l+87.9%
sub-neg87.9%
sub-neg87.9%
+-commutative87.9%
+-commutative87.9%
+-commutative87.9%
Simplified87.9%
Taylor expanded in t around inf 6.6%
associate--l+8.5%
Simplified8.5%
Taylor expanded in x around inf 3.9%
neg-mul-13.9%
Simplified3.9%
Taylor expanded in x around inf 8.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.0205) (- 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.0205) {
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.0205d0) 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.0205) {
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.0205: 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.0205) 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.0205)
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.0205], 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.0205:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.0205000000000000009Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 27.1%
associate--l+43.7%
Simplified43.7%
Taylor expanded in x around inf 25.5%
neg-mul-125.5%
Simplified25.5%
Taylor expanded in x around 0 25.5%
if 0.0205000000000000009 < x Initial program 88.0%
associate-+l+88.0%
sub-neg88.0%
sub-neg88.0%
+-commutative88.0%
+-commutative88.0%
+-commutative88.0%
Simplified88.0%
Taylor expanded in t around inf 6.6%
associate--l+8.6%
Simplified8.6%
Taylor expanded in x around inf 3.9%
neg-mul-13.9%
Simplified3.9%
Taylor expanded in x around inf 8.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (sqrt 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 92.6%
associate-+l+92.6%
sub-neg92.6%
sub-neg92.6%
+-commutative92.6%
+-commutative92.6%
+-commutative92.6%
Simplified92.6%
Taylor expanded in t around inf 16.4%
associate--l+25.3%
Simplified25.3%
Taylor expanded in x around inf 14.2%
neg-mul-114.2%
Simplified14.2%
Taylor expanded in x around 0 12.9%
(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 2024145
(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))))