
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ (/ x (+ x y)) (+ x y)) (+ 1.0 (+ (/ 1.0 y) (/ x y)))))
assert(x < y);
double code(double x, double y) {
return ((x / (x + y)) / (x + y)) / (1.0 + ((1.0 / y) + (x / y)));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / (x + y)) / (x + y)) / (1.0d0 + ((1.0d0 / y) + (x / y)))
end function
assert x < y;
public static double code(double x, double y) {
return ((x / (x + y)) / (x + y)) / (1.0 + ((1.0 / y) + (x / y)));
}
[x, y] = sort([x, y]) def code(x, y): return ((x / (x + y)) / (x + y)) / (1.0 + ((1.0 / y) + (x / y)))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(x / Float64(x + y)) / Float64(x + y)) / Float64(1.0 + Float64(Float64(1.0 / y) + Float64(x / y)))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((x / (x + y)) / (x + y)) / (1.0 + ((1.0 / y) + (x / y)));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(1.0 / y), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{\frac{x}{x + y}}{x + y}}{1 + \left(\frac{1}{y} + \frac{x}{y}\right)}
\end{array}
Initial program 66.3%
associate-/l*79.9%
associate-+l+79.9%
Simplified79.9%
clear-num79.8%
associate-+r+79.8%
*-commutative79.8%
distribute-rgt1-in64.2%
cube-mult64.2%
un-div-inv64.3%
cube-mult64.3%
distribute-rgt1-in79.8%
*-commutative79.8%
associate-/l*83.3%
pow283.3%
+-commutative83.3%
Applied egg-rr83.3%
associate-/r*85.7%
+-commutative85.7%
Simplified85.7%
*-un-lft-identity85.7%
unpow285.7%
times-frac99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in y around inf 99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x y))))
(if (<= x -7.5e+172)
(/ (/ 1.0 x) (/ (+ y (+ x 1.0)) y))
(if (<= x -9.2e-8)
(* t_0 (/ y (* (+ x y) (+ x y))))
(if (<= x -1.6e-287)
(* t_0 (/ y (+ x y)))
(/ (/ x (+ y 1.0)) (+ x y)))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -7.5e+172) {
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
} else if (x <= -9.2e-8) {
tmp = t_0 * (y / ((x + y) * (x + y)));
} else if (x <= -1.6e-287) {
tmp = t_0 * (y / (x + y));
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + y)
if (x <= (-7.5d+172)) then
tmp = (1.0d0 / x) / ((y + (x + 1.0d0)) / y)
else if (x <= (-9.2d-8)) then
tmp = t_0 * (y / ((x + y) * (x + y)))
else if (x <= (-1.6d-287)) then
tmp = t_0 * (y / (x + y))
else
tmp = (x / (y + 1.0d0)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -7.5e+172) {
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
} else if (x <= -9.2e-8) {
tmp = t_0 * (y / ((x + y) * (x + y)));
} else if (x <= -1.6e-287) {
tmp = t_0 * (y / (x + y));
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) tmp = 0 if x <= -7.5e+172: tmp = (1.0 / x) / ((y + (x + 1.0)) / y) elif x <= -9.2e-8: tmp = t_0 * (y / ((x + y) * (x + y))) elif x <= -1.6e-287: tmp = t_0 * (y / (x + y)) else: tmp = (x / (y + 1.0)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (x <= -7.5e+172) tmp = Float64(Float64(1.0 / x) / Float64(Float64(y + Float64(x + 1.0)) / y)); elseif (x <= -9.2e-8) tmp = Float64(t_0 * Float64(y / Float64(Float64(x + y) * Float64(x + y)))); elseif (x <= -1.6e-287) tmp = Float64(t_0 * Float64(y / Float64(x + y))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (x + y);
tmp = 0.0;
if (x <= -7.5e+172)
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
elseif (x <= -9.2e-8)
tmp = t_0 * (y / ((x + y) * (x + y)));
elseif (x <= -1.6e-287)
tmp = t_0 * (y / (x + y));
else
tmp = (x / (y + 1.0)) / (x + y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e+172], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.2e-8], N[(t$95$0 * N[(y / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.6e-287], N[(t$95$0 * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{+172}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{y + \left(x + 1\right)}{y}}\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-8}:\\
\;\;\;\;t\_0 \cdot \frac{y}{\left(x + y\right) \cdot \left(x + y\right)}\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-287}:\\
\;\;\;\;t\_0 \cdot \frac{y}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{x + y}\\
\end{array}
\end{array}
if x < -7.4999999999999994e172Initial program 73.7%
associate-/l*82.1%
associate-+l+82.1%
Simplified82.1%
clear-num82.1%
associate-+r+82.1%
*-commutative82.1%
distribute-rgt1-in0.7%
cube-mult0.7%
un-div-inv0.7%
cube-mult0.7%
distribute-rgt1-in82.1%
*-commutative82.1%
associate-/l*82.1%
pow282.1%
+-commutative82.1%
Applied egg-rr82.1%
associate-/r*82.1%
+-commutative82.1%
Simplified82.1%
Taylor expanded in x around inf 93.6%
if -7.4999999999999994e172 < x < -9.2000000000000003e-8Initial program 61.1%
associate-*l*61.1%
times-frac91.0%
+-commutative91.0%
+-commutative91.0%
associate-+r+91.0%
+-commutative91.0%
associate-+l+91.0%
Applied egg-rr91.0%
Taylor expanded in x around inf 89.8%
if -9.2000000000000003e-8 < x < -1.60000000000000009e-287Initial program 70.8%
Taylor expanded in x around 0 69.3%
Taylor expanded in y around 0 49.8%
*-rgt-identity49.8%
*-commutative49.8%
*-rgt-identity49.8%
*-rgt-identity49.8%
+-commutative49.8%
+-commutative49.8%
times-frac72.6%
+-commutative72.6%
+-commutative72.6%
Applied egg-rr72.6%
if -1.60000000000000009e-287 < x Initial program 64.2%
associate-*l*64.2%
times-frac93.1%
+-commutative93.1%
+-commutative93.1%
associate-+r+93.1%
+-commutative93.1%
associate-+l+93.1%
Applied egg-rr93.1%
Taylor expanded in x around 0 49.5%
+-commutative49.5%
Simplified49.5%
associate-*l/49.5%
un-div-inv49.5%
+-commutative49.5%
Applied egg-rr49.5%
Final simplification64.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x y))))
(if (<= x -6.2e+174)
(/ (/ 1.0 x) (/ (+ y (+ x 1.0)) y))
(if (<= x -1.0)
(* t_0 (/ y (* (+ x y) (+ x y))))
(* (/ y (+ x y)) (/ t_0 (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -6.2e+174) {
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
} else if (x <= -1.0) {
tmp = t_0 * (y / ((x + y) * (x + y)));
} else {
tmp = (y / (x + y)) * (t_0 / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + y)
if (x <= (-6.2d+174)) then
tmp = (1.0d0 / x) / ((y + (x + 1.0d0)) / y)
else if (x <= (-1.0d0)) then
tmp = t_0 * (y / ((x + y) * (x + y)))
else
tmp = (y / (x + y)) * (t_0 / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -6.2e+174) {
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
} else if (x <= -1.0) {
tmp = t_0 * (y / ((x + y) * (x + y)));
} else {
tmp = (y / (x + y)) * (t_0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) tmp = 0 if x <= -6.2e+174: tmp = (1.0 / x) / ((y + (x + 1.0)) / y) elif x <= -1.0: tmp = t_0 * (y / ((x + y) * (x + y))) else: tmp = (y / (x + y)) * (t_0 / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (x <= -6.2e+174) tmp = Float64(Float64(1.0 / x) / Float64(Float64(y + Float64(x + 1.0)) / y)); elseif (x <= -1.0) tmp = Float64(t_0 * Float64(y / Float64(Float64(x + y) * Float64(x + y)))); else tmp = Float64(Float64(y / Float64(x + y)) * Float64(t_0 / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (x + y);
tmp = 0.0;
if (x <= -6.2e+174)
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
elseif (x <= -1.0)
tmp = t_0 * (y / ((x + y) * (x + y)));
else
tmp = (y / (x + y)) * (t_0 / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e+174], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.0], N[(t$95$0 * N[(y / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{+174}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{y + \left(x + 1\right)}{y}}\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;t\_0 \cdot \frac{y}{\left(x + y\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{t\_0}{y + 1}\\
\end{array}
\end{array}
if x < -6.2e174Initial program 73.7%
associate-/l*82.1%
associate-+l+82.1%
Simplified82.1%
clear-num82.1%
associate-+r+82.1%
*-commutative82.1%
distribute-rgt1-in0.7%
cube-mult0.7%
un-div-inv0.7%
cube-mult0.7%
distribute-rgt1-in82.1%
*-commutative82.1%
associate-/l*82.1%
pow282.1%
+-commutative82.1%
Applied egg-rr82.1%
associate-/r*82.1%
+-commutative82.1%
Simplified82.1%
Taylor expanded in x around inf 93.6%
if -6.2e174 < x < -1Initial program 59.8%
associate-*l*59.8%
times-frac90.7%
+-commutative90.7%
+-commutative90.7%
associate-+r+90.7%
+-commutative90.7%
associate-+l+90.7%
Applied egg-rr90.7%
Taylor expanded in x around inf 89.5%
if -1 < x Initial program 66.2%
Taylor expanded in x around 0 59.8%
associate-*l*59.8%
+-commutative59.8%
times-frac85.3%
+-commutative85.3%
Applied egg-rr85.3%
associate-*r/85.3%
associate-*l/60.0%
associate-*r/85.3%
*-commutative85.3%
associate-*r/85.3%
associate-/r*85.9%
Simplified85.9%
Final simplification87.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -3.8e-13)
(/ (/ 1.0 x) (/ (+ y (+ x 1.0)) y))
(if (<= x -1.65e-285)
(* (/ x (+ x y)) (/ y (+ x y)))
(/ (/ x (+ y 1.0)) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.8e-13) {
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
} else if (x <= -1.65e-285) {
tmp = (x / (x + y)) * (y / (x + y));
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.8d-13)) then
tmp = (1.0d0 / x) / ((y + (x + 1.0d0)) / y)
else if (x <= (-1.65d-285)) then
tmp = (x / (x + y)) * (y / (x + y))
else
tmp = (x / (y + 1.0d0)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.8e-13) {
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
} else if (x <= -1.65e-285) {
tmp = (x / (x + y)) * (y / (x + y));
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.8e-13: tmp = (1.0 / x) / ((y + (x + 1.0)) / y) elif x <= -1.65e-285: tmp = (x / (x + y)) * (y / (x + y)) else: tmp = (x / (y + 1.0)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.8e-13) tmp = Float64(Float64(1.0 / x) / Float64(Float64(y + Float64(x + 1.0)) / y)); elseif (x <= -1.65e-285) tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(x + y))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.8e-13)
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
elseif (x <= -1.65e-285)
tmp = (x / (x + y)) * (y / (x + y));
else
tmp = (x / (y + 1.0)) / (x + y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -3.8e-13], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.65e-285], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-13}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{y + \left(x + 1\right)}{y}}\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-285}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{y}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{x + y}\\
\end{array}
\end{array}
if x < -3.8e-13Initial program 68.6%
associate-/l*75.8%
associate-+l+75.8%
Simplified75.8%
clear-num75.7%
associate-+r+75.7%
*-commutative75.7%
distribute-rgt1-in32.4%
cube-mult32.4%
un-div-inv32.5%
cube-mult32.4%
distribute-rgt1-in75.7%
*-commutative75.7%
associate-/l*83.0%
pow283.0%
+-commutative83.0%
Applied egg-rr83.0%
associate-/r*87.4%
+-commutative87.4%
Simplified87.4%
Taylor expanded in x around inf 75.4%
if -3.8e-13 < x < -1.64999999999999993e-285Initial program 68.6%
Taylor expanded in x around 0 68.6%
Taylor expanded in y around 0 49.3%
*-rgt-identity49.3%
*-commutative49.3%
*-rgt-identity49.3%
*-rgt-identity49.3%
+-commutative49.3%
+-commutative49.3%
times-frac74.0%
+-commutative74.0%
+-commutative74.0%
Applied egg-rr74.0%
if -1.64999999999999993e-285 < x Initial program 64.5%
associate-*l*64.5%
times-frac93.2%
+-commutative93.2%
+-commutative93.2%
associate-+r+93.2%
+-commutative93.2%
associate-+l+93.2%
Applied egg-rr93.2%
Taylor expanded in x around 0 49.8%
+-commutative49.8%
Simplified49.8%
associate-*l/49.8%
un-div-inv49.9%
+-commutative49.9%
Applied egg-rr49.9%
Final simplification61.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.65e-13)
(/ (/ y x) (+ x 1.0))
(if (<= x -1e-286)
(* (/ x (+ x y)) (/ y (+ x y)))
(/ (/ x (+ y 1.0)) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.65e-13) {
tmp = (y / x) / (x + 1.0);
} else if (x <= -1e-286) {
tmp = (x / (x + y)) * (y / (x + y));
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.65d-13)) then
tmp = (y / x) / (x + 1.0d0)
else if (x <= (-1d-286)) then
tmp = (x / (x + y)) * (y / (x + y))
else
tmp = (x / (y + 1.0d0)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.65e-13) {
tmp = (y / x) / (x + 1.0);
} else if (x <= -1e-286) {
tmp = (x / (x + y)) * (y / (x + y));
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.65e-13: tmp = (y / x) / (x + 1.0) elif x <= -1e-286: tmp = (x / (x + y)) * (y / (x + y)) else: tmp = (x / (y + 1.0)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.65e-13) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (x <= -1e-286) tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(x + y))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.65e-13)
tmp = (y / x) / (x + 1.0);
elseif (x <= -1e-286)
tmp = (x / (x + y)) * (y / (x + y));
else
tmp = (x / (y + 1.0)) / (x + y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2.65e-13], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1e-286], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.65 \cdot 10^{-13}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-286}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{y}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{x + y}\\
\end{array}
\end{array}
if x < -2.6499999999999998e-13Initial program 68.6%
associate-/l*75.8%
associate-+l+75.8%
Simplified75.8%
Taylor expanded in y around 0 71.3%
associate-/r*74.9%
+-commutative74.9%
Simplified74.9%
if -2.6499999999999998e-13 < x < -1.00000000000000005e-286Initial program 69.2%
Taylor expanded in x around 0 69.1%
Taylor expanded in y around 0 48.5%
*-rgt-identity48.5%
*-commutative48.5%
*-rgt-identity48.5%
*-rgt-identity48.5%
+-commutative48.5%
+-commutative48.5%
times-frac72.7%
+-commutative72.7%
+-commutative72.7%
Applied egg-rr72.7%
if -1.00000000000000005e-286 < x Initial program 64.2%
associate-*l*64.2%
times-frac93.1%
+-commutative93.1%
+-commutative93.1%
associate-+r+93.1%
+-commutative93.1%
associate-+l+93.1%
Applied egg-rr93.1%
Taylor expanded in x around 0 49.5%
+-commutative49.5%
Simplified49.5%
associate-*l/49.5%
un-div-inv49.5%
+-commutative49.5%
Applied egg-rr49.5%
Final simplification60.5%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x y))))
(if (<= x -1.0)
(/ (/ t_0 (+ x y)) (+ 1.0 (/ x y)))
(* (/ y (+ x y)) (/ t_0 (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -1.0) {
tmp = (t_0 / (x + y)) / (1.0 + (x / y));
} else {
tmp = (y / (x + y)) * (t_0 / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + y)
if (x <= (-1.0d0)) then
tmp = (t_0 / (x + y)) / (1.0d0 + (x / y))
else
tmp = (y / (x + y)) * (t_0 / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -1.0) {
tmp = (t_0 / (x + y)) / (1.0 + (x / y));
} else {
tmp = (y / (x + y)) * (t_0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) tmp = 0 if x <= -1.0: tmp = (t_0 / (x + y)) / (1.0 + (x / y)) else: tmp = (y / (x + y)) * (t_0 / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(t_0 / Float64(x + y)) / Float64(1.0 + Float64(x / y))); else tmp = Float64(Float64(y / Float64(x + y)) * Float64(t_0 / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (x + y);
tmp = 0.0;
if (x <= -1.0)
tmp = (t_0 / (x + y)) / (1.0 + (x / y));
else
tmp = (y / (x + y)) * (t_0 / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], N[(N[(t$95$0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{\frac{t\_0}{x + y}}{1 + \frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{t\_0}{y + 1}\\
\end{array}
\end{array}
if x < -1Initial program 66.5%
associate-/l*74.2%
associate-+l+74.2%
Simplified74.2%
clear-num74.1%
associate-+r+74.1%
*-commutative74.1%
distribute-rgt1-in29.6%
cube-mult29.6%
un-div-inv29.7%
cube-mult29.6%
distribute-rgt1-in74.2%
*-commutative74.2%
associate-/l*81.9%
pow281.9%
+-commutative81.9%
Applied egg-rr81.9%
associate-/r*86.6%
+-commutative86.6%
Simplified86.6%
*-un-lft-identity86.6%
unpow286.6%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in y around inf 99.8%
Taylor expanded in x around inf 99.2%
if -1 < x Initial program 66.2%
Taylor expanded in x around 0 59.8%
associate-*l*59.8%
+-commutative59.8%
times-frac85.3%
+-commutative85.3%
Applied egg-rr85.3%
associate-*r/85.3%
associate-*l/60.0%
associate-*r/85.3%
*-commutative85.3%
associate-*r/85.3%
associate-/r*85.9%
Simplified85.9%
Final simplification89.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (/ y (* x x)) (if (<= x -4.2e-96) (/ y x) (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = y / (x * x);
} else if (x <= -4.2e-96) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = y / (x * x)
else if (x <= (-4.2d-96)) then
tmp = y / x
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = y / (x * x);
} else if (x <= -4.2e-96) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = y / (x * x) elif x <= -4.2e-96: tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(y / Float64(x * x)); elseif (x <= -4.2e-96) tmp = Float64(y / x); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = y / (x * x);
elseif (x <= -4.2e-96)
tmp = y / x;
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.2e-96], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-96}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1Initial program 66.5%
associate-/l*74.2%
associate-+l+74.2%
Simplified74.2%
clear-num74.1%
associate-+r+74.1%
*-commutative74.1%
distribute-rgt1-in29.6%
cube-mult29.6%
un-div-inv29.7%
cube-mult29.6%
distribute-rgt1-in74.2%
*-commutative74.2%
associate-/l*81.9%
pow281.9%
+-commutative81.9%
Applied egg-rr81.9%
associate-/r*86.6%
+-commutative86.6%
Simplified86.6%
*-un-lft-identity86.6%
unpow286.6%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in y around 0 71.0%
+-commutative71.0%
Simplified71.0%
Taylor expanded in x around inf 70.4%
if -1 < x < -4.20000000000000002e-96Initial program 80.9%
Taylor expanded in x around 0 77.1%
Taylor expanded in y around 0 47.7%
if -4.20000000000000002e-96 < x Initial program 64.4%
associate-/l*80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in x around 0 52.0%
+-commutative52.0%
Simplified52.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ (/ x (+ x y)) (+ x y)) (/ (+ y (+ x 1.0)) y)))
assert(x < y);
double code(double x, double y) {
return ((x / (x + y)) / (x + y)) / ((y + (x + 1.0)) / y);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / (x + y)) / (x + y)) / ((y + (x + 1.0d0)) / y)
end function
assert x < y;
public static double code(double x, double y) {
return ((x / (x + y)) / (x + y)) / ((y + (x + 1.0)) / y);
}
[x, y] = sort([x, y]) def code(x, y): return ((x / (x + y)) / (x + y)) / ((y + (x + 1.0)) / y)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(x / Float64(x + y)) / Float64(x + y)) / Float64(Float64(y + Float64(x + 1.0)) / y)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((x / (x + y)) / (x + y)) / ((y + (x + 1.0)) / y);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{\frac{x}{x + y}}{x + y}}{\frac{y + \left(x + 1\right)}{y}}
\end{array}
Initial program 66.3%
associate-/l*79.9%
associate-+l+79.9%
Simplified79.9%
clear-num79.8%
associate-+r+79.8%
*-commutative79.8%
distribute-rgt1-in64.2%
cube-mult64.2%
un-div-inv64.3%
cube-mult64.3%
distribute-rgt1-in79.8%
*-commutative79.8%
associate-/l*83.3%
pow283.3%
+-commutative83.3%
Applied egg-rr83.3%
associate-/r*85.7%
+-commutative85.7%
Simplified85.7%
*-un-lft-identity85.7%
unpow285.7%
times-frac99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (/ y (* x x)) (if (<= x -4.5e-97) (/ y x) (/ 1.0 (/ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = y / (x * x);
} else if (x <= -4.5e-97) {
tmp = y / x;
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = y / (x * x)
else if (x <= (-4.5d-97)) then
tmp = y / x
else
tmp = 1.0d0 / (y / x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = y / (x * x);
} else if (x <= -4.5e-97) {
tmp = y / x;
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = y / (x * x) elif x <= -4.5e-97: tmp = y / x else: tmp = 1.0 / (y / x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(y / Float64(x * x)); elseif (x <= -4.5e-97) tmp = Float64(y / x); else tmp = Float64(1.0 / Float64(y / x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = y / (x * x);
elseif (x <= -4.5e-97)
tmp = y / x;
else
tmp = 1.0 / (y / x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.5e-97], N[(y / x), $MachinePrecision], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{-97}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < -1Initial program 66.5%
associate-/l*74.2%
associate-+l+74.2%
Simplified74.2%
clear-num74.1%
associate-+r+74.1%
*-commutative74.1%
distribute-rgt1-in29.6%
cube-mult29.6%
un-div-inv29.7%
cube-mult29.6%
distribute-rgt1-in74.2%
*-commutative74.2%
associate-/l*81.9%
pow281.9%
+-commutative81.9%
Applied egg-rr81.9%
associate-/r*86.6%
+-commutative86.6%
Simplified86.6%
*-un-lft-identity86.6%
unpow286.6%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in y around 0 71.0%
+-commutative71.0%
Simplified71.0%
Taylor expanded in x around inf 70.4%
if -1 < x < -4.5000000000000001e-97Initial program 80.9%
Taylor expanded in x around 0 77.1%
Taylor expanded in y around 0 47.7%
if -4.5000000000000001e-97 < x Initial program 64.4%
associate-/l*80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in x around 0 52.0%
+-commutative52.0%
Simplified52.0%
Taylor expanded in y around 0 28.9%
clear-num29.2%
inv-pow29.2%
Applied egg-rr29.2%
unpow-129.2%
Simplified29.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4e-96) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4e-96) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4d-96)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -4e-96) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4e-96: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4e-96) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -4e-96)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -4e-96], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-96}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -3.9999999999999996e-96Initial program 70.4%
associate-/l*79.6%
associate-+l+79.6%
Simplified79.6%
Taylor expanded in y around 0 65.8%
associate-/r*68.6%
+-commutative68.6%
Simplified68.6%
if -3.9999999999999996e-96 < x Initial program 64.4%
associate-/l*80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
div-inv52.0%
associate-/r*54.0%
Applied egg-rr54.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.1e-96) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.1e-96) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.1d-96)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.1e-96) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.1e-96: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.1e-96) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.1e-96)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -3.1e-96], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-96}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -3.0999999999999999e-96Initial program 70.4%
associate-/l*79.6%
associate-+l+79.6%
Simplified79.6%
Taylor expanded in y around 0 65.8%
if -3.0999999999999999e-96 < x Initial program 64.4%
associate-/l*80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
div-inv52.0%
associate-/r*54.0%
Applied egg-rr54.0%
Final simplification57.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4e-96) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4e-96) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4d-96)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -4e-96) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4e-96: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4e-96) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -4e-96)
tmp = y / (x * (x + 1.0));
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -4e-96], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-96}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -3.9999999999999996e-96Initial program 70.4%
associate-/l*79.6%
associate-+l+79.6%
Simplified79.6%
Taylor expanded in y around 0 65.8%
if -3.9999999999999996e-96 < x Initial program 64.4%
associate-/l*80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in x around 0 52.0%
+-commutative52.0%
Simplified52.0%
Final simplification56.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -9.5e-98) (/ 1.0 (/ x y)) (/ 1.0 (/ y x))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9.5e-98) {
tmp = 1.0 / (x / y);
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9.5d-98)) then
tmp = 1.0d0 / (x / y)
else
tmp = 1.0d0 / (y / x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -9.5e-98) {
tmp = 1.0 / (x / y);
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -9.5e-98: tmp = 1.0 / (x / y) else: tmp = 1.0 / (y / x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9.5e-98) tmp = Float64(1.0 / Float64(x / y)); else tmp = Float64(1.0 / Float64(y / x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -9.5e-98)
tmp = 1.0 / (x / y);
else
tmp = 1.0 / (y / x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -9.5e-98], N[(1.0 / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-98}:\\
\;\;\;\;\frac{1}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < -9.5000000000000001e-98Initial program 70.4%
Taylor expanded in x around 0 53.1%
Taylor expanded in y around 0 34.2%
clear-num35.8%
inv-pow35.8%
Applied egg-rr35.8%
unpow-135.8%
Simplified35.8%
if -9.5000000000000001e-98 < x Initial program 64.4%
associate-/l*80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in x around 0 52.0%
+-commutative52.0%
Simplified52.0%
Taylor expanded in y around 0 28.9%
clear-num29.2%
inv-pow29.2%
Applied egg-rr29.2%
unpow-129.2%
Simplified29.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.2e-97) (/ 1.0 (/ x y)) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.2e-97) {
tmp = 1.0 / (x / y);
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.2d-97)) then
tmp = 1.0d0 / (x / y)
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.2e-97) {
tmp = 1.0 / (x / y);
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.2e-97: tmp = 1.0 / (x / y) else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.2e-97) tmp = Float64(1.0 / Float64(x / y)); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.2e-97)
tmp = 1.0 / (x / y);
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -3.2e-97], N[(1.0 / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-97}:\\
\;\;\;\;\frac{1}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -3.1999999999999998e-97Initial program 70.4%
Taylor expanded in x around 0 53.1%
Taylor expanded in y around 0 34.2%
clear-num35.8%
inv-pow35.8%
Applied egg-rr35.8%
unpow-135.8%
Simplified35.8%
if -3.1999999999999998e-97 < x Initial program 64.4%
associate-/l*80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in x around 0 52.0%
+-commutative52.0%
Simplified52.0%
Taylor expanded in y around 0 28.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.6e-96) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.6e-96) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.6d-96)) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.6e-96) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.6e-96: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.6e-96) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.6e-96)
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -3.6e-96], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-96}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -3.60000000000000008e-96Initial program 70.4%
Taylor expanded in x around 0 53.1%
Taylor expanded in y around 0 34.2%
if -3.60000000000000008e-96 < x Initial program 64.4%
associate-/l*80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in x around 0 52.0%
+-commutative52.0%
Simplified52.0%
Taylor expanded in y around 0 28.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
assert x < y;
public static double code(double x, double y) {
return x / y;
}
[x, y] = sort([x, y]) def code(x, y): return x / y
x, y = sort([x, y]) function code(x, y) return Float64(x / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Initial program 66.3%
associate-/l*79.9%
associate-+l+79.9%
Simplified79.9%
Taylor expanded in x around 0 44.0%
+-commutative44.0%
Simplified44.0%
Taylor expanded in y around 0 21.6%
(FPCore (x y) :precision binary64 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y): return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y) return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x)))) end
function tmp = code(x, y) tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x))); end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}
herbie shell --seed 2024116
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (/ (/ (/ x (+ (+ y 1) x)) (+ y x)) (/ 1 (/ y (+ y x)))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))