
(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 17 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 (/ (/ y (+ y x)) (+ (+ x (fma 2.0 y (/ y (/ x (+ y 1.0))))) 1.0)))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) / ((x + fma(2.0, y, (y / (x / (y + 1.0))))) + 1.0);
}
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) / Float64(Float64(x + fma(2.0, y, Float64(y / Float64(x / Float64(y + 1.0))))) + 1.0)) end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(x + N[(2.0 * y + N[(y / N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + x}}{\left(x + \mathsf{fma}\left(2, y, \frac{y}{\frac{x}{y + 1}}\right)\right) + 1}
\end{array}
Initial program 66.0%
times-frac86.7%
+-commutative86.7%
+-commutative86.7%
+-commutative86.7%
times-frac66.0%
associate-*l/80.0%
*-commutative80.0%
*-commutative80.0%
distribute-rgt1-in61.2%
fma-def80.0%
+-commutative80.0%
+-commutative80.0%
cube-unmult80.0%
+-commutative80.0%
Simplified80.0%
associate-*r/66.0%
fma-udef51.3%
cube-mult51.3%
distribute-rgt1-in66.0%
associate-+r+66.0%
*-commutative66.0%
frac-times86.7%
*-commutative86.7%
associate-/r*99.8%
clear-num99.7%
frac-times99.0%
*-un-lft-identity99.0%
+-commutative99.0%
+-commutative99.0%
associate-+l+99.0%
+-commutative99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 93.1%
fma-def93.1%
associate-/l*99.1%
+-commutative99.1%
Simplified99.1%
Final simplification99.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -1.3e+118)
(/ t_0 (+ x (+ y (+ y 1.0))))
(if (<= x -1.4e-16)
(* y (/ x (* (+ y x) (* (+ y x) (+ y (+ x 1.0))))))
(/ (* t_0 (/ x (+ y 1.0))) (+ y x))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -1.3e+118) {
tmp = t_0 / (x + (y + (y + 1.0)));
} else if (x <= -1.4e-16) {
tmp = y * (x / ((y + x) * ((y + x) * (y + (x + 1.0)))));
} else {
tmp = (t_0 * (x / (y + 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) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-1.3d+118)) then
tmp = t_0 / (x + (y + (y + 1.0d0)))
else if (x <= (-1.4d-16)) then
tmp = y * (x / ((y + x) * ((y + x) * (y + (x + 1.0d0)))))
else
tmp = (t_0 * (x / (y + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -1.3e+118) {
tmp = t_0 / (x + (y + (y + 1.0)));
} else if (x <= -1.4e-16) {
tmp = y * (x / ((y + x) * ((y + x) * (y + (x + 1.0)))));
} else {
tmp = (t_0 * (x / (y + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -1.3e+118: tmp = t_0 / (x + (y + (y + 1.0))) elif x <= -1.4e-16: tmp = y * (x / ((y + x) * ((y + x) * (y + (x + 1.0))))) else: tmp = (t_0 * (x / (y + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -1.3e+118) tmp = Float64(t_0 / Float64(x + Float64(y + Float64(y + 1.0)))); elseif (x <= -1.4e-16) tmp = Float64(y * Float64(x / Float64(Float64(y + x) * Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))))); else tmp = Float64(Float64(t_0 * Float64(x / Float64(y + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -1.3e+118)
tmp = t_0 / (x + (y + (y + 1.0)));
elseif (x <= -1.4e-16)
tmp = y * (x / ((y + x) * ((y + x) * (y + (x + 1.0)))));
else
tmp = (t_0 * (x / (y + 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_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.3e+118], N[(t$95$0 / N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.4e-16], N[(y * N[(x / N[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{+118}:\\
\;\;\;\;\frac{t_0}{x + \left(y + \left(y + 1\right)\right)}\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \frac{x}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -1.30000000000000008e118Initial program 50.5%
times-frac79.1%
+-commutative79.1%
+-commutative79.1%
+-commutative79.1%
times-frac50.5%
associate-*l/76.3%
*-commutative76.3%
*-commutative76.3%
distribute-rgt1-in6.4%
fma-def76.3%
+-commutative76.3%
+-commutative76.3%
cube-unmult76.3%
+-commutative76.3%
Simplified76.3%
associate-*r/50.5%
fma-udef0.1%
cube-mult0.1%
distribute-rgt1-in50.5%
associate-+r+50.5%
*-commutative50.5%
frac-times79.1%
*-commutative79.1%
associate-/r*99.8%
clear-num99.8%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around -inf 85.5%
mul-1-neg85.5%
unsub-neg85.5%
neg-mul-185.5%
+-commutative85.5%
unsub-neg85.5%
distribute-lft-in85.5%
metadata-eval85.5%
neg-mul-185.5%
unsub-neg85.5%
Simplified85.5%
if -1.30000000000000008e118 < x < -1.4000000000000001e-16Initial program 83.6%
times-frac92.4%
+-commutative92.4%
+-commutative92.4%
+-commutative92.4%
times-frac83.6%
associate-*l/92.4%
*-commutative92.4%
*-commutative92.4%
distribute-rgt1-in75.1%
fma-def92.4%
+-commutative92.4%
+-commutative92.4%
cube-unmult92.3%
+-commutative92.3%
Simplified92.3%
fma-udef75.0%
cube-mult75.1%
distribute-rgt1-in92.4%
associate-+r+92.4%
*-commutative92.4%
associate-*l*92.3%
+-commutative92.3%
+-commutative92.3%
+-commutative92.3%
associate-+l+92.3%
Applied egg-rr92.3%
if -1.4000000000000001e-16 < x Initial program 66.5%
Taylor expanded in x around 0 59.7%
+-commutative59.7%
Simplified59.7%
*-un-lft-identity59.7%
associate-*l*59.7%
+-commutative59.7%
times-frac58.9%
*-commutative58.9%
+-commutative58.9%
Applied egg-rr58.9%
associate-*l/58.9%
*-lft-identity58.9%
times-frac82.5%
Simplified82.5%
Final simplification83.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -2.8e+131)
(/ t_0 (+ x (+ y (+ y 1.0))))
(if (<= x -9.5e-17)
(* (/ y (* (+ y x) (+ y x))) (/ x (+ x (+ y 1.0))))
(/ (* t_0 (/ x (+ y 1.0))) (+ y x))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -2.8e+131) {
tmp = t_0 / (x + (y + (y + 1.0)));
} else if (x <= -9.5e-17) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0)));
} else {
tmp = (t_0 * (x / (y + 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) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-2.8d+131)) then
tmp = t_0 / (x + (y + (y + 1.0d0)))
else if (x <= (-9.5d-17)) then
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0d0)))
else
tmp = (t_0 * (x / (y + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -2.8e+131) {
tmp = t_0 / (x + (y + (y + 1.0)));
} else if (x <= -9.5e-17) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0)));
} else {
tmp = (t_0 * (x / (y + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -2.8e+131: tmp = t_0 / (x + (y + (y + 1.0))) elif x <= -9.5e-17: tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0))) else: tmp = (t_0 * (x / (y + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -2.8e+131) tmp = Float64(t_0 / Float64(x + Float64(y + Float64(y + 1.0)))); elseif (x <= -9.5e-17) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + Float64(y + 1.0)))); else tmp = Float64(Float64(t_0 * Float64(x / Float64(y + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -2.8e+131)
tmp = t_0 / (x + (y + (y + 1.0)));
elseif (x <= -9.5e-17)
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0)));
else
tmp = (t_0 * (x / (y + 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_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.8e+131], N[(t$95$0 / N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.5e-17], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{+131}:\\
\;\;\;\;\frac{t_0}{x + \left(y + \left(y + 1\right)\right)}\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{-17}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -2.8000000000000001e131Initial program 50.5%
times-frac79.1%
+-commutative79.1%
+-commutative79.1%
+-commutative79.1%
times-frac50.5%
associate-*l/76.3%
*-commutative76.3%
*-commutative76.3%
distribute-rgt1-in6.4%
fma-def76.3%
+-commutative76.3%
+-commutative76.3%
cube-unmult76.3%
+-commutative76.3%
Simplified76.3%
associate-*r/50.5%
fma-udef0.1%
cube-mult0.1%
distribute-rgt1-in50.5%
associate-+r+50.5%
*-commutative50.5%
frac-times79.1%
*-commutative79.1%
associate-/r*99.8%
clear-num99.8%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around -inf 85.5%
mul-1-neg85.5%
unsub-neg85.5%
neg-mul-185.5%
+-commutative85.5%
unsub-neg85.5%
distribute-lft-in85.5%
metadata-eval85.5%
neg-mul-185.5%
unsub-neg85.5%
Simplified85.5%
if -2.8000000000000001e131 < x < -9.50000000000000029e-17Initial program 83.6%
associate-/r*83.6%
*-commutative83.6%
+-commutative83.6%
+-commutative83.6%
associate-*l/92.3%
+-commutative92.3%
associate-*r/92.3%
remove-double-neg92.3%
+-commutative92.3%
+-commutative92.3%
remove-double-neg92.3%
+-commutative92.3%
associate-+l+92.3%
Simplified92.3%
if -9.50000000000000029e-17 < x Initial program 66.5%
Taylor expanded in x around 0 59.7%
+-commutative59.7%
Simplified59.7%
*-un-lft-identity59.7%
associate-*l*59.7%
+-commutative59.7%
times-frac58.9%
*-commutative58.9%
+-commutative58.9%
Applied egg-rr58.9%
associate-*l/58.9%
*-lft-identity58.9%
times-frac82.5%
Simplified82.5%
Final simplification83.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -2.8e+131)
(/ t_0 (+ x (+ y (+ y 1.0))))
(if (<= x -2e-79)
(/ (* x t_0) (* (+ y x) (+ y (+ x 1.0))))
(/ (* t_0 (/ x (+ y 1.0))) (+ y x))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -2.8e+131) {
tmp = t_0 / (x + (y + (y + 1.0)));
} else if (x <= -2e-79) {
tmp = (x * t_0) / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (t_0 * (x / (y + 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) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-2.8d+131)) then
tmp = t_0 / (x + (y + (y + 1.0d0)))
else if (x <= (-2d-79)) then
tmp = (x * t_0) / ((y + x) * (y + (x + 1.0d0)))
else
tmp = (t_0 * (x / (y + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -2.8e+131) {
tmp = t_0 / (x + (y + (y + 1.0)));
} else if (x <= -2e-79) {
tmp = (x * t_0) / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (t_0 * (x / (y + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -2.8e+131: tmp = t_0 / (x + (y + (y + 1.0))) elif x <= -2e-79: tmp = (x * t_0) / ((y + x) * (y + (x + 1.0))) else: tmp = (t_0 * (x / (y + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -2.8e+131) tmp = Float64(t_0 / Float64(x + Float64(y + Float64(y + 1.0)))); elseif (x <= -2e-79) tmp = Float64(Float64(x * t_0) / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(t_0 * Float64(x / Float64(y + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -2.8e+131)
tmp = t_0 / (x + (y + (y + 1.0)));
elseif (x <= -2e-79)
tmp = (x * t_0) / ((y + x) * (y + (x + 1.0)));
else
tmp = (t_0 * (x / (y + 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_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.8e+131], N[(t$95$0 / N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2e-79], N[(N[(x * t$95$0), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{+131}:\\
\;\;\;\;\frac{t_0}{x + \left(y + \left(y + 1\right)\right)}\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-79}:\\
\;\;\;\;\frac{x \cdot t_0}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -2.8000000000000001e131Initial program 50.5%
times-frac79.1%
+-commutative79.1%
+-commutative79.1%
+-commutative79.1%
times-frac50.5%
associate-*l/76.3%
*-commutative76.3%
*-commutative76.3%
distribute-rgt1-in6.4%
fma-def76.3%
+-commutative76.3%
+-commutative76.3%
cube-unmult76.3%
+-commutative76.3%
Simplified76.3%
associate-*r/50.5%
fma-udef0.1%
cube-mult0.1%
distribute-rgt1-in50.5%
associate-+r+50.5%
*-commutative50.5%
frac-times79.1%
*-commutative79.1%
associate-/r*99.8%
clear-num99.8%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around -inf 85.5%
mul-1-neg85.5%
unsub-neg85.5%
neg-mul-185.5%
+-commutative85.5%
unsub-neg85.5%
distribute-lft-in85.5%
metadata-eval85.5%
neg-mul-185.5%
unsub-neg85.5%
Simplified85.5%
if -2.8000000000000001e131 < x < -2e-79Initial program 84.1%
times-frac94.9%
+-commutative94.9%
+-commutative94.9%
+-commutative94.9%
times-frac84.1%
associate-*l/90.0%
*-commutative90.0%
*-commutative90.0%
distribute-rgt1-in78.8%
fma-def90.0%
+-commutative90.0%
+-commutative90.0%
cube-unmult90.0%
+-commutative90.0%
Simplified90.0%
associate-*r/84.2%
fma-udef78.4%
cube-mult78.3%
distribute-rgt1-in84.1%
associate-+r+84.1%
*-commutative84.1%
frac-times94.8%
associate-/r*99.7%
frac-times94.9%
+-commutative94.9%
+-commutative94.9%
+-commutative94.9%
associate-+l+94.9%
Applied egg-rr94.9%
if -2e-79 < x Initial program 65.2%
Taylor expanded in x around 0 57.9%
+-commutative57.9%
Simplified57.9%
*-un-lft-identity57.9%
associate-*l*57.9%
+-commutative57.9%
times-frac56.0%
*-commutative56.0%
+-commutative56.0%
Applied egg-rr56.0%
associate-*l/56.0%
*-lft-identity56.0%
times-frac81.3%
Simplified81.3%
Final simplification83.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.9e+94)
(/ (/ y (+ y x)) (+ x (+ y (+ y 1.0))))
(if (<= x -1.55e-117)
(* (/ y (* (+ y x) (+ y x))) (/ x (+ x 1.0)))
(/ (/ x (+ y 1.0)) y))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.9e+94) {
tmp = (y / (y + x)) / (x + (y + (y + 1.0)));
} else if (x <= -1.55e-117) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / 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.9d+94)) then
tmp = (y / (y + x)) / (x + (y + (y + 1.0d0)))
else if (x <= (-1.55d-117)) then
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0d0))
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.9e+94) {
tmp = (y / (y + x)) / (x + (y + (y + 1.0)));
} else if (x <= -1.55e-117) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.9e+94: tmp = (y / (y + x)) / (x + (y + (y + 1.0))) elif x <= -1.55e-117: tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0)) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.9e+94) tmp = Float64(Float64(y / Float64(y + x)) / Float64(x + Float64(y + Float64(y + 1.0)))); elseif (x <= -1.55e-117) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.9e+94)
tmp = (y / (y + x)) / (x + (y + (y + 1.0)));
elseif (x <= -1.55e-117)
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
else
tmp = (x / (y + 1.0)) / 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.9e+94], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.55e-117], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+94}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{x + \left(y + \left(y + 1\right)\right)}\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-117}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -2.8999999999999998e94Initial program 48.2%
times-frac76.7%
+-commutative76.7%
+-commutative76.7%
+-commutative76.7%
times-frac48.2%
associate-*l/74.2%
*-commutative74.2%
*-commutative74.2%
distribute-rgt1-in8.6%
fma-def74.2%
+-commutative74.2%
+-commutative74.2%
cube-unmult74.2%
+-commutative74.2%
Simplified74.2%
associate-*r/48.2%
fma-udef2.8%
cube-mult2.8%
distribute-rgt1-in48.2%
associate-+r+48.2%
*-commutative48.2%
frac-times76.7%
*-commutative76.7%
associate-/r*99.7%
clear-num99.7%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around -inf 79.6%
mul-1-neg79.6%
unsub-neg79.6%
neg-mul-179.6%
+-commutative79.6%
unsub-neg79.6%
distribute-lft-in79.6%
metadata-eval79.6%
neg-mul-179.6%
unsub-neg79.6%
Simplified79.6%
if -2.8999999999999998e94 < x < -1.55000000000000005e-117Initial program 91.5%
associate-/r*95.6%
*-commutative95.6%
+-commutative95.6%
+-commutative95.6%
associate-*l/99.6%
+-commutative99.6%
associate-*r/99.6%
remove-double-neg99.6%
+-commutative99.6%
+-commutative99.6%
remove-double-neg99.6%
+-commutative99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in y around 0 76.0%
+-commutative76.0%
Simplified76.0%
if -1.55000000000000005e-117 < x Initial program 63.3%
associate-/r*69.2%
*-commutative69.2%
+-commutative69.2%
+-commutative69.2%
associate-*l/85.5%
+-commutative85.5%
associate-*r/85.5%
remove-double-neg85.5%
+-commutative85.5%
+-commutative85.5%
remove-double-neg85.5%
+-commutative85.5%
associate-+l+85.5%
Simplified85.5%
Taylor expanded in x around 0 52.8%
+-commutative52.8%
Simplified52.8%
*-un-lft-identity52.8%
times-frac56.1%
Applied egg-rr56.1%
associate-*l/56.2%
+-commutative56.2%
*-lft-identity56.2%
+-commutative56.2%
Simplified56.2%
Final simplification63.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -0.0042)
(/ (/ y (+ y x)) (+ x (+ y (+ y 1.0))))
(if (<= x -2.2e-268)
(/ y (* (+ y x) (* (+ y x) (/ (+ y 1.0) x))))
(/ (/ x (+ y 1.0)) (+ y x)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -0.0042) {
tmp = (y / (y + x)) / (x + (y + (y + 1.0)));
} else if (x <= -2.2e-268) {
tmp = y / ((y + x) * ((y + x) * ((y + 1.0) / x)));
} else {
tmp = (x / (y + 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 <= (-0.0042d0)) then
tmp = (y / (y + x)) / (x + (y + (y + 1.0d0)))
else if (x <= (-2.2d-268)) then
tmp = y / ((y + x) * ((y + x) * ((y + 1.0d0) / x)))
else
tmp = (x / (y + 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 <= -0.0042) {
tmp = (y / (y + x)) / (x + (y + (y + 1.0)));
} else if (x <= -2.2e-268) {
tmp = y / ((y + x) * ((y + x) * ((y + 1.0) / x)));
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -0.0042: tmp = (y / (y + x)) / (x + (y + (y + 1.0))) elif x <= -2.2e-268: tmp = y / ((y + x) * ((y + x) * ((y + 1.0) / x))) else: tmp = (x / (y + 1.0)) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -0.0042) tmp = Float64(Float64(y / Float64(y + x)) / Float64(x + Float64(y + Float64(y + 1.0)))); elseif (x <= -2.2e-268) tmp = Float64(y / Float64(Float64(y + x) * Float64(Float64(y + x) * Float64(Float64(y + 1.0) / x)))); else tmp = Float64(Float64(x / Float64(y + 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 <= -0.0042)
tmp = (y / (y + x)) / (x + (y + (y + 1.0)));
elseif (x <= -2.2e-268)
tmp = y / ((y + x) * ((y + x) * ((y + 1.0) / x)));
else
tmp = (x / (y + 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, -0.0042], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.2e-268], N[(y / N[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0042:\\
\;\;\;\;\frac{\frac{y}{y + x}}{x + \left(y + \left(y + 1\right)\right)}\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-268}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{y + 1}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -0.00419999999999999974Initial program 62.3%
times-frac83.8%
+-commutative83.8%
+-commutative83.8%
+-commutative83.8%
times-frac62.3%
associate-*l/82.0%
*-commutative82.0%
*-commutative82.0%
distribute-rgt1-in31.2%
fma-def82.0%
+-commutative82.0%
+-commutative82.0%
cube-unmult82.0%
+-commutative82.0%
Simplified82.0%
associate-*r/62.3%
fma-udef27.3%
cube-mult27.2%
distribute-rgt1-in62.3%
associate-+r+62.3%
*-commutative62.3%
frac-times83.7%
*-commutative83.7%
associate-/r*99.7%
clear-num99.7%
frac-times99.7%
*-un-lft-identity99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around -inf 75.5%
mul-1-neg75.5%
unsub-neg75.5%
neg-mul-175.5%
+-commutative75.5%
unsub-neg75.5%
distribute-lft-in75.5%
metadata-eval75.5%
neg-mul-175.5%
unsub-neg75.5%
Simplified75.5%
if -0.00419999999999999974 < x < -2.20000000000000004e-268Initial program 73.4%
times-frac87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
times-frac73.4%
associate-*l/80.2%
*-commutative80.2%
*-commutative80.2%
distribute-rgt1-in67.3%
fma-def80.2%
+-commutative80.2%
+-commutative80.2%
cube-unmult80.2%
+-commutative80.2%
Simplified80.2%
associate-*r/73.5%
fma-udef60.6%
cube-mult60.5%
distribute-rgt1-in73.4%
associate-+r+73.4%
*-commutative73.4%
frac-times87.2%
*-commutative87.2%
associate-/r*99.8%
clear-num99.7%
frac-times98.7%
*-un-lft-identity98.7%
+-commutative98.7%
+-commutative98.7%
associate-+l+98.7%
+-commutative98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 97.9%
+-commutative97.9%
Simplified97.9%
associate-/l/91.9%
div-inv91.9%
*-commutative91.9%
Applied egg-rr91.9%
associate-*r/91.9%
*-rgt-identity91.9%
*-commutative91.9%
Simplified91.9%
if -2.20000000000000004e-268 < x Initial program 64.2%
times-frac87.7%
+-commutative87.7%
+-commutative87.7%
+-commutative87.7%
times-frac64.2%
associate-*l/79.2%
*-commutative79.2%
*-commutative79.2%
distribute-rgt1-in70.3%
fma-def79.2%
+-commutative79.2%
+-commutative79.2%
cube-unmult79.2%
+-commutative79.2%
Simplified79.2%
associate-*r/64.2%
fma-udef56.7%
cube-mult56.8%
distribute-rgt1-in64.2%
associate-+r+64.2%
*-commutative64.2%
frac-times87.6%
associate-*l/79.3%
associate-/r*86.5%
div-inv86.4%
div-inv86.5%
+-commutative86.5%
associate-+l+86.5%
+-commutative86.5%
+-commutative86.5%
Applied egg-rr86.5%
Taylor expanded in x around 0 51.2%
+-commutative51.2%
Simplified51.2%
Final simplification66.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ y (+ y x)) (- 1.0 (- (- (* (/ y x) (- -1.0 y)) (* y 2.0)) x))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) / (1.0 - ((((y / x) * (-1.0 - y)) - (y * 2.0)) - x));
}
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 = (y / (y + x)) / (1.0d0 - ((((y / x) * ((-1.0d0) - y)) - (y * 2.0d0)) - x))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) / (1.0 - ((((y / x) * (-1.0 - y)) - (y * 2.0)) - x));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) / (1.0 - ((((y / x) * (-1.0 - y)) - (y * 2.0)) - x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) / Float64(1.0 - Float64(Float64(Float64(Float64(y / x) * Float64(-1.0 - y)) - Float64(y * 2.0)) - x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) / (1.0 - ((((y / x) * (-1.0 - y)) - (y * 2.0)) - x));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[(N[(N[(y / x), $MachinePrecision] * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision] - N[(y * 2.0), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + x}}{1 - \left(\left(\frac{y}{x} \cdot \left(-1 - y\right) - y \cdot 2\right) - x\right)}
\end{array}
Initial program 66.0%
times-frac86.7%
+-commutative86.7%
+-commutative86.7%
+-commutative86.7%
times-frac66.0%
associate-*l/80.0%
*-commutative80.0%
*-commutative80.0%
distribute-rgt1-in61.2%
fma-def80.0%
+-commutative80.0%
+-commutative80.0%
cube-unmult80.0%
+-commutative80.0%
Simplified80.0%
associate-*r/66.0%
fma-udef51.3%
cube-mult51.3%
distribute-rgt1-in66.0%
associate-+r+66.0%
*-commutative66.0%
frac-times86.7%
*-commutative86.7%
associate-/r*99.8%
clear-num99.7%
frac-times99.0%
*-un-lft-identity99.0%
+-commutative99.0%
+-commutative99.0%
associate-+l+99.0%
+-commutative99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 93.1%
fma-def93.1%
associate-/l*99.1%
+-commutative99.1%
Simplified99.1%
fma-udef99.1%
associate-/r/99.1%
Applied egg-rr99.1%
Final simplification99.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -0.032)
(/ t_0 (+ x (+ y (+ y 1.0))))
(/ (* t_0 (/ x (+ y 1.0))) (+ y x)))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -0.032) {
tmp = t_0 / (x + (y + (y + 1.0)));
} else {
tmp = (t_0 * (x / (y + 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) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-0.032d0)) then
tmp = t_0 / (x + (y + (y + 1.0d0)))
else
tmp = (t_0 * (x / (y + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -0.032) {
tmp = t_0 / (x + (y + (y + 1.0)));
} else {
tmp = (t_0 * (x / (y + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -0.032: tmp = t_0 / (x + (y + (y + 1.0))) else: tmp = (t_0 * (x / (y + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -0.032) tmp = Float64(t_0 / Float64(x + Float64(y + Float64(y + 1.0)))); else tmp = Float64(Float64(t_0 * Float64(x / Float64(y + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -0.032)
tmp = t_0 / (x + (y + (y + 1.0)));
else
tmp = (t_0 * (x / (y + 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_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.032], N[(t$95$0 / N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -0.032:\\
\;\;\;\;\frac{t_0}{x + \left(y + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -0.032000000000000001Initial program 62.3%
times-frac83.8%
+-commutative83.8%
+-commutative83.8%
+-commutative83.8%
times-frac62.3%
associate-*l/82.0%
*-commutative82.0%
*-commutative82.0%
distribute-rgt1-in31.2%
fma-def82.0%
+-commutative82.0%
+-commutative82.0%
cube-unmult82.0%
+-commutative82.0%
Simplified82.0%
associate-*r/62.3%
fma-udef27.3%
cube-mult27.2%
distribute-rgt1-in62.3%
associate-+r+62.3%
*-commutative62.3%
frac-times83.7%
*-commutative83.7%
associate-/r*99.7%
clear-num99.7%
frac-times99.7%
*-un-lft-identity99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around -inf 75.5%
mul-1-neg75.5%
unsub-neg75.5%
neg-mul-175.5%
+-commutative75.5%
unsub-neg75.5%
distribute-lft-in75.5%
metadata-eval75.5%
neg-mul-175.5%
unsub-neg75.5%
Simplified75.5%
if -0.032000000000000001 < x Initial program 67.0%
Taylor expanded in x around 0 60.1%
+-commutative60.1%
Simplified60.1%
*-un-lft-identity60.1%
associate-*l*60.1%
+-commutative60.1%
times-frac59.2%
*-commutative59.2%
+-commutative59.2%
Applied egg-rr59.2%
associate-*l/59.3%
*-lft-identity59.3%
times-frac82.5%
Simplified82.5%
Final simplification81.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ y (+ y x)) (* (+ y x) (/ (+ y (+ x 1.0)) x))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) / ((y + x) * ((y + (x + 1.0)) / x));
}
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 = (y / (y + x)) / ((y + x) * ((y + (x + 1.0d0)) / x))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) / ((y + x) * ((y + (x + 1.0)) / x));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) / ((y + x) * ((y + (x + 1.0)) / x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) / Float64(Float64(y + x) * Float64(Float64(y + Float64(x + 1.0)) / x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) / ((y + x) * ((y + (x + 1.0)) / x));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + x}}{\left(y + x\right) \cdot \frac{y + \left(x + 1\right)}{x}}
\end{array}
Initial program 66.0%
times-frac86.7%
+-commutative86.7%
+-commutative86.7%
+-commutative86.7%
times-frac66.0%
associate-*l/80.0%
*-commutative80.0%
*-commutative80.0%
distribute-rgt1-in61.2%
fma-def80.0%
+-commutative80.0%
+-commutative80.0%
cube-unmult80.0%
+-commutative80.0%
Simplified80.0%
associate-*r/66.0%
fma-udef51.3%
cube-mult51.3%
distribute-rgt1-in66.0%
associate-+r+66.0%
*-commutative66.0%
frac-times86.7%
*-commutative86.7%
associate-/r*99.8%
clear-num99.7%
frac-times99.0%
*-un-lft-identity99.0%
+-commutative99.0%
+-commutative99.0%
associate-+l+99.0%
+-commutative99.0%
Applied egg-rr99.0%
Final simplification99.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.95e-158) (/ (/ y (+ y x)) (+ x 1.0)) (/ x (* (+ y x) (+ y (+ x 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.95e-158) {
tmp = (y / (y + x)) / (x + 1.0);
} else {
tmp = x / ((y + x) * (y + (x + 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 (y <= 1.95d-158) then
tmp = (y / (y + x)) / (x + 1.0d0)
else
tmp = x / ((y + x) * (y + (x + 1.0d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.95e-158) {
tmp = (y / (y + x)) / (x + 1.0);
} else {
tmp = x / ((y + x) * (y + (x + 1.0)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.95e-158: tmp = (y / (y + x)) / (x + 1.0) else: tmp = x / ((y + x) * (y + (x + 1.0))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.95e-158) tmp = Float64(Float64(y / Float64(y + x)) / Float64(x + 1.0)); else tmp = Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.95e-158)
tmp = (y / (y + x)) / (x + 1.0);
else
tmp = x / ((y + x) * (y + (x + 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[y, 1.95e-158], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.95 \cdot 10^{-158}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if y < 1.9499999999999998e-158Initial program 70.3%
times-frac86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
times-frac70.3%
associate-*l/81.9%
*-commutative81.9%
*-commutative81.9%
distribute-rgt1-in56.4%
fma-def81.9%
+-commutative81.9%
+-commutative81.9%
cube-unmult81.9%
+-commutative81.9%
Simplified81.9%
associate-*r/70.4%
fma-udef48.7%
cube-mult48.7%
distribute-rgt1-in70.3%
associate-+r+70.3%
*-commutative70.3%
frac-times86.3%
*-commutative86.3%
associate-/r*99.8%
clear-num99.7%
frac-times99.3%
*-un-lft-identity99.3%
+-commutative99.3%
+-commutative99.3%
associate-+l+99.3%
+-commutative99.3%
Applied egg-rr99.3%
Taylor expanded in y around 0 55.4%
+-commutative55.4%
Simplified55.4%
if 1.9499999999999998e-158 < y Initial program 58.9%
times-frac87.3%
+-commutative87.3%
+-commutative87.3%
+-commutative87.3%
times-frac58.9%
associate-*l/77.0%
*-commutative77.0%
*-commutative77.0%
distribute-rgt1-in69.1%
fma-def77.0%
+-commutative77.0%
+-commutative77.0%
cube-unmult77.0%
+-commutative77.0%
Simplified77.0%
associate-*r/58.9%
fma-udef55.7%
cube-mult55.7%
distribute-rgt1-in58.9%
associate-+r+58.9%
*-commutative58.9%
frac-times87.3%
associate-/r*99.7%
frac-times87.4%
+-commutative87.4%
+-commutative87.4%
+-commutative87.4%
associate-+l+87.4%
Applied egg-rr87.4%
Taylor expanded in y around inf 71.7%
Final simplification61.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4.5e-144) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) (+ y x))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.5e-144) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 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 (y <= 4.5d-144) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / (y + 1.0d0)) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.5e-144) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.5e-144: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + 1.0)) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.5e-144) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 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 (y <= 4.5e-144)
tmp = y / (x * (x + 1.0));
else
tmp = (x / (y + 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[y, 4.5e-144], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{-144}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if y < 4.4999999999999998e-144Initial program 70.5%
associate-/r*74.0%
*-commutative74.0%
+-commutative74.0%
+-commutative74.0%
associate-*l/86.4%
+-commutative86.4%
associate-*r/86.4%
remove-double-neg86.4%
+-commutative86.4%
+-commutative86.4%
remove-double-neg86.4%
+-commutative86.4%
associate-+l+86.4%
Simplified86.4%
Taylor expanded in y around 0 54.5%
+-commutative54.5%
Simplified54.5%
if 4.4999999999999998e-144 < y Initial program 58.5%
times-frac87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
times-frac58.5%
associate-*l/76.8%
*-commutative76.8%
*-commutative76.8%
distribute-rgt1-in68.8%
fma-def76.8%
+-commutative76.8%
+-commutative76.8%
cube-unmult76.8%
+-commutative76.8%
Simplified76.8%
associate-*r/58.5%
fma-udef55.2%
cube-mult55.2%
distribute-rgt1-in58.5%
associate-+r+58.5%
*-commutative58.5%
frac-times87.2%
associate-*l/81.4%
associate-/r*93.9%
div-inv93.9%
div-inv93.9%
+-commutative93.9%
associate-+l+93.9%
+-commutative93.9%
+-commutative93.9%
Applied egg-rr93.9%
Taylor expanded in x around 0 62.5%
+-commutative62.5%
Simplified62.5%
Final simplification57.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4.5e-144) (/ (/ y (+ y x)) (+ x 1.0)) (/ (/ x (+ y 1.0)) (+ y x))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.5e-144) {
tmp = (y / (y + x)) / (x + 1.0);
} else {
tmp = (x / (y + 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 (y <= 4.5d-144) then
tmp = (y / (y + x)) / (x + 1.0d0)
else
tmp = (x / (y + 1.0d0)) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.5e-144) {
tmp = (y / (y + x)) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.5e-144: tmp = (y / (y + x)) / (x + 1.0) else: tmp = (x / (y + 1.0)) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.5e-144) tmp = Float64(Float64(y / Float64(y + x)) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + 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 (y <= 4.5e-144)
tmp = (y / (y + x)) / (x + 1.0);
else
tmp = (x / (y + 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[y, 4.5e-144], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{-144}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if y < 4.4999999999999998e-144Initial program 70.5%
times-frac86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
times-frac70.5%
associate-*l/82.0%
*-commutative82.0%
*-commutative82.0%
distribute-rgt1-in56.7%
fma-def82.0%
+-commutative82.0%
+-commutative82.0%
cube-unmult82.0%
+-commutative82.0%
Simplified82.0%
associate-*r/70.5%
fma-udef49.0%
cube-mult49.0%
distribute-rgt1-in70.5%
associate-+r+70.5%
*-commutative70.5%
frac-times86.4%
*-commutative86.4%
associate-/r*99.8%
clear-num99.7%
frac-times99.3%
*-un-lft-identity99.3%
+-commutative99.3%
+-commutative99.3%
associate-+l+99.3%
+-commutative99.3%
Applied egg-rr99.3%
Taylor expanded in y around 0 55.7%
+-commutative55.7%
Simplified55.7%
if 4.4999999999999998e-144 < y Initial program 58.5%
times-frac87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
times-frac58.5%
associate-*l/76.8%
*-commutative76.8%
*-commutative76.8%
distribute-rgt1-in68.8%
fma-def76.8%
+-commutative76.8%
+-commutative76.8%
cube-unmult76.8%
+-commutative76.8%
Simplified76.8%
associate-*r/58.5%
fma-udef55.2%
cube-mult55.2%
distribute-rgt1-in58.5%
associate-+r+58.5%
*-commutative58.5%
frac-times87.2%
associate-*l/81.4%
associate-/r*93.9%
div-inv93.9%
div-inv93.9%
+-commutative93.9%
associate-+l+93.9%
+-commutative93.9%
+-commutative93.9%
Applied egg-rr93.9%
Taylor expanded in x around 0 62.5%
+-commutative62.5%
Simplified62.5%
Final simplification58.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4.5e-144) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.5e-144) {
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 (y <= 4.5d-144) 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 (y <= 4.5e-144) {
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 y <= 4.5e-144: 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 (y <= 4.5e-144) 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 (y <= 4.5e-144)
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[y, 4.5e-144], 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}\;y \leq 4.5 \cdot 10^{-144}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 4.4999999999999998e-144Initial program 70.5%
associate-/r*74.0%
*-commutative74.0%
+-commutative74.0%
+-commutative74.0%
associate-*l/86.4%
+-commutative86.4%
associate-*r/86.4%
remove-double-neg86.4%
+-commutative86.4%
+-commutative86.4%
remove-double-neg86.4%
+-commutative86.4%
associate-+l+86.4%
Simplified86.4%
Taylor expanded in y around 0 54.5%
+-commutative54.5%
Simplified54.5%
if 4.4999999999999998e-144 < y Initial program 58.5%
associate-/r*66.2%
*-commutative66.2%
+-commutative66.2%
+-commutative66.2%
associate-*l/87.2%
+-commutative87.2%
associate-*r/87.2%
remove-double-neg87.2%
+-commutative87.2%
+-commutative87.2%
remove-double-neg87.2%
+-commutative87.2%
associate-+l+87.2%
Simplified87.2%
Taylor expanded in x around 0 61.8%
+-commutative61.8%
Simplified61.8%
Final simplification57.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4.3e-144) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.3e-144) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / 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 (y <= 4.3d-144) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.3e-144) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.3e-144: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.3e-144) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4.3e-144)
tmp = y / (x * (x + 1.0));
else
tmp = (x / (y + 1.0)) / 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[y, 4.3e-144], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{-144}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 4.2999999999999999e-144Initial program 70.5%
associate-/r*74.0%
*-commutative74.0%
+-commutative74.0%
+-commutative74.0%
associate-*l/86.4%
+-commutative86.4%
associate-*r/86.4%
remove-double-neg86.4%
+-commutative86.4%
+-commutative86.4%
remove-double-neg86.4%
+-commutative86.4%
associate-+l+86.4%
Simplified86.4%
Taylor expanded in y around 0 54.5%
+-commutative54.5%
Simplified54.5%
if 4.2999999999999999e-144 < y Initial program 58.5%
associate-/r*66.2%
*-commutative66.2%
+-commutative66.2%
+-commutative66.2%
associate-*l/87.2%
+-commutative87.2%
associate-*r/87.2%
remove-double-neg87.2%
+-commutative87.2%
+-commutative87.2%
remove-double-neg87.2%
+-commutative87.2%
associate-+l+87.2%
Simplified87.2%
Taylor expanded in x around 0 61.8%
+-commutative61.8%
Simplified61.8%
*-un-lft-identity61.8%
times-frac61.8%
Applied egg-rr61.8%
associate-*l/61.9%
+-commutative61.9%
*-lft-identity61.9%
+-commutative61.9%
Simplified61.9%
Final simplification57.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x (* y (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
return x / (y * (y + 1.0));
}
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 * (y + 1.0d0))
end function
assert x < y;
public static double code(double x, double y) {
return x / (y * (y + 1.0));
}
[x, y] = sort([x, y]) def code(x, y): return x / (y * (y + 1.0))
x, y = sort([x, y]) function code(x, y) return Float64(x / Float64(y * Float64(y + 1.0))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / (y * (y + 1.0));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y \cdot \left(y + 1\right)}
\end{array}
Initial program 66.0%
associate-/r*71.1%
*-commutative71.1%
+-commutative71.1%
+-commutative71.1%
associate-*l/86.7%
+-commutative86.7%
associate-*r/86.7%
remove-double-neg86.7%
+-commutative86.7%
+-commutative86.7%
remove-double-neg86.7%
+-commutative86.7%
associate-+l+86.7%
Simplified86.7%
Taylor expanded in x around 0 49.2%
+-commutative49.2%
Simplified49.2%
Final simplification49.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
return 1.0 / x;
}
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 = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / x;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / x
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Initial program 66.0%
times-frac86.7%
+-commutative86.7%
+-commutative86.7%
+-commutative86.7%
times-frac66.0%
associate-*l/80.0%
*-commutative80.0%
*-commutative80.0%
distribute-rgt1-in61.2%
fma-def80.0%
+-commutative80.0%
+-commutative80.0%
cube-unmult80.0%
+-commutative80.0%
Simplified80.0%
associate-*r/66.0%
fma-udef51.3%
cube-mult51.3%
distribute-rgt1-in66.0%
associate-+r+66.0%
*-commutative66.0%
frac-times86.7%
*-commutative86.7%
associate-/r*99.8%
clear-num99.7%
frac-times99.0%
*-un-lft-identity99.0%
+-commutative99.0%
+-commutative99.0%
associate-+l+99.0%
+-commutative99.0%
Applied egg-rr99.0%
Taylor expanded in x around inf 35.8%
Taylor expanded in y around inf 4.2%
Final simplification4.2%
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.0%
associate-/r*71.1%
*-commutative71.1%
+-commutative71.1%
+-commutative71.1%
associate-*l/86.7%
+-commutative86.7%
associate-*r/86.7%
remove-double-neg86.7%
+-commutative86.7%
+-commutative86.7%
remove-double-neg86.7%
+-commutative86.7%
associate-+l+86.7%
Simplified86.7%
Taylor expanded in x around 0 49.2%
+-commutative49.2%
Simplified49.2%
Taylor expanded in y around 0 27.3%
Final simplification27.3%
(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 2024019
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))