
(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 15 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)) (/ (/ y (+ y (+ x 1.0))) (+ x y))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) * ((y / (y + (x + 1.0))) / (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)) * ((y / (y + (x + 1.0d0))) / (x + y))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{y + \left(x + 1\right)}}{x + y}
\end{array}
Initial program 66.3%
times-frac87.0%
associate-+r+87.0%
associate-*l/80.9%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.1e-134) (* (/ 1.0 x) (/ y (+ x (+ y 1.0)))) (* (/ (/ y (+ y (+ x 1.0))) (+ x y)) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.1e-134) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else {
tmp = ((y / (y + (x + 1.0))) / (x + y)) * (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 (y <= 1.1d-134) then
tmp = (1.0d0 / x) * (y / (x + (y + 1.0d0)))
else
tmp = ((y / (y + (x + 1.0d0))) / (x + y)) * (x / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.1e-134) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else {
tmp = ((y / (y + (x + 1.0))) / (x + y)) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.1e-134: tmp = (1.0 / x) * (y / (x + (y + 1.0))) else: tmp = ((y / (y + (x + 1.0))) / (x + y)) * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.1e-134) tmp = Float64(Float64(1.0 / x) * Float64(y / Float64(x + Float64(y + 1.0)))); else tmp = Float64(Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y)) * Float64(x / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.1e-134)
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
else
tmp = ((y / (y + (x + 1.0))) / (x + y)) * (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[y, 1.1e-134], N[(N[(1.0 / x), $MachinePrecision] * N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{-134}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x + \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{y + \left(x + 1\right)}}{x + y} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 1.1e-134Initial program 66.6%
times-frac85.5%
associate-+l+85.5%
Simplified85.5%
Taylor expanded in x around inf 61.9%
if 1.1e-134 < y Initial program 65.8%
times-frac89.3%
associate-+r+89.3%
associate-*l/85.7%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 77.2%
Final simplification68.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.2e-15) (* (/ x (+ x y)) (/ (/ y (+ x 1.0)) (+ x y))) (* (/ (/ y (+ y (+ x 1.0))) (+ x y)) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.2e-15) {
tmp = (x / (x + y)) * ((y / (x + 1.0)) / (x + y));
} else {
tmp = ((y / (y + (x + 1.0))) / (x + y)) * (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 (y <= 3.2d-15) then
tmp = (x / (x + y)) * ((y / (x + 1.0d0)) / (x + y))
else
tmp = ((y / (y + (x + 1.0d0))) / (x + y)) * (x / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.2e-15) {
tmp = (x / (x + y)) * ((y / (x + 1.0)) / (x + y));
} else {
tmp = ((y / (y + (x + 1.0))) / (x + y)) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.2e-15: tmp = (x / (x + y)) * ((y / (x + 1.0)) / (x + y)) else: tmp = ((y / (y + (x + 1.0))) / (x + y)) * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.2e-15) tmp = Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y))); else tmp = Float64(Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y)) * Float64(x / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.2e-15)
tmp = (x / (x + y)) * ((y / (x + 1.0)) / (x + y));
else
tmp = ((y / (y + (x + 1.0))) / (x + y)) * (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[y, 3.2e-15], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{-15}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{x + 1}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{y + \left(x + 1\right)}}{x + y} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 3.1999999999999999e-15Initial program 67.4%
times-frac87.2%
associate-+r+87.2%
associate-*l/78.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 81.4%
+-commutative81.4%
Simplified81.4%
if 3.1999999999999999e-15 < y Initial program 64.0%
times-frac86.7%
associate-+r+86.7%
associate-*l/86.7%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 87.0%
Final simplification83.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.36e-135) (* (/ 1.0 x) (/ y (+ x (+ y 1.0)))) (if (<= y 1.3e+154) (/ x (* (+ x y) (+ y (+ x 1.0)))) (/ (/ x (+ x y)) y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.36e-135) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else if (y <= 1.3e+154) {
tmp = x / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / 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 <= 1.36d-135) then
tmp = (1.0d0 / x) * (y / (x + (y + 1.0d0)))
else if (y <= 1.3d+154) then
tmp = x / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / (x + y)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.36e-135) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else if (y <= 1.3e+154) {
tmp = x / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.36e-135: tmp = (1.0 / x) * (y / (x + (y + 1.0))) elif y <= 1.3e+154: tmp = x / ((x + y) * (y + (x + 1.0))) else: tmp = (x / (x + y)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.36e-135) tmp = Float64(Float64(1.0 / x) * Float64(y / Float64(x + Float64(y + 1.0)))); elseif (y <= 1.3e+154) tmp = Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.36e-135)
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
elseif (y <= 1.3e+154)
tmp = x / ((x + y) * (y + (x + 1.0)));
else
tmp = (x / (x + y)) / 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, 1.36e-135], N[(N[(1.0 / x), $MachinePrecision] * N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+154], N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.36 \cdot 10^{-135}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x + \left(y + 1\right)}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+154}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y}\\
\end{array}
\end{array}
if y < 1.36e-135Initial program 66.6%
times-frac85.5%
associate-+l+85.5%
Simplified85.5%
Taylor expanded in x around inf 61.9%
if 1.36e-135 < y < 1.29999999999999994e154Initial program 70.0%
associate-/r*77.4%
+-commutative77.4%
+-commutative77.4%
+-commutative77.4%
associate-/r*70.0%
associate-*l/79.2%
*-commutative79.2%
*-commutative79.2%
distribute-rgt1-in69.5%
fma-def79.2%
+-commutative79.2%
+-commutative79.2%
cube-unmult79.2%
+-commutative79.2%
Simplified79.2%
associate-*r/70.0%
fma-udef63.5%
cube-mult63.5%
distribute-rgt1-in70.0%
associate-+r+70.0%
*-commutative70.0%
frac-times89.9%
*-commutative89.9%
associate-/r*99.7%
frac-times90.0%
+-commutative90.0%
+-commutative90.0%
associate-+l+90.0%
+-commutative90.0%
Applied egg-rr90.0%
Taylor expanded in x around 0 71.6%
if 1.29999999999999994e154 < y Initial program 59.1%
associate-/r*59.1%
+-commutative59.1%
+-commutative59.1%
+-commutative59.1%
associate-/r*59.1%
associate-*l/88.4%
*-commutative88.4%
*-commutative88.4%
distribute-rgt1-in85.7%
fma-def88.4%
+-commutative88.4%
+-commutative88.4%
cube-unmult88.4%
+-commutative88.4%
Simplified88.4%
associate-*r/59.1%
fma-udef59.1%
cube-mult59.1%
distribute-rgt1-in59.1%
associate-+r+59.1%
*-commutative59.1%
*-commutative59.1%
frac-times88.4%
associate-/r*99.8%
clear-num99.8%
frac-times99.6%
*-un-lft-identity99.6%
+-commutative99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 92.4%
Final simplification68.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 3.5e-137)
(* (/ 1.0 x) (/ y (+ x (+ y 1.0))))
(if (<= y 1.35e+154)
(/ x (* (+ x y) (+ y (+ x 1.0))))
(/ (/ x (+ x y)) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.5e-137) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else if (y <= 1.35e+154) {
tmp = x / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / (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 (y <= 3.5d-137) then
tmp = (1.0d0 / x) * (y / (x + (y + 1.0d0)))
else if (y <= 1.35d+154) then
tmp = x / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / (x + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.5e-137) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else if (y <= 1.35e+154) {
tmp = x / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.5e-137: tmp = (1.0 / x) * (y / (x + (y + 1.0))) elif y <= 1.35e+154: tmp = x / ((x + y) * (y + (x + 1.0))) else: tmp = (x / (x + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.5e-137) tmp = Float64(Float64(1.0 / x) * Float64(y / Float64(x + Float64(y + 1.0)))); elseif (y <= 1.35e+154) tmp = Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.5e-137)
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
elseif (y <= 1.35e+154)
tmp = x / ((x + y) * (y + (x + 1.0)));
else
tmp = (x / (x + y)) / (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[y, 3.5e-137], N[(N[(1.0 / x), $MachinePrecision] * N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{-137}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x + \left(y + 1\right)}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 3.5000000000000001e-137Initial program 66.6%
times-frac85.5%
associate-+l+85.5%
Simplified85.5%
Taylor expanded in x around inf 61.9%
if 3.5000000000000001e-137 < y < 1.35000000000000003e154Initial program 70.0%
associate-/r*77.4%
+-commutative77.4%
+-commutative77.4%
+-commutative77.4%
associate-/r*70.0%
associate-*l/79.2%
*-commutative79.2%
*-commutative79.2%
distribute-rgt1-in69.5%
fma-def79.2%
+-commutative79.2%
+-commutative79.2%
cube-unmult79.2%
+-commutative79.2%
Simplified79.2%
associate-*r/70.0%
fma-udef63.5%
cube-mult63.5%
distribute-rgt1-in70.0%
associate-+r+70.0%
*-commutative70.0%
frac-times89.9%
*-commutative89.9%
associate-/r*99.7%
frac-times90.0%
+-commutative90.0%
+-commutative90.0%
associate-+l+90.0%
+-commutative90.0%
Applied egg-rr90.0%
Taylor expanded in x around 0 71.6%
if 1.35000000000000003e154 < y Initial program 59.1%
associate-/r*59.1%
+-commutative59.1%
+-commutative59.1%
+-commutative59.1%
associate-/r*59.1%
associate-*l/88.4%
*-commutative88.4%
*-commutative88.4%
distribute-rgt1-in85.7%
fma-def88.4%
+-commutative88.4%
+-commutative88.4%
cube-unmult88.4%
+-commutative88.4%
Simplified88.4%
associate-*r/59.1%
fma-udef59.1%
cube-mult59.1%
distribute-rgt1-in59.1%
associate-+r+59.1%
*-commutative59.1%
*-commutative59.1%
frac-times88.4%
associate-/r*99.8%
clear-num99.8%
frac-times99.6%
*-un-lft-identity99.6%
+-commutative99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 92.6%
Final simplification69.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.55e-135)
(* (/ 1.0 x) (/ y (+ x (+ y 1.0))))
(if (<= y 1.35e+154)
(/ x (* (+ x y) (+ y (+ x 1.0))))
(/ (/ x (+ x y)) (- y (* x -2.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.55e-135) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else if (y <= 1.35e+154) {
tmp = x / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / (y - (x * -2.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.55d-135) then
tmp = (1.0d0 / x) * (y / (x + (y + 1.0d0)))
else if (y <= 1.35d+154) then
tmp = x / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / (x + y)) / (y - (x * (-2.0d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.55e-135) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else if (y <= 1.35e+154) {
tmp = x / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / (y - (x * -2.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.55e-135: tmp = (1.0 / x) * (y / (x + (y + 1.0))) elif y <= 1.35e+154: tmp = x / ((x + y) * (y + (x + 1.0))) else: tmp = (x / (x + y)) / (y - (x * -2.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.55e-135) tmp = Float64(Float64(1.0 / x) * Float64(y / Float64(x + Float64(y + 1.0)))); elseif (y <= 1.35e+154) tmp = Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y - Float64(x * -2.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.55e-135)
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
elseif (y <= 1.35e+154)
tmp = x / ((x + y) * (y + (x + 1.0)));
else
tmp = (x / (x + y)) / (y - (x * -2.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.55e-135], N[(N[(1.0 / x), $MachinePrecision] * N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y - N[(x * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55 \cdot 10^{-135}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x + \left(y + 1\right)}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y - x \cdot -2}\\
\end{array}
\end{array}
if y < 1.55e-135Initial program 66.6%
times-frac85.5%
associate-+l+85.5%
Simplified85.5%
Taylor expanded in x around inf 61.9%
if 1.55e-135 < y < 1.35000000000000003e154Initial program 70.0%
associate-/r*77.4%
+-commutative77.4%
+-commutative77.4%
+-commutative77.4%
associate-/r*70.0%
associate-*l/79.2%
*-commutative79.2%
*-commutative79.2%
distribute-rgt1-in69.5%
fma-def79.2%
+-commutative79.2%
+-commutative79.2%
cube-unmult79.2%
+-commutative79.2%
Simplified79.2%
associate-*r/70.0%
fma-udef63.5%
cube-mult63.5%
distribute-rgt1-in70.0%
associate-+r+70.0%
*-commutative70.0%
frac-times89.9%
*-commutative89.9%
associate-/r*99.7%
frac-times90.0%
+-commutative90.0%
+-commutative90.0%
associate-+l+90.0%
+-commutative90.0%
Applied egg-rr90.0%
Taylor expanded in x around 0 71.6%
if 1.35000000000000003e154 < y Initial program 59.1%
associate-/r*59.1%
+-commutative59.1%
+-commutative59.1%
+-commutative59.1%
associate-/r*59.1%
associate-*l/88.4%
*-commutative88.4%
*-commutative88.4%
distribute-rgt1-in85.7%
fma-def88.4%
+-commutative88.4%
+-commutative88.4%
cube-unmult88.4%
+-commutative88.4%
Simplified88.4%
associate-*r/59.1%
fma-udef59.1%
cube-mult59.1%
distribute-rgt1-in59.1%
associate-+r+59.1%
*-commutative59.1%
*-commutative59.1%
frac-times88.4%
associate-/r*99.8%
clear-num99.8%
frac-times99.6%
*-un-lft-identity99.6%
+-commutative99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in y around -inf 92.8%
mul-1-neg92.8%
neg-mul-192.8%
distribute-lft-in92.8%
metadata-eval92.8%
neg-mul-192.8%
sub-neg92.8%
+-commutative92.8%
sub-neg92.8%
metadata-eval92.8%
neg-mul-192.8%
distribute-lft-in92.8%
sub-neg92.8%
unsub-neg92.8%
distribute-lft-in92.8%
metadata-eval92.8%
neg-mul-192.8%
sub-neg92.8%
Simplified92.8%
Taylor expanded in x around inf 92.8%
*-commutative92.8%
Simplified92.8%
Final simplification69.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.7e-83) (* (/ 1.0 x) (/ y (+ x (+ y 1.0)))) (/ (/ x y) (+ (+ x y) 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.7e-83) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else {
tmp = (x / y) / ((x + 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.7d-83)) then
tmp = (1.0d0 / x) * (y / (x + (y + 1.0d0)))
else
tmp = (x / y) / ((x + 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.7e-83) {
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
} else {
tmp = (x / y) / ((x + y) + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.7e-83: tmp = (1.0 / x) * (y / (x + (y + 1.0))) else: tmp = (x / y) / ((x + y) + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.7e-83) tmp = Float64(Float64(1.0 / x) * Float64(y / Float64(x + Float64(y + 1.0)))); else tmp = Float64(Float64(x / y) / Float64(Float64(x + 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.7e-83)
tmp = (1.0 / x) * (y / (x + (y + 1.0)));
else
tmp = (x / y) / ((x + 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.7e-83], N[(N[(1.0 / x), $MachinePrecision] * N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-83}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x + \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\left(x + y\right) + 1}\\
\end{array}
\end{array}
if x < -1.6999999999999999e-83Initial program 63.5%
times-frac88.2%
associate-+l+88.2%
Simplified88.2%
Taylor expanded in x around inf 70.7%
if -1.6999999999999999e-83 < x Initial program 67.6%
associate-/r*70.7%
+-commutative70.7%
+-commutative70.7%
+-commutative70.7%
associate-/l/67.6%
times-frac86.5%
*-commutative86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
associate-+l+86.5%
Simplified86.5%
Taylor expanded in y around inf 59.2%
expm1-log1p-u58.8%
expm1-udef40.0%
frac-times40.0%
*-un-lft-identity40.0%
Applied egg-rr40.0%
expm1-def57.1%
expm1-log1p57.5%
associate-/r*59.2%
associate-+r+59.2%
Simplified59.2%
Final simplification62.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.02e+16) (/ y (* x x)) (if (or (<= x -5.6e-168) (not (<= x 1.25e-186))) (/ x (* y y)) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.02e+16) {
tmp = y / (x * x);
} else if ((x <= -5.6e-168) || !(x <= 1.25e-186)) {
tmp = x / (y * 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 <= (-1.02d+16)) then
tmp = y / (x * x)
else if ((x <= (-5.6d-168)) .or. (.not. (x <= 1.25d-186))) then
tmp = x / (y * 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 <= -1.02e+16) {
tmp = y / (x * x);
} else if ((x <= -5.6e-168) || !(x <= 1.25e-186)) {
tmp = x / (y * y);
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.02e+16: tmp = y / (x * x) elif (x <= -5.6e-168) or not (x <= 1.25e-186): tmp = x / (y * y) else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.02e+16) tmp = Float64(y / Float64(x * x)); elseif ((x <= -5.6e-168) || !(x <= 1.25e-186)) tmp = Float64(x / Float64(y * 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 <= -1.02e+16)
tmp = y / (x * x);
elseif ((x <= -5.6e-168) || ~((x <= 1.25e-186)))
tmp = x / (y * 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, -1.02e+16], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -5.6e-168], N[Not[LessEqual[x, 1.25e-186]], $MachinePrecision]], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{+16}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -5.6 \cdot 10^{-168} \lor \neg \left(x \leq 1.25 \cdot 10^{-186}\right):\\
\;\;\;\;\frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.02e16Initial program 51.0%
associate-/r*59.2%
+-commutative59.2%
+-commutative59.2%
+-commutative59.2%
associate-/r*51.0%
associate-*l/76.2%
*-commutative76.2%
*-commutative76.2%
distribute-rgt1-in26.9%
fma-def76.2%
+-commutative76.2%
+-commutative76.2%
cube-unmult76.2%
+-commutative76.2%
Simplified76.2%
Taylor expanded in x around inf 70.9%
unpow270.9%
Simplified70.9%
if -1.02e16 < x < -5.6000000000000005e-168 or 1.25e-186 < x Initial program 72.3%
associate-/r*75.9%
+-commutative75.9%
+-commutative75.9%
+-commutative75.9%
associate-/r*72.3%
associate-*l/84.0%
*-commutative84.0%
*-commutative84.0%
distribute-rgt1-in75.8%
fma-def84.0%
+-commutative84.0%
+-commutative84.0%
cube-unmult83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in y around inf 38.6%
unpow238.6%
Simplified38.6%
if -5.6000000000000005e-168 < x < 1.25e-186Initial program 65.9%
times-frac80.8%
associate-+l+80.8%
Simplified80.8%
Taylor expanded in x around 0 90.4%
+-commutative90.4%
Simplified90.4%
Taylor expanded in y around 0 84.1%
Final simplification54.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.26e+16) (/ y (* x x)) (if (or (<= x -1.15e-169) (not (<= x 7e-175))) (/ (/ x y) y) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.26e+16) {
tmp = y / (x * x);
} else if ((x <= -1.15e-169) || !(x <= 7e-175)) {
tmp = (x / y) / 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 <= (-1.26d+16)) then
tmp = y / (x * x)
else if ((x <= (-1.15d-169)) .or. (.not. (x <= 7d-175))) then
tmp = (x / y) / 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 <= -1.26e+16) {
tmp = y / (x * x);
} else if ((x <= -1.15e-169) || !(x <= 7e-175)) {
tmp = (x / y) / y;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.26e+16: tmp = y / (x * x) elif (x <= -1.15e-169) or not (x <= 7e-175): tmp = (x / y) / y else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.26e+16) tmp = Float64(y / Float64(x * x)); elseif ((x <= -1.15e-169) || !(x <= 7e-175)) tmp = Float64(Float64(x / y) / 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 <= -1.26e+16)
tmp = y / (x * x);
elseif ((x <= -1.15e-169) || ~((x <= 7e-175)))
tmp = (x / y) / 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, -1.26e+16], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.15e-169], N[Not[LessEqual[x, 7e-175]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.26 \cdot 10^{+16}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-169} \lor \neg \left(x \leq 7 \cdot 10^{-175}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.26e16Initial program 51.0%
associate-/r*59.2%
+-commutative59.2%
+-commutative59.2%
+-commutative59.2%
associate-/r*51.0%
associate-*l/76.2%
*-commutative76.2%
*-commutative76.2%
distribute-rgt1-in26.9%
fma-def76.2%
+-commutative76.2%
+-commutative76.2%
cube-unmult76.2%
+-commutative76.2%
Simplified76.2%
Taylor expanded in x around inf 70.9%
unpow270.9%
Simplified70.9%
if -1.26e16 < x < -1.15e-169 or 6.99999999999999997e-175 < x Initial program 72.1%
associate-/r*75.7%
+-commutative75.7%
+-commutative75.7%
+-commutative75.7%
associate-/r*72.1%
associate-*l/83.9%
*-commutative83.9%
*-commutative83.9%
distribute-rgt1-in76.3%
fma-def83.9%
+-commutative83.9%
+-commutative83.9%
cube-unmult83.8%
+-commutative83.8%
Simplified83.8%
Taylor expanded in y around inf 38.2%
unpow238.2%
Simplified38.2%
*-un-lft-identity38.2%
times-frac41.6%
Applied egg-rr41.6%
associate-*l/41.6%
*-lft-identity41.6%
Simplified41.6%
if -1.15e-169 < x < 6.99999999999999997e-175Initial program 66.6%
times-frac81.2%
associate-+l+81.2%
Simplified81.2%
Taylor expanded in x around 0 90.6%
+-commutative90.6%
Simplified90.6%
Taylor expanded in y around 0 84.4%
Final simplification56.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.58e+16) (/ y (* x x)) (if (<= x 8.5e-173) (/ x (* y (+ y 1.0))) (/ (/ x y) y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.58e+16) {
tmp = y / (x * x);
} else if (x <= 8.5e-173) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / y) / 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 <= (-1.58d+16)) then
tmp = y / (x * x)
else if (x <= 8.5d-173) then
tmp = x / (y * (y + 1.0d0))
else
tmp = (x / y) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.58e+16) {
tmp = y / (x * x);
} else if (x <= 8.5e-173) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / y) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.58e+16: tmp = y / (x * x) elif x <= 8.5e-173: tmp = x / (y * (y + 1.0)) else: tmp = (x / y) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.58e+16) tmp = Float64(y / Float64(x * x)); elseif (x <= 8.5e-173) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(Float64(x / y) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.58e+16)
tmp = y / (x * x);
elseif (x <= 8.5e-173)
tmp = x / (y * (y + 1.0));
else
tmp = (x / y) / 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, -1.58e+16], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e-173], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.58 \cdot 10^{+16}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-173}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -1.58e16Initial program 51.0%
associate-/r*59.2%
+-commutative59.2%
+-commutative59.2%
+-commutative59.2%
associate-/r*51.0%
associate-*l/76.2%
*-commutative76.2%
*-commutative76.2%
distribute-rgt1-in26.9%
fma-def76.2%
+-commutative76.2%
+-commutative76.2%
cube-unmult76.2%
+-commutative76.2%
Simplified76.2%
Taylor expanded in x around inf 70.9%
unpow270.9%
Simplified70.9%
if -1.58e16 < x < 8.4999999999999996e-173Initial program 78.4%
times-frac89.2%
associate-+l+89.2%
Simplified89.2%
Taylor expanded in x around 0 73.7%
+-commutative73.7%
Simplified73.7%
if 8.4999999999999996e-173 < x Initial program 64.6%
associate-/r*69.7%
+-commutative69.7%
+-commutative69.7%
+-commutative69.7%
associate-/r*64.6%
associate-*l/80.1%
*-commutative80.1%
*-commutative80.1%
distribute-rgt1-in70.6%
fma-def80.1%
+-commutative80.1%
+-commutative80.1%
cube-unmult80.1%
+-commutative80.1%
Simplified80.1%
Taylor expanded in y around inf 34.2%
unpow234.2%
Simplified34.2%
*-un-lft-identity34.2%
times-frac38.9%
Applied egg-rr38.9%
associate-*l/38.9%
*-lft-identity38.9%
Simplified38.9%
Final simplification58.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7.7e-84) (/ y (+ x (* x x))) (if (<= x 8.5e-173) (/ x (* y (+ y 1.0))) (/ (/ x y) y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7.7e-84) {
tmp = y / (x + (x * x));
} else if (x <= 8.5e-173) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / y) / 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 <= (-7.7d-84)) then
tmp = y / (x + (x * x))
else if (x <= 8.5d-173) then
tmp = x / (y * (y + 1.0d0))
else
tmp = (x / y) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -7.7e-84) {
tmp = y / (x + (x * x));
} else if (x <= 8.5e-173) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / y) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -7.7e-84: tmp = y / (x + (x * x)) elif x <= 8.5e-173: tmp = x / (y * (y + 1.0)) else: tmp = (x / y) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -7.7e-84) tmp = Float64(y / Float64(x + Float64(x * x))); elseif (x <= 8.5e-173) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(Float64(x / y) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -7.7e-84)
tmp = y / (x + (x * x));
elseif (x <= 8.5e-173)
tmp = x / (y * (y + 1.0));
else
tmp = (x / y) / 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, -7.7e-84], N[(y / N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e-173], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.7 \cdot 10^{-84}:\\
\;\;\;\;\frac{y}{x + x \cdot x}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-173}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -7.7000000000000001e-84Initial program 63.5%
times-frac88.2%
associate-+l+88.2%
Simplified88.2%
Taylor expanded in y around 0 70.8%
distribute-lft-in70.8%
*-rgt-identity70.8%
Simplified70.8%
if -7.7000000000000001e-84 < x < 8.4999999999999996e-173Initial program 72.3%
times-frac86.3%
associate-+l+86.3%
Simplified86.3%
Taylor expanded in x around 0 86.7%
+-commutative86.7%
Simplified86.7%
if 8.4999999999999996e-173 < x Initial program 64.6%
associate-/r*69.7%
+-commutative69.7%
+-commutative69.7%
+-commutative69.7%
associate-/r*64.6%
associate-*l/80.1%
*-commutative80.1%
*-commutative80.1%
distribute-rgt1-in70.6%
fma-def80.1%
+-commutative80.1%
+-commutative80.1%
cube-unmult80.1%
+-commutative80.1%
Simplified80.1%
Taylor expanded in y around inf 34.2%
unpow234.2%
Simplified34.2%
*-un-lft-identity34.2%
times-frac38.9%
Applied egg-rr38.9%
associate-*l/38.9%
*-lft-identity38.9%
Simplified38.9%
Final simplification61.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.7e-83) (/ y (+ x (* x x))) (/ (/ x y) (+ (+ x y) 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.7e-83) {
tmp = y / (x + (x * x));
} else {
tmp = (x / y) / ((x + 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.7d-83)) then
tmp = y / (x + (x * x))
else
tmp = (x / y) / ((x + 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.7e-83) {
tmp = y / (x + (x * x));
} else {
tmp = (x / y) / ((x + y) + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.7e-83: tmp = y / (x + (x * x)) else: tmp = (x / y) / ((x + y) + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.7e-83) tmp = Float64(y / Float64(x + Float64(x * x))); else tmp = Float64(Float64(x / y) / Float64(Float64(x + 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.7e-83)
tmp = y / (x + (x * x));
else
tmp = (x / y) / ((x + 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.7e-83], N[(y / N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-83}:\\
\;\;\;\;\frac{y}{x + x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\left(x + y\right) + 1}\\
\end{array}
\end{array}
if x < -1.6999999999999999e-83Initial program 63.5%
times-frac88.2%
associate-+l+88.2%
Simplified88.2%
Taylor expanded in y around 0 70.8%
distribute-lft-in70.8%
*-rgt-identity70.8%
Simplified70.8%
if -1.6999999999999999e-83 < x Initial program 67.6%
associate-/r*70.7%
+-commutative70.7%
+-commutative70.7%
+-commutative70.7%
associate-/l/67.6%
times-frac86.5%
*-commutative86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
associate-+l+86.5%
Simplified86.5%
Taylor expanded in y around inf 59.2%
expm1-log1p-u58.8%
expm1-udef40.0%
frac-times40.0%
*-un-lft-identity40.0%
Applied egg-rr40.0%
expm1-def57.1%
expm1-log1p57.5%
associate-/r*59.2%
associate-+r+59.2%
Simplified59.2%
Final simplification62.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (or (<= y -4.2e-23) (not (<= y 0.72))) (/ x (* y y)) (- (/ x y) x)))
assert(x < y);
double code(double x, double y) {
double tmp;
if ((y <= -4.2e-23) || !(y <= 0.72)) {
tmp = x / (y * y);
} else {
tmp = (x / 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.2d-23)) .or. (.not. (y <= 0.72d0))) then
tmp = x / (y * y)
else
tmp = (x / y) - x
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if ((y <= -4.2e-23) || !(y <= 0.72)) {
tmp = x / (y * y);
} else {
tmp = (x / y) - x;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if (y <= -4.2e-23) or not (y <= 0.72): tmp = x / (y * y) else: tmp = (x / y) - x return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if ((y <= -4.2e-23) || !(y <= 0.72)) tmp = Float64(x / Float64(y * y)); else tmp = Float64(Float64(x / y) - x); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if ((y <= -4.2e-23) || ~((y <= 0.72)))
tmp = x / (y * y);
else
tmp = (x / 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[Or[LessEqual[y, -4.2e-23], N[Not[LessEqual[y, 0.72]], $MachinePrecision]], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{-23} \lor \neg \left(y \leq 0.72\right):\\
\;\;\;\;\frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - x\\
\end{array}
\end{array}
if y < -4.2000000000000002e-23 or 0.71999999999999997 < y Initial program 60.1%
associate-/r*65.9%
+-commutative65.9%
+-commutative65.9%
+-commutative65.9%
associate-/r*60.1%
associate-*l/75.6%
*-commutative75.6%
*-commutative75.6%
distribute-rgt1-in53.7%
fma-def75.6%
+-commutative75.6%
+-commutative75.6%
cube-unmult75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in y around inf 68.7%
unpow268.7%
Simplified68.7%
if -4.2000000000000002e-23 < y < 0.71999999999999997Initial program 74.6%
times-frac90.6%
associate-+l+90.6%
Simplified90.6%
Taylor expanded in x around 0 19.2%
+-commutative19.2%
Simplified19.2%
Taylor expanded in y around 0 19.2%
neg-mul-119.2%
+-commutative19.2%
unsub-neg19.2%
Simplified19.2%
Final simplification47.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 0.5 x))
assert(x < y);
double code(double x, double y) {
return 0.5 / 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 = 0.5d0 / x
end function
assert x < y;
public static double code(double x, double y) {
return 0.5 / x;
}
[x, y] = sort([x, y]) def code(x, y): return 0.5 / x
x, y = sort([x, y]) function code(x, y) return Float64(0.5 / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 0.5 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(0.5 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{0.5}{x}
\end{array}
Initial program 66.3%
associate-/r*70.3%
+-commutative70.3%
+-commutative70.3%
+-commutative70.3%
associate-/r*66.3%
associate-*l/81.3%
*-commutative81.3%
*-commutative81.3%
distribute-rgt1-in63.3%
fma-def81.3%
+-commutative81.3%
+-commutative81.3%
cube-unmult81.3%
+-commutative81.3%
Simplified81.3%
associate-*r/66.3%
fma-udef54.0%
cube-mult54.0%
distribute-rgt1-in66.3%
associate-+r+66.3%
*-commutative66.3%
*-commutative66.3%
frac-times87.0%
associate-/r*99.7%
clear-num99.7%
frac-times99.2%
*-un-lft-identity99.2%
+-commutative99.2%
+-commutative99.2%
associate-+l+99.2%
+-commutative99.2%
Applied egg-rr99.2%
Taylor expanded in y around -inf 51.6%
mul-1-neg51.6%
neg-mul-151.6%
distribute-lft-in51.6%
metadata-eval51.6%
neg-mul-151.6%
sub-neg51.6%
+-commutative51.6%
sub-neg51.6%
metadata-eval51.6%
neg-mul-151.6%
distribute-lft-in51.6%
sub-neg51.6%
unsub-neg51.6%
distribute-lft-in51.6%
metadata-eval51.6%
neg-mul-151.6%
sub-neg51.6%
Simplified51.6%
Taylor expanded in x around inf 4.3%
Final simplification4.3%
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%
times-frac87.0%
associate-+l+87.0%
Simplified87.0%
Taylor expanded in x around 0 48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in y around 0 22.6%
Final simplification22.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 2023275
(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))))