
(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 (+ 1.0 z)) (sqrt z)))
(t_2 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_3 (sqrt (+ 1.0 y)))
(t_4 (+ t_1 (+ t_2 (- t_3 (sqrt y)))))
(t_5 (sqrt (+ 1.0 t)))
(t_6 (- t_5 (sqrt t))))
(if (<= t_4 0.0)
(+ (+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y)))) (+ t_1 t_6))
(if (<= t_4 2.01)
(+ (+ t_2 (/ 1.0 (+ t_3 (sqrt y)))) (+ t_6 (* 0.5 (sqrt (/ 1.0 z)))))
(+
(+ 1.0 (- t_3 (+ (sqrt x) (sqrt y))))
(+ t_1 (/ 1.0 (+ t_5 (sqrt t)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double t_2 = sqrt((x + 1.0)) - sqrt(x);
double t_3 = sqrt((1.0 + y));
double t_4 = t_1 + (t_2 + (t_3 - sqrt(y)));
double t_5 = sqrt((1.0 + t));
double t_6 = t_5 - sqrt(t);
double tmp;
if (t_4 <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + (t_1 + t_6);
} else if (t_4 <= 2.01) {
tmp = (t_2 + (1.0 / (t_3 + sqrt(y)))) + (t_6 + (0.5 * sqrt((1.0 / z))));
} else {
tmp = (1.0 + (t_3 - (sqrt(x) + sqrt(y)))) + (t_1 + (1.0 / (t_5 + 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) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((x + 1.0d0)) - sqrt(x)
t_3 = sqrt((1.0d0 + y))
t_4 = t_1 + (t_2 + (t_3 - sqrt(y)))
t_5 = sqrt((1.0d0 + t))
t_6 = t_5 - sqrt(t)
if (t_4 <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + (t_1 + t_6)
else if (t_4 <= 2.01d0) then
tmp = (t_2 + (1.0d0 / (t_3 + sqrt(y)))) + (t_6 + (0.5d0 * sqrt((1.0d0 / z))))
else
tmp = (1.0d0 + (t_3 - (sqrt(x) + sqrt(y)))) + (t_1 + (1.0d0 / (t_5 + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_3 = Math.sqrt((1.0 + y));
double t_4 = t_1 + (t_2 + (t_3 - Math.sqrt(y)));
double t_5 = Math.sqrt((1.0 + t));
double t_6 = t_5 - Math.sqrt(t);
double tmp;
if (t_4 <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + (t_1 + t_6);
} else if (t_4 <= 2.01) {
tmp = (t_2 + (1.0 / (t_3 + Math.sqrt(y)))) + (t_6 + (0.5 * Math.sqrt((1.0 / z))));
} else {
tmp = (1.0 + (t_3 - (Math.sqrt(x) + Math.sqrt(y)))) + (t_1 + (1.0 / (t_5 + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) t_2 = math.sqrt((x + 1.0)) - math.sqrt(x) t_3 = math.sqrt((1.0 + y)) t_4 = t_1 + (t_2 + (t_3 - math.sqrt(y))) t_5 = math.sqrt((1.0 + t)) t_6 = t_5 - math.sqrt(t) tmp = 0 if t_4 <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + (t_1 + t_6) elif t_4 <= 2.01: tmp = (t_2 + (1.0 / (t_3 + math.sqrt(y)))) + (t_6 + (0.5 * math.sqrt((1.0 / z)))) else: tmp = (1.0 + (t_3 - (math.sqrt(x) + math.sqrt(y)))) + (t_1 + (1.0 / (t_5 + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_3 = sqrt(Float64(1.0 + y)) t_4 = Float64(t_1 + Float64(t_2 + Float64(t_3 - sqrt(y)))) t_5 = sqrt(Float64(1.0 + t)) t_6 = Float64(t_5 - sqrt(t)) tmp = 0.0 if (t_4 <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(t_1 + t_6)); elseif (t_4 <= 2.01) tmp = Float64(Float64(t_2 + Float64(1.0 / Float64(t_3 + sqrt(y)))) + Float64(t_6 + Float64(0.5 * sqrt(Float64(1.0 / z))))); else tmp = Float64(Float64(1.0 + Float64(t_3 - Float64(sqrt(x) + sqrt(y)))) + Float64(t_1 + Float64(1.0 / Float64(t_5 + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
t_2 = sqrt((x + 1.0)) - sqrt(x);
t_3 = sqrt((1.0 + y));
t_4 = t_1 + (t_2 + (t_3 - sqrt(y)));
t_5 = sqrt((1.0 + t));
t_6 = t_5 - sqrt(t);
tmp = 0.0;
if (t_4 <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + (t_1 + t_6);
elseif (t_4 <= 2.01)
tmp = (t_2 + (1.0 / (t_3 + sqrt(y)))) + (t_6 + (0.5 * sqrt((1.0 / z))));
else
tmp = (1.0 + (t_3 - (sqrt(x) + sqrt(y)))) + (t_1 + (1.0 / (t_5 + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 + N[(t$95$2 + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, 0.0], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + t$95$6), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2.01], N[(N[(t$95$2 + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$6 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$3 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(t$95$5 + 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 + z} - \sqrt{z}\\
t_2 := \sqrt{x + 1} - \sqrt{x}\\
t_3 := \sqrt{1 + y}\\
t_4 := t\_1 + \left(t\_2 + \left(t\_3 - \sqrt{y}\right)\right)\\
t_5 := \sqrt{1 + t}\\
t_6 := t\_5 - \sqrt{t}\\
\mathbf{if}\;t\_4 \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(t\_1 + t\_6\right)\\
\mathbf{elif}\;t\_4 \leq 2.01:\\
\;\;\;\;\left(t\_2 + \frac{1}{t\_3 + \sqrt{y}}\right) + \left(t\_6 + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(t\_3 - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + \left(t\_1 + \frac{1}{t\_5 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.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))) < 0.0Initial program 59.9%
associate-+l+59.9%
sub-neg59.9%
sub-neg59.9%
+-commutative59.9%
+-commutative59.9%
+-commutative59.9%
Simplified59.9%
flip--59.9%
div-inv59.9%
add-sqr-sqrt41.0%
add-sqr-sqrt59.9%
Applied egg-rr59.9%
associate-*r/59.9%
*-rgt-identity59.9%
associate--l+70.5%
+-inverses70.5%
metadata-eval70.5%
Simplified70.5%
Taylor expanded in x around inf 85.2%
Taylor expanded in y around inf 85.2%
if 0.0 < (+.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))) < 2.0099999999999998Initial program 96.3%
associate-+l+96.3%
sub-neg96.3%
sub-neg96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Simplified96.3%
flip--96.6%
div-inv96.6%
add-sqr-sqrt73.3%
add-sqr-sqrt96.9%
Applied egg-rr96.9%
associate-*r/96.9%
*-rgt-identity96.9%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
Simplified97.5%
Taylor expanded in z around inf 54.3%
if 2.0099999999999998 < (+.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))) Initial program 99.0%
associate-+l+99.0%
sub-neg99.0%
sub-neg99.0%
+-commutative99.0%
+-commutative99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in x around 0 97.6%
associate--l+97.6%
Simplified97.6%
flip--97.6%
div-inv97.6%
add-sqr-sqrt79.7%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.6%
*-rgt-identity97.6%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
Simplified98.4%
Final simplification63.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_1 0.0)
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (- t_2 (sqrt z)) t_3))
(+
(+ t_1 (- (sqrt (+ 1.0 y)) (sqrt y)))
(+ t_3 (/ 1.0 (+ t_2 (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_1 <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
} else {
tmp = (t_1 + (sqrt((1.0 + y)) - sqrt(y))) + (t_3 + (1.0 / (t_2 + 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((x + 1.0d0)) - sqrt(x)
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_1 <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((t_2 - sqrt(z)) + t_3)
else
tmp = (t_1 + (sqrt((1.0d0 + y)) - sqrt(y))) + (t_3 + (1.0d0 / (t_2 + 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((x + 1.0)) - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_1 <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + ((t_2 - Math.sqrt(z)) + t_3);
} else {
tmp = (t_1 + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + (t_3 + (1.0 / (t_2 + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_1 <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + ((t_2 - math.sqrt(z)) + t_3) else: tmp = (t_1 + (math.sqrt((1.0 + y)) - math.sqrt(y))) + (t_3 + (1.0 / (t_2 + 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(x + 1.0)) - sqrt(x)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(t_2 - sqrt(z)) + t_3)); else tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(t_3 + Float64(1.0 / Float64(t_2 + 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((x + 1.0)) - sqrt(x);
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_1 <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
else
tmp = (t_1 + (sqrt((1.0 + y)) - sqrt(y))) + (t_3 + (1.0 / (t_2 + 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[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(t$95$2 + 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{x + 1} - \sqrt{x}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(\left(t\_2 - \sqrt{z}\right) + t\_3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(t\_3 + \frac{1}{t\_2 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 88.4%
associate-+l+88.4%
sub-neg88.4%
sub-neg88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
Simplified88.4%
flip--88.3%
div-inv88.3%
add-sqr-sqrt72.7%
add-sqr-sqrt89.0%
Applied egg-rr89.0%
associate-*r/89.0%
*-rgt-identity89.0%
associate--l+91.6%
+-inverses91.6%
metadata-eval91.6%
Simplified91.6%
Taylor expanded in x around inf 95.8%
Taylor expanded in y around inf 51.2%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
flip--96.9%
div-inv96.9%
add-sqr-sqrt75.6%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
associate-*r/97.1%
*-rgt-identity97.1%
associate--l+97.1%
+-inverses97.1%
metadata-eval97.1%
Simplified97.1%
Final simplification76.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))) (t_2 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.0)
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (- t_1 (sqrt z)) t_2))
(+
(+ t_2 (/ 1.0 (+ t_1 (sqrt z))))
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((t_1 - sqrt(z)) + t_2);
} else {
tmp = (t_2 + (1.0 / (t_1 + sqrt(z)))) + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((t_1 - sqrt(z)) + t_2)
else
tmp = (t_2 + (1.0d0 / (t_1 + sqrt(z)))) + (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + ((t_1 - Math.sqrt(z)) + t_2);
} else {
tmp = (t_2 + (1.0 / (t_1 + Math.sqrt(z)))) + (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + ((t_1 - math.sqrt(z)) + t_2) else: tmp = (t_2 + (1.0 / (t_1 + math.sqrt(z)))) + (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(t_1 - sqrt(z)) + t_2)); else tmp = Float64(Float64(t_2 + Float64(1.0 / Float64(t_1 + sqrt(z)))) + Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + ((t_1 - sqrt(z)) + t_2);
else
tmp = (t_2 + (1.0 / (t_1 + sqrt(z)))) + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(\left(t\_1 - \sqrt{z}\right) + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 + \frac{1}{t\_1 + \sqrt{z}}\right) + \left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 88.4%
associate-+l+88.4%
sub-neg88.4%
sub-neg88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
Simplified88.4%
flip--88.3%
div-inv88.3%
add-sqr-sqrt72.7%
add-sqr-sqrt89.0%
Applied egg-rr89.0%
associate-*r/89.0%
*-rgt-identity89.0%
associate--l+91.6%
+-inverses91.6%
metadata-eval91.6%
Simplified91.6%
Taylor expanded in x around inf 95.8%
Taylor expanded in y around inf 51.2%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial 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 59.4%
associate--l+93.0%
Simplified93.0%
flip--96.9%
div-inv96.9%
add-sqr-sqrt75.6%
add-sqr-sqrt97.1%
Applied egg-rr93.1%
associate-*r/97.1%
*-rgt-identity97.1%
associate--l+97.1%
+-inverses97.1%
metadata-eval97.1%
Simplified93.2%
Final simplification74.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))) (t_2 (sqrt (+ 1.0 t))))
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.0)
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ t_1 (- t_2 (sqrt t))))
(+
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(+ t_1 (/ 1.0 (+ 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((1.0 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + t));
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + (t_1 + (t_2 - sqrt(t)));
} else {
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + (t_1 + (1.0 / (t_2 + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + t))
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + (t_1 + (t_2 - sqrt(t)))
else
tmp = (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))) + (t_1 + (1.0d0 / (t_2 + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + t));
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + (t_1 + (t_2 - Math.sqrt(t)));
} else {
tmp = (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)))) + (t_1 + (1.0 / (t_2 + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + t)) tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + (t_1 + (t_2 - math.sqrt(t))) else: tmp = (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) + (t_1 + (1.0 / (t_2 + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(t_1 + Float64(t_2 - sqrt(t)))); else tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))) + Float64(t_1 + Float64(1.0 / Float64(t_2 + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
t_2 = sqrt((1.0 + t));
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + (t_1 + (t_2 - sqrt(t)));
else
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + (t_1 + (1.0 / (t_2 + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(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[(t$95$1 + N[(1.0 / N[(t$95$2 + 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 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + t}\\
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(t\_1 + \left(t\_2 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + \left(t\_1 + \frac{1}{t\_2 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 88.4%
associate-+l+88.4%
sub-neg88.4%
sub-neg88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
Simplified88.4%
flip--88.3%
div-inv88.3%
add-sqr-sqrt72.7%
add-sqr-sqrt89.0%
Applied egg-rr89.0%
associate-*r/89.0%
*-rgt-identity89.0%
associate--l+91.6%
+-inverses91.6%
metadata-eval91.6%
Simplified91.6%
Taylor expanded in x around inf 95.8%
Taylor expanded in y around inf 51.2%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial 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 59.4%
associate--l+93.0%
Simplified93.0%
flip--93.3%
div-inv93.3%
add-sqr-sqrt74.4%
add-sqr-sqrt93.4%
Applied egg-rr93.4%
associate-*r/93.4%
*-rgt-identity93.4%
associate--l+93.9%
+-inverses93.9%
metadata-eval93.9%
Simplified93.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 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))))
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.0)
(+ (+ (* 0.5 (sqrt (/ 1.0 x))) (* 0.5 (sqrt (/ 1.0 y)))) t_1)
(+ t_1 (+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = (sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t));
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + t_1;
} else {
tmp = t_1 + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (0.5d0 * sqrt((1.0d0 / y)))) + t_1
else
tmp = t_1 + (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t));
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (0.5 * Math.sqrt((1.0 / y)))) + t_1;
} else {
tmp = t_1 + (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = (math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t)) tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + (0.5 * math.sqrt((1.0 / y)))) + t_1 else: tmp = t_1 + (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + t_1); else tmp = Float64(t_1 + Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = (sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t));
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + (0.5 * sqrt((1.0 / y)))) + t_1;
else
tmp = t_1 + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], 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]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\\
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 88.4%
associate-+l+88.4%
sub-neg88.4%
sub-neg88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
Simplified88.4%
flip--88.3%
div-inv88.3%
add-sqr-sqrt72.7%
add-sqr-sqrt89.0%
Applied egg-rr89.0%
associate-*r/89.0%
*-rgt-identity89.0%
associate--l+91.6%
+-inverses91.6%
metadata-eval91.6%
Simplified91.6%
Taylor expanded in x around inf 95.8%
Taylor expanded in y around inf 51.2%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial 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 59.4%
associate--l+93.0%
Simplified93.0%
Final simplification74.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))) (t_2 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 6e-13)
(+ (+ t_2 (- (sqrt (+ 1.0 t)) (sqrt t))) (- 2.0 (+ (sqrt x) (sqrt y))))
(if (<= y 1.75e+33)
(+ t_2 (+ (- t_1 (sqrt x)) (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(/ 1.0 (+ (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((x + 1.0));
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (y <= 6e-13) {
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(x) + sqrt(y)));
} else if (y <= 1.75e+33) {
tmp = t_2 + ((t_1 - sqrt(x)) + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
} else {
tmp = 1.0 / (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) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
if (y <= 6d-13) then
tmp = (t_2 + (sqrt((1.0d0 + t)) - sqrt(t))) + (2.0d0 - (sqrt(x) + sqrt(y)))
else if (y <= 1.75d+33) then
tmp = t_2 + ((t_1 - sqrt(x)) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))))
else
tmp = 1.0d0 / (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((x + 1.0));
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (y <= 6e-13) {
tmp = (t_2 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (2.0 - (Math.sqrt(x) + Math.sqrt(y)));
} else if (y <= 1.75e+33) {
tmp = t_2 + ((t_1 - Math.sqrt(x)) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))));
} else {
tmp = 1.0 / (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((x + 1.0)) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if y <= 6e-13: tmp = (t_2 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (2.0 - (math.sqrt(x) + math.sqrt(y))) elif y <= 1.75e+33: tmp = t_2 + ((t_1 - math.sqrt(x)) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) else: tmp = 1.0 / (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(x + 1.0)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (y <= 6e-13) tmp = Float64(Float64(t_2 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(2.0 - Float64(sqrt(x) + sqrt(y)))); elseif (y <= 1.75e+33) tmp = Float64(t_2 + Float64(Float64(t_1 - sqrt(x)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))); else tmp = Float64(1.0 / 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((x + 1.0));
t_2 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (y <= 6e-13)
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - (sqrt(x) + sqrt(y)));
elseif (y <= 1.75e+33)
tmp = t_2 + ((t_1 - sqrt(x)) + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
else
tmp = 1.0 / (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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6e-13], N[(N[(t$95$2 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e+33], N[(t$95$2 + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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{x + 1}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;y \leq 6 \cdot 10^{-13}:\\
\;\;\;\;\left(t\_2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+33}:\\
\;\;\;\;t\_2 + \left(\left(t\_1 - \sqrt{x}\right) + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 5.99999999999999968e-13Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in x around 0 52.2%
associate--l+52.2%
Simplified52.2%
Taylor expanded in y around 0 52.2%
+-commutative52.2%
Simplified52.2%
if 5.99999999999999968e-13 < y < 1.75000000000000005e33Initial program 88.1%
associate-+l+88.1%
sub-neg88.1%
sub-neg88.1%
+-commutative88.1%
+-commutative88.1%
+-commutative88.1%
Simplified88.1%
flip--90.2%
div-inv90.2%
add-sqr-sqrt82.1%
add-sqr-sqrt93.2%
Applied egg-rr93.2%
associate-*r/93.2%
*-rgt-identity93.2%
associate--l+99.4%
+-inverses99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in t around inf 57.9%
if 1.75000000000000005e33 < y Initial program 89.3%
associate-+l+89.3%
sub-neg89.3%
sub-neg89.3%
+-commutative89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
Taylor expanded in t around inf 3.2%
associate--l+22.3%
Simplified22.3%
Taylor expanded in x around inf 21.7%
mul-1-neg21.7%
Simplified21.7%
expm1-log1p-u21.7%
expm1-undefine21.7%
unsub-neg21.7%
Applied egg-rr21.7%
expm1-define21.7%
Simplified21.7%
expm1-log1p-u21.7%
flip--21.7%
add-sqr-sqrt21.9%
add-sqr-sqrt21.7%
Applied egg-rr21.7%
associate--l+25.9%
+-inverses25.9%
metadata-eval25.9%
+-commutative25.9%
Simplified25.9%
Final simplification41.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 x) (sqrt y))) (t_2 (sqrt (+ 1.0 z))))
(if (<= y 2.1e-64)
(+ (+ (- t_2 (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))) (- 2.0 t_1))
(if (<= y 1.55e+15)
(+ (+ 1.0 (- (sqrt (+ 1.0 y)) t_1)) (/ 1.0 (+ t_2 (sqrt z))))
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double t_2 = sqrt((1.0 + z));
double tmp;
if (y <= 2.1e-64) {
tmp = ((t_2 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - t_1);
} else if (y <= 1.55e+15) {
tmp = (1.0 + (sqrt((1.0 + y)) - t_1)) + (1.0 / (t_2 + sqrt(z)));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((x + 1.0)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
t_2 = sqrt((1.0d0 + z))
if (y <= 2.1d-64) then
tmp = ((t_2 - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (2.0d0 - t_1)
else if (y <= 1.55d+15) then
tmp = (1.0d0 + (sqrt((1.0d0 + y)) - t_1)) + (1.0d0 / (t_2 + sqrt(z)))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 2.1e-64) {
tmp = ((t_2 - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (2.0 - t_1);
} else if (y <= 1.55e+15) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) - t_1)) + (1.0 / (t_2 + Math.sqrt(z)));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) t_2 = math.sqrt((1.0 + z)) tmp = 0 if y <= 2.1e-64: tmp = ((t_2 - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (2.0 - t_1) elif y <= 1.55e+15: tmp = (1.0 + (math.sqrt((1.0 + y)) - t_1)) + (1.0 / (t_2 + math.sqrt(z))) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((x + 1.0))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 2.1e-64) tmp = Float64(Float64(Float64(t_2 - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(2.0 - t_1)); elseif (y <= 1.55e+15) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - t_1)) + Float64(1.0 / Float64(t_2 + sqrt(z)))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
t_2 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 2.1e-64)
tmp = ((t_2 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - t_1);
elseif (y <= 1.55e+15)
tmp = (1.0 + (sqrt((1.0 + y)) - t_1)) + (1.0 / (t_2 + sqrt(z)));
else
tmp = 1.0 / (sqrt(x) + sqrt((x + 1.0)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.1e-64], N[(N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e+15], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 2.1 \cdot 10^{-64}:\\
\;\;\;\;\left(\left(t\_2 - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(2 - t\_1\right)\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} - t\_1\right)\right) + \frac{1}{t\_2 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}}\\
\end{array}
\end{array}
if y < 2.10000000000000011e-64Initial program 98.1%
associate-+l+98.1%
sub-neg98.1%
sub-neg98.1%
+-commutative98.1%
+-commutative98.1%
+-commutative98.1%
Simplified98.1%
Taylor expanded in x around 0 54.0%
associate--l+54.1%
Simplified54.1%
Taylor expanded in y around 0 54.0%
+-commutative54.0%
Simplified54.0%
if 2.10000000000000011e-64 < y < 1.55e15Initial program 93.1%
associate-+l+93.1%
sub-neg93.1%
sub-neg93.1%
+-commutative93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in x around 0 51.0%
associate--l+51.0%
Simplified51.0%
flip--93.1%
div-inv93.1%
add-sqr-sqrt72.9%
add-sqr-sqrt93.1%
Applied egg-rr51.0%
associate-*r/93.1%
*-rgt-identity93.1%
associate--l+93.1%
+-inverses93.1%
metadata-eval93.1%
Simplified51.0%
Taylor expanded in t around inf 37.0%
if 1.55e15 < y Initial program 88.9%
associate-+l+88.9%
sub-neg88.9%
sub-neg88.9%
+-commutative88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in t around inf 4.5%
associate--l+23.4%
Simplified23.4%
Taylor expanded in x around inf 21.8%
mul-1-neg21.8%
Simplified21.8%
expm1-log1p-u21.8%
expm1-undefine21.8%
unsub-neg21.8%
Applied egg-rr21.8%
expm1-define21.8%
Simplified21.8%
expm1-log1p-u21.8%
flip--21.8%
add-sqr-sqrt22.1%
add-sqr-sqrt21.8%
Applied egg-rr21.8%
associate--l+25.8%
+-inverses25.8%
metadata-eval25.8%
+-commutative25.8%
Simplified25.8%
Final simplification38.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 2e-23)
(+
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2e-23) {
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((x + 1.0)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 2d-23) then
tmp = (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2e-23) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 2e-23: tmp = (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((x + 1.0))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 2e-23) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 2e-23)
tmp = (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)))) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
else
tmp = 1.0 / (sqrt(x) + sqrt((x + 1.0)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 2e-23], N[(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[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-23}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}}\\
\end{array}
\end{array}
if x < 1.99999999999999992e-23Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 61.5%
associate--l+97.6%
Simplified97.6%
flip--97.8%
div-inv97.8%
add-sqr-sqrt75.8%
add-sqr-sqrt98.0%
Applied egg-rr97.7%
associate-*r/98.0%
*-rgt-identity98.0%
associate--l+98.0%
+-inverses98.0%
metadata-eval98.0%
Simplified97.7%
Taylor expanded in t around inf 62.0%
if 1.99999999999999992e-23 < x Initial program 88.2%
associate-+l+88.2%
sub-neg88.2%
sub-neg88.2%
+-commutative88.2%
+-commutative88.2%
+-commutative88.2%
Simplified88.2%
Taylor expanded in t around inf 6.1%
associate--l+8.3%
Simplified8.3%
Taylor expanded in x around inf 5.0%
mul-1-neg5.0%
Simplified5.0%
expm1-log1p-u5.0%
expm1-undefine5.0%
unsub-neg5.0%
Applied egg-rr5.0%
expm1-define5.0%
Simplified5.0%
expm1-log1p-u5.0%
flip--5.0%
add-sqr-sqrt5.7%
add-sqr-sqrt5.0%
Applied egg-rr5.0%
associate--l+10.4%
+-inverses10.4%
metadata-eval10.4%
+-commutative10.4%
Simplified10.4%
Final simplification36.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1.55e+15)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))))
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.55e+15) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((x + 1.0)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.55d+15) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.55e+15) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.55e+15: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((x + 1.0))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.55e+15) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.55e+15)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
else
tmp = 1.0 / (sqrt(x) + sqrt((x + 1.0)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.55e+15], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 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[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55 \cdot 10^{+15}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}}\\
\end{array}
\end{array}
if y < 1.55e15Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 53.4%
associate--l+53.5%
Simplified53.5%
Taylor expanded in t around inf 34.6%
if 1.55e15 < y Initial program 88.9%
associate-+l+88.9%
sub-neg88.9%
sub-neg88.9%
+-commutative88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in t around inf 4.5%
associate--l+23.4%
Simplified23.4%
Taylor expanded in x around inf 21.8%
mul-1-neg21.8%
Simplified21.8%
expm1-log1p-u21.8%
expm1-undefine21.8%
unsub-neg21.8%
Applied egg-rr21.8%
expm1-define21.8%
Simplified21.8%
expm1-log1p-u21.8%
flip--21.8%
add-sqr-sqrt22.1%
add-sqr-sqrt21.8%
Applied egg-rr21.8%
associate--l+25.8%
+-inverses25.8%
metadata-eval25.8%
+-commutative25.8%
Simplified25.8%
Final simplification30.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 125000000.0)
(+ 1.0 (- (+ (sqrt (+ 1.0 z)) t_1) (+ (sqrt x) (+ (sqrt z) (sqrt y)))))
(+ 1.0 (- (+ t_1 (* 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 t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 125000000.0) {
tmp = 1.0 + ((sqrt((1.0 + z)) + t_1) - (sqrt(x) + (sqrt(z) + sqrt(y))));
} else {
tmp = 1.0 + ((t_1 + (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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 125000000.0d0) then
tmp = 1.0d0 + ((sqrt((1.0d0 + z)) + t_1) - (sqrt(x) + (sqrt(z) + sqrt(y))))
else
tmp = 1.0d0 + ((t_1 + (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 t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 125000000.0) {
tmp = 1.0 + ((Math.sqrt((1.0 + z)) + t_1) - (Math.sqrt(x) + (Math.sqrt(z) + Math.sqrt(y))));
} else {
tmp = 1.0 + ((t_1 + (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): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 125000000.0: tmp = 1.0 + ((math.sqrt((1.0 + z)) + t_1) - (math.sqrt(x) + (math.sqrt(z) + math.sqrt(y)))) else: tmp = 1.0 + ((t_1 + (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) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 125000000.0) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + t_1) - Float64(sqrt(x) + Float64(sqrt(z) + sqrt(y))))); else tmp = Float64(1.0 + Float64(Float64(t_1 + 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)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 125000000.0)
tmp = 1.0 + ((sqrt((1.0 + z)) + t_1) - (sqrt(x) + (sqrt(z) + sqrt(y))));
else
tmp = 1.0 + ((t_1 + (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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 125000000.0], N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$1 + 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}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 125000000:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + z} + t\_1\right) - \left(\sqrt{x} + \left(\sqrt{z} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1.25e8Initial 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 21.9%
associate--l+26.0%
Simplified26.0%
Taylor expanded in x around 0 27.1%
if 1.25e8 < z Initial program 89.2%
associate-+l+89.2%
sub-neg89.2%
sub-neg89.2%
+-commutative89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
Taylor expanded in t around inf 3.7%
associate--l+22.9%
Simplified22.9%
Taylor expanded in z around inf 35.8%
Taylor expanded in x around 0 21.7%
associate--l+40.4%
Simplified40.4%
Final simplification33.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= y 1e+21)
(- (+ (sqrt (+ 1.0 y)) t_1) (+ (sqrt x) (sqrt y)))
(/ 1.0 (+ (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((x + 1.0));
double tmp;
if (y <= 1e+21) {
tmp = (sqrt((1.0 + y)) + t_1) - (sqrt(x) + sqrt(y));
} else {
tmp = 1.0 / (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((x + 1.0d0))
if (y <= 1d+21) then
tmp = (sqrt((1.0d0 + y)) + t_1) - (sqrt(x) + sqrt(y))
else
tmp = 1.0d0 / (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((x + 1.0));
double tmp;
if (y <= 1e+21) {
tmp = (Math.sqrt((1.0 + y)) + t_1) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = 1.0 / (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((x + 1.0)) tmp = 0 if y <= 1e+21: tmp = (math.sqrt((1.0 + y)) + t_1) - (math.sqrt(x) + math.sqrt(y)) else: tmp = 1.0 / (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(x + 1.0)) tmp = 0.0 if (y <= 1e+21) tmp = Float64(Float64(sqrt(Float64(1.0 + y)) + t_1) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(1.0 / 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((x + 1.0));
tmp = 0.0;
if (y <= 1e+21)
tmp = (sqrt((1.0 + y)) + t_1) - (sqrt(x) + sqrt(y));
else
tmp = 1.0 / (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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1e+21], N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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{x + 1}\\
\mathbf{if}\;y \leq 10^{+21}:\\
\;\;\;\;\left(\sqrt{1 + y} + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 1e21Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in t around inf 21.0%
associate--l+25.7%
Simplified25.7%
Taylor expanded in z around inf 25.5%
if 1e21 < y Initial program 89.2%
associate-+l+89.2%
sub-neg89.2%
sub-neg89.2%
+-commutative89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
Taylor expanded in t around inf 4.5%
associate--l+23.2%
Simplified23.2%
Taylor expanded in x around inf 21.5%
mul-1-neg21.5%
Simplified21.5%
expm1-log1p-u21.5%
expm1-undefine21.5%
unsub-neg21.5%
Applied egg-rr21.5%
expm1-define21.5%
Simplified21.5%
expm1-log1p-u21.5%
flip--21.6%
add-sqr-sqrt21.8%
add-sqr-sqrt21.5%
Applied egg-rr21.5%
associate--l+25.6%
+-inverses25.6%
metadata-eval25.6%
+-commutative25.6%
Simplified25.6%
Final simplification25.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= y 1e+21)
(+ (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))) t_1)
(/ 1.0 (+ (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((x + 1.0));
double tmp;
if (y <= 1e+21) {
tmp = (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))) + t_1;
} else {
tmp = 1.0 / (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((x + 1.0d0))
if (y <= 1d+21) then
tmp = (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))) + t_1
else
tmp = 1.0d0 / (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((x + 1.0));
double tmp;
if (y <= 1e+21) {
tmp = (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))) + t_1;
} else {
tmp = 1.0 / (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((x + 1.0)) tmp = 0 if y <= 1e+21: tmp = (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) + t_1 else: tmp = 1.0 / (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(x + 1.0)) tmp = 0.0 if (y <= 1e+21) tmp = Float64(Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))) + t_1); else tmp = Float64(1.0 / 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((x + 1.0));
tmp = 0.0;
if (y <= 1e+21)
tmp = (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))) + t_1;
else
tmp = 1.0 / (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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1e+21], N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(1.0 / 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{x + 1}\\
\mathbf{if}\;y \leq 10^{+21}:\\
\;\;\;\;\left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 1e21Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in t around inf 21.0%
associate--l+25.7%
Simplified25.7%
Taylor expanded in z around inf 25.5%
associate--l+25.5%
+-commutative25.5%
Simplified25.5%
if 1e21 < y Initial program 89.2%
associate-+l+89.2%
sub-neg89.2%
sub-neg89.2%
+-commutative89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
Taylor expanded in t around inf 4.5%
associate--l+23.2%
Simplified23.2%
Taylor expanded in x around inf 21.5%
mul-1-neg21.5%
Simplified21.5%
expm1-log1p-u21.5%
expm1-undefine21.5%
unsub-neg21.5%
Applied egg-rr21.5%
expm1-define21.5%
Simplified21.5%
expm1-log1p-u21.5%
flip--21.6%
add-sqr-sqrt21.8%
add-sqr-sqrt21.5%
Applied egg-rr21.5%
associate--l+25.6%
+-inverses25.6%
metadata-eval25.6%
+-commutative25.6%
Simplified25.6%
Final simplification25.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= y 2.4)
(+ t_1 (- (+ 1.0 (* 0.5 y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ (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((x + 1.0));
double tmp;
if (y <= 2.4) {
tmp = t_1 + ((1.0 + (0.5 * y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (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((x + 1.0d0))
if (y <= 2.4d0) then
tmp = t_1 + ((1.0d0 + (0.5d0 * y)) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (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((x + 1.0));
double tmp;
if (y <= 2.4) {
tmp = t_1 + ((1.0 + (0.5 * y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (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((x + 1.0)) tmp = 0 if y <= 2.4: tmp = t_1 + ((1.0 + (0.5 * y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (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(x + 1.0)) tmp = 0.0 if (y <= 2.4) tmp = Float64(t_1 + Float64(Float64(1.0 + Float64(0.5 * y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / 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((x + 1.0));
tmp = 0.0;
if (y <= 2.4)
tmp = t_1 + ((1.0 + (0.5 * y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.4], N[(t$95$1 + N[(N[(1.0 + N[(0.5 * y), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / 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{x + 1}\\
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;t\_1 + \left(\left(1 + 0.5 \cdot y\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 2.39999999999999991Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around inf 21.4%
associate--l+25.4%
Simplified25.4%
Taylor expanded in z around inf 22.5%
Taylor expanded in y around 0 22.6%
distribute-lft-out22.6%
Simplified22.6%
Taylor expanded in y around inf 25.6%
*-commutative25.6%
Simplified25.6%
if 2.39999999999999991 < y Initial program 88.7%
associate-+l+88.7%
sub-neg88.7%
sub-neg88.7%
+-commutative88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
Taylor expanded in t around inf 5.4%
associate--l+23.6%
Simplified23.6%
Taylor expanded in x around inf 21.4%
mul-1-neg21.4%
Simplified21.4%
expm1-log1p-u21.4%
expm1-undefine21.4%
unsub-neg21.4%
Applied egg-rr21.4%
expm1-define21.4%
Simplified21.4%
expm1-log1p-u21.4%
flip--21.5%
add-sqr-sqrt21.7%
add-sqr-sqrt21.4%
Applied egg-rr21.4%
associate--l+25.2%
+-inverses25.2%
metadata-eval25.2%
+-commutative25.2%
Simplified25.2%
Final simplification25.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.75) (+ 1.0 (- (* x 0.5) (sqrt x))) (expm1 (/ (- (* (sqrt x) 0.5) 0.125) x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.75) {
tmp = 1.0 + ((x * 0.5) - sqrt(x));
} else {
tmp = expm1((((sqrt(x) * 0.5) - 0.125) / x));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.75) {
tmp = 1.0 + ((x * 0.5) - Math.sqrt(x));
} else {
tmp = Math.expm1((((Math.sqrt(x) * 0.5) - 0.125) / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.75: tmp = 1.0 + ((x * 0.5) - math.sqrt(x)) else: tmp = math.expm1((((math.sqrt(x) * 0.5) - 0.125) / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.75) tmp = Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))); else tmp = expm1(Float64(Float64(Float64(sqrt(x) * 0.5) - 0.125) / x)); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.75], N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Exp[N[(N[(N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision] - 0.125), $MachinePrecision] / x), $MachinePrecision]] - 1), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.75:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\frac{\sqrt{x} \cdot 0.5 - 0.125}{x}\right)\\
\end{array}
\end{array}
if x < 0.75Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around inf 20.0%
associate--l+39.7%
Simplified39.7%
Taylor expanded in x around inf 27.7%
mul-1-neg27.7%
Simplified27.7%
Taylor expanded in x around 0 27.7%
associate--l+27.7%
*-commutative27.7%
Simplified27.7%
if 0.75 < x Initial program 87.6%
associate-+l+87.6%
sub-neg87.6%
sub-neg87.6%
+-commutative87.6%
+-commutative87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in t around inf 5.1%
associate--l+6.7%
Simplified6.7%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
expm1-log1p-u3.5%
expm1-undefine3.5%
unsub-neg3.5%
Applied egg-rr3.5%
expm1-define3.5%
Simplified3.5%
Taylor expanded in x around inf 9.3%
Final simplification19.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 / (sqrt(x) + sqrt((x + 1.0)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 / (math.sqrt(x) + math.sqrt((x + 1.0)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 / (sqrt(x) + sqrt((x + 1.0)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{x} + \sqrt{x + 1}}
\end{array}
Initial program 93.1%
associate-+l+93.1%
sub-neg93.1%
sub-neg93.1%
+-commutative93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in t around inf 13.1%
associate--l+24.5%
Simplified24.5%
Taylor expanded in x around inf 16.6%
mul-1-neg16.6%
Simplified16.6%
expm1-log1p-u16.6%
expm1-undefine16.6%
unsub-neg16.6%
Applied egg-rr16.6%
expm1-define16.6%
Simplified16.6%
expm1-log1p-u16.6%
flip--16.6%
add-sqr-sqrt16.9%
add-sqr-sqrt16.6%
Applied egg-rr16.6%
associate--l+19.2%
+-inverses19.2%
metadata-eval19.2%
+-commutative19.2%
Simplified19.2%
Final simplification19.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 7.5) (+ 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 <= 7.5) {
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 <= 7.5d0) 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 <= 7.5) {
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 <= 7.5: 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 <= 7.5) 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 <= 7.5)
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, 7.5], 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 7.5:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 7.5Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around inf 20.0%
associate--l+39.7%
Simplified39.7%
Taylor expanded in x around inf 27.7%
mul-1-neg27.7%
Simplified27.7%
Taylor expanded in x around 0 27.7%
associate--l+27.7%
*-commutative27.7%
Simplified27.7%
if 7.5 < x Initial program 87.6%
associate-+l+87.6%
sub-neg87.6%
sub-neg87.6%
+-commutative87.6%
+-commutative87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in t around inf 5.1%
associate--l+6.7%
Simplified6.7%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.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 0.075) (- 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.075) {
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.075d0) 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.075) {
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.075: 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.075) 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.075)
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.075], 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.075:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.0749999999999999972Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around inf 20.0%
associate--l+39.7%
Simplified39.7%
Taylor expanded in x around inf 27.7%
mul-1-neg27.7%
Simplified27.7%
Taylor expanded in x around 0 27.7%
if 0.0749999999999999972 < x Initial program 87.6%
associate-+l+87.6%
sub-neg87.6%
sub-neg87.6%
+-commutative87.6%
+-commutative87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in t around inf 5.1%
associate--l+6.7%
Simplified6.7%
Taylor expanded in x around inf 3.5%
mul-1-neg3.5%
Simplified3.5%
Taylor expanded in x around inf 9.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (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 93.1%
associate-+l+93.1%
sub-neg93.1%
sub-neg93.1%
+-commutative93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in t around inf 13.1%
associate--l+24.5%
Simplified24.5%
Taylor expanded in x around inf 16.6%
mul-1-neg16.6%
Simplified16.6%
Taylor expanded in x around 0 15.5%
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 93.1%
associate-+l+93.1%
sub-neg93.1%
sub-neg93.1%
+-commutative93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in x around 0 40.8%
associate--l+54.0%
Simplified54.0%
flip--93.2%
div-inv93.2%
add-sqr-sqrt72.0%
add-sqr-sqrt93.3%
Applied egg-rr54.1%
associate-*r/93.3%
*-rgt-identity93.3%
associate--l+94.3%
+-inverses94.3%
metadata-eval94.3%
Simplified54.1%
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 2024139
(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))))