
(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 19 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}
(FPCore (x y) :precision binary64 (/ (* (/ y (+ y x)) (/ x (+ y (+ x 1.0)))) (+ y x)))
double code(double x, double y) {
return ((y / (y + x)) * (x / (y + (x + 1.0)))) / (y + x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y / (y + x)) * (x / (y + (x + 1.0d0)))) / (y + x)
end function
public static double code(double x, double y) {
return ((y / (y + x)) * (x / (y + (x + 1.0)))) / (y + x);
}
def code(x, y): return ((y / (y + x)) * (x / (y + (x + 1.0)))) / (y + x)
function code(x, y) return Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(y + Float64(x + 1.0)))) / Float64(y + x)) end
function tmp = code(x, y) tmp = ((y / (y + x)) * (x / (y + (x + 1.0)))) / (y + x); end
code[x_, y_] := N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{y + x} \cdot \frac{x}{y + \left(x + 1\right)}}{y + x}
\end{array}
Initial program 68.6%
times-frac87.9%
+-commutative87.9%
+-commutative87.9%
+-commutative87.9%
times-frac68.6%
associate-*l/79.6%
*-commutative79.6%
*-commutative79.6%
distribute-rgt1-in61.4%
fma-def79.6%
+-commutative79.6%
+-commutative79.6%
cube-unmult79.6%
+-commutative79.6%
Simplified79.6%
associate-*r/68.7%
fma-udef56.2%
cube-mult56.2%
distribute-rgt1-in68.6%
associate-+r+68.6%
*-commutative68.6%
frac-times87.8%
associate-/r*99.7%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (/ (/ y (+ y x)) (+ y x)))))
(if (<= y -2e-294)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= y 4.1e-131)
t_0
(if (<= y 5.8e-62)
(/ (/ y x) (+ x 1.0))
(if (<= y 7e-17)
t_0
(* x (/ (/ 1.0 (+ x (+ y (+ x 1.0)))) (+ y x)))))))))
double code(double x, double y) {
double t_0 = x * ((y / (y + x)) / (y + x));
double tmp;
if (y <= -2e-294) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 4.1e-131) {
tmp = t_0;
} else if (y <= 5.8e-62) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 7e-17) {
tmp = t_0;
} else {
tmp = x * ((1.0 / (x + (y + (x + 1.0)))) / (y + x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x * ((y / (y + x)) / (y + x))
if (y <= (-2d-294)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (y <= 4.1d-131) then
tmp = t_0
else if (y <= 5.8d-62) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 7d-17) then
tmp = t_0
else
tmp = x * ((1.0d0 / (x + (y + (x + 1.0d0)))) / (y + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * ((y / (y + x)) / (y + x));
double tmp;
if (y <= -2e-294) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 4.1e-131) {
tmp = t_0;
} else if (y <= 5.8e-62) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 7e-17) {
tmp = t_0;
} else {
tmp = x * ((1.0 / (x + (y + (x + 1.0)))) / (y + x));
}
return tmp;
}
def code(x, y): t_0 = x * ((y / (y + x)) / (y + x)) tmp = 0 if y <= -2e-294: tmp = (y / (x + 1.0)) / (y + x) elif y <= 4.1e-131: tmp = t_0 elif y <= 5.8e-62: tmp = (y / x) / (x + 1.0) elif y <= 7e-17: tmp = t_0 else: tmp = x * ((1.0 / (x + (y + (x + 1.0)))) / (y + x)) return tmp
function code(x, y) t_0 = Float64(x * Float64(Float64(y / Float64(y + x)) / Float64(y + x))) tmp = 0.0 if (y <= -2e-294) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (y <= 4.1e-131) tmp = t_0; elseif (y <= 5.8e-62) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 7e-17) tmp = t_0; else tmp = Float64(x * Float64(Float64(1.0 / Float64(x + Float64(y + Float64(x + 1.0)))) / Float64(y + x))); end return tmp end
function tmp_2 = code(x, y) t_0 = x * ((y / (y + x)) / (y + x)); tmp = 0.0; if (y <= -2e-294) tmp = (y / (x + 1.0)) / (y + x); elseif (y <= 4.1e-131) tmp = t_0; elseif (y <= 5.8e-62) tmp = (y / x) / (x + 1.0); elseif (y <= 7e-17) tmp = t_0; else tmp = x * ((1.0 / (x + (y + (x + 1.0)))) / (y + x)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e-294], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e-131], t$95$0, If[LessEqual[y, 5.8e-62], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e-17], t$95$0, N[(x * N[(N[(1.0 / N[(x + N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{\frac{y}{y + x}}{y + x}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-294}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-131}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-62}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{x + \left(y + \left(x + 1\right)\right)}}{y + x}\\
\end{array}
\end{array}
if y < -2.00000000000000003e-294Initial program 61.2%
times-frac85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
times-frac61.2%
associate-*l/75.8%
*-commutative75.8%
*-commutative75.8%
distribute-rgt1-in50.7%
fma-def75.8%
+-commutative75.8%
+-commutative75.8%
cube-unmult75.8%
+-commutative75.8%
Simplified75.8%
associate-*r/61.2%
fma-udef47.0%
cube-mult47.0%
distribute-rgt1-in61.2%
associate-+r+61.2%
*-commutative61.2%
frac-times84.9%
associate-/r*99.6%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 43.2%
+-commutative43.2%
Simplified43.2%
if -2.00000000000000003e-294 < y < 4.1000000000000002e-131 or 5.79999999999999971e-62 < y < 7.0000000000000003e-17Initial program 75.8%
associate-/r*77.3%
*-commutative77.3%
+-commutative77.3%
+-commutative77.3%
associate-*l/84.8%
+-commutative84.8%
associate-*r/84.8%
remove-double-neg84.8%
+-commutative84.8%
+-commutative84.8%
remove-double-neg84.8%
+-commutative84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 78.7%
+-commutative78.7%
Simplified78.7%
Taylor expanded in y around 0 78.7%
associate-/r*93.7%
div-inv93.8%
Applied egg-rr93.8%
associate-*r/93.7%
*-rgt-identity93.7%
Simplified93.7%
if 4.1000000000000002e-131 < y < 5.79999999999999971e-62Initial program 79.8%
associate-/r*90.9%
*-commutative90.9%
+-commutative90.9%
+-commutative90.9%
associate-*l/99.4%
+-commutative99.4%
associate-*r/99.4%
remove-double-neg99.4%
+-commutative99.4%
+-commutative99.4%
remove-double-neg99.4%
+-commutative99.4%
associate-+l+99.4%
Simplified99.4%
Taylor expanded in y around 0 88.2%
associate-/r*88.4%
+-commutative88.4%
Simplified88.4%
if 7.0000000000000003e-17 < y Initial program 70.9%
times-frac92.0%
+-commutative92.0%
+-commutative92.0%
+-commutative92.0%
times-frac70.9%
associate-*l/79.8%
*-commutative79.8%
*-commutative79.8%
distribute-rgt1-in70.2%
fma-def79.9%
+-commutative79.9%
+-commutative79.9%
cube-unmult79.9%
+-commutative79.9%
Simplified79.9%
associate-*r/71.0%
fma-udef65.6%
cube-mult65.6%
distribute-rgt1-in70.9%
associate-+r+70.9%
*-commutative70.9%
frac-times92.0%
associate-/r*99.8%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
clear-num99.8%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around -inf 76.5%
mul-1-neg76.5%
unsub-neg76.5%
neg-mul-176.5%
distribute-lft-in76.5%
metadata-eval76.5%
neg-mul-176.5%
associate-+r+76.5%
unsub-neg76.5%
+-commutative76.5%
unsub-neg76.5%
Simplified76.5%
div-inv76.4%
+-commutative76.4%
*-un-lft-identity76.4%
times-frac86.1%
/-rgt-identity86.1%
associate--r-86.1%
Applied egg-rr86.1%
Final simplification70.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (/ (/ y (+ y x)) (+ y x)))))
(if (<= y -2e-294)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= y 1.2e-129)
t_0
(if (<= y 1.7e-62)
(/ (/ y x) (+ x 1.0))
(if (<= y 0.46) t_0 (* (/ y (* (+ y x) (+ y x))) (/ x y))))))))
double code(double x, double y) {
double t_0 = x * ((y / (y + x)) / (y + x));
double tmp;
if (y <= -2e-294) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 1.2e-129) {
tmp = t_0;
} else if (y <= 1.7e-62) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 0.46) {
tmp = t_0;
} else {
tmp = (y / ((y + x) * (y + x))) * (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x * ((y / (y + x)) / (y + x))
if (y <= (-2d-294)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (y <= 1.2d-129) then
tmp = t_0
else if (y <= 1.7d-62) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 0.46d0) then
tmp = t_0
else
tmp = (y / ((y + x) * (y + x))) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * ((y / (y + x)) / (y + x));
double tmp;
if (y <= -2e-294) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 1.2e-129) {
tmp = t_0;
} else if (y <= 1.7e-62) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 0.46) {
tmp = t_0;
} else {
tmp = (y / ((y + x) * (y + x))) * (x / y);
}
return tmp;
}
def code(x, y): t_0 = x * ((y / (y + x)) / (y + x)) tmp = 0 if y <= -2e-294: tmp = (y / (x + 1.0)) / (y + x) elif y <= 1.2e-129: tmp = t_0 elif y <= 1.7e-62: tmp = (y / x) / (x + 1.0) elif y <= 0.46: tmp = t_0 else: tmp = (y / ((y + x) * (y + x))) * (x / y) return tmp
function code(x, y) t_0 = Float64(x * Float64(Float64(y / Float64(y + x)) / Float64(y + x))) tmp = 0.0 if (y <= -2e-294) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (y <= 1.2e-129) tmp = t_0; elseif (y <= 1.7e-62) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 0.46) tmp = t_0; else tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = x * ((y / (y + x)) / (y + x)); tmp = 0.0; if (y <= -2e-294) tmp = (y / (x + 1.0)) / (y + x); elseif (y <= 1.2e-129) tmp = t_0; elseif (y <= 1.7e-62) tmp = (y / x) / (x + 1.0); elseif (y <= 0.46) tmp = t_0; else tmp = (y / ((y + x) * (y + x))) * (x / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e-294], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e-129], t$95$0, If[LessEqual[y, 1.7e-62], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.46], t$95$0, N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{\frac{y}{y + x}}{y + x}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-294}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-129}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-62}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 0.46:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -2.00000000000000003e-294Initial program 61.2%
times-frac85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
times-frac61.2%
associate-*l/75.8%
*-commutative75.8%
*-commutative75.8%
distribute-rgt1-in50.7%
fma-def75.8%
+-commutative75.8%
+-commutative75.8%
cube-unmult75.8%
+-commutative75.8%
Simplified75.8%
associate-*r/61.2%
fma-udef47.0%
cube-mult47.0%
distribute-rgt1-in61.2%
associate-+r+61.2%
*-commutative61.2%
frac-times84.9%
associate-/r*99.6%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 43.2%
+-commutative43.2%
Simplified43.2%
if -2.00000000000000003e-294 < y < 1.19999999999999994e-129 or 1.69999999999999994e-62 < y < 0.46000000000000002Initial program 76.5%
associate-/r*78.0%
*-commutative78.0%
+-commutative78.0%
+-commutative78.0%
associate-*l/85.3%
+-commutative85.3%
associate-*r/85.3%
remove-double-neg85.3%
+-commutative85.3%
+-commutative85.3%
remove-double-neg85.3%
+-commutative85.3%
associate-+l+85.3%
Simplified85.3%
Taylor expanded in x around 0 79.4%
+-commutative79.4%
Simplified79.4%
Taylor expanded in y around 0 79.1%
associate-/r*93.6%
div-inv93.7%
Applied egg-rr93.7%
associate-*r/93.6%
*-rgt-identity93.6%
Simplified93.6%
if 1.19999999999999994e-129 < y < 1.69999999999999994e-62Initial program 79.8%
associate-/r*90.9%
*-commutative90.9%
+-commutative90.9%
+-commutative90.9%
associate-*l/99.4%
+-commutative99.4%
associate-*r/99.4%
remove-double-neg99.4%
+-commutative99.4%
+-commutative99.4%
remove-double-neg99.4%
+-commutative99.4%
associate-+l+99.4%
Simplified99.4%
Taylor expanded in y around 0 88.2%
associate-/r*88.4%
+-commutative88.4%
Simplified88.4%
if 0.46000000000000002 < y Initial program 70.1%
associate-/r*78.1%
*-commutative78.1%
+-commutative78.1%
+-commutative78.1%
associate-*l/91.8%
+-commutative91.8%
associate-*r/91.8%
remove-double-neg91.8%
+-commutative91.8%
+-commutative91.8%
remove-double-neg91.8%
+-commutative91.8%
associate-+l+91.8%
Simplified91.8%
Taylor expanded in y around inf 85.5%
Final simplification70.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (/ (/ y (+ y x)) (+ y x)))))
(if (<= y -5.5e-296)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= y 2.1e-130)
t_0
(if (<= y 7.4e-68)
(/ (/ y x) (+ x 1.0))
(if (<= y 3.8e-13) t_0 (/ x (* y (+ y (+ x 1.0))))))))))
double code(double x, double y) {
double t_0 = x * ((y / (y + x)) / (y + x));
double tmp;
if (y <= -5.5e-296) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 2.1e-130) {
tmp = t_0;
} else if (y <= 7.4e-68) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 3.8e-13) {
tmp = t_0;
} else {
tmp = x / (y * (y + (x + 1.0)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x * ((y / (y + x)) / (y + x))
if (y <= (-5.5d-296)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (y <= 2.1d-130) then
tmp = t_0
else if (y <= 7.4d-68) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 3.8d-13) then
tmp = t_0
else
tmp = x / (y * (y + (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * ((y / (y + x)) / (y + x));
double tmp;
if (y <= -5.5e-296) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 2.1e-130) {
tmp = t_0;
} else if (y <= 7.4e-68) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 3.8e-13) {
tmp = t_0;
} else {
tmp = x / (y * (y + (x + 1.0)));
}
return tmp;
}
def code(x, y): t_0 = x * ((y / (y + x)) / (y + x)) tmp = 0 if y <= -5.5e-296: tmp = (y / (x + 1.0)) / (y + x) elif y <= 2.1e-130: tmp = t_0 elif y <= 7.4e-68: tmp = (y / x) / (x + 1.0) elif y <= 3.8e-13: tmp = t_0 else: tmp = x / (y * (y + (x + 1.0))) return tmp
function code(x, y) t_0 = Float64(x * Float64(Float64(y / Float64(y + x)) / Float64(y + x))) tmp = 0.0 if (y <= -5.5e-296) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (y <= 2.1e-130) tmp = t_0; elseif (y <= 7.4e-68) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 3.8e-13) tmp = t_0; else tmp = Float64(x / Float64(y * Float64(y + Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y) t_0 = x * ((y / (y + x)) / (y + x)); tmp = 0.0; if (y <= -5.5e-296) tmp = (y / (x + 1.0)) / (y + x); elseif (y <= 2.1e-130) tmp = t_0; elseif (y <= 7.4e-68) tmp = (y / x) / (x + 1.0); elseif (y <= 3.8e-13) tmp = t_0; else tmp = x / (y * (y + (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e-296], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e-130], t$95$0, If[LessEqual[y, 7.4e-68], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e-13], t$95$0, N[(x / N[(y * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{\frac{y}{y + x}}{y + x}\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{-296}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-130}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{-68}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-13}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if y < -5.5000000000000004e-296Initial program 60.1%
times-frac83.5%
+-commutative83.5%
+-commutative83.5%
+-commutative83.5%
times-frac60.1%
associate-*l/74.4%
*-commutative74.4%
*-commutative74.4%
distribute-rgt1-in49.9%
fma-def74.5%
+-commutative74.5%
+-commutative74.5%
cube-unmult74.5%
+-commutative74.5%
Simplified74.5%
associate-*r/60.1%
fma-udef46.1%
cube-mult46.1%
distribute-rgt1-in60.1%
associate-+r+60.1%
*-commutative60.1%
frac-times83.4%
associate-/r*99.6%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 42.6%
+-commutative42.6%
Simplified42.6%
if -5.5000000000000004e-296 < y < 2.10000000000000002e-130 or 7.40000000000000004e-68 < y < 3.8e-13Initial program 78.7%
associate-/r*80.2%
*-commutative80.2%
+-commutative80.2%
+-commutative80.2%
associate-*l/87.8%
+-commutative87.8%
associate-*r/87.8%
remove-double-neg87.8%
+-commutative87.8%
+-commutative87.8%
remove-double-neg87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
Taylor expanded in x around 0 81.6%
+-commutative81.6%
Simplified81.6%
Taylor expanded in y around 0 81.6%
associate-/r*93.6%
div-inv93.7%
Applied egg-rr93.7%
associate-*r/93.6%
*-rgt-identity93.6%
Simplified93.6%
if 2.10000000000000002e-130 < y < 7.40000000000000004e-68Initial program 79.8%
associate-/r*90.9%
*-commutative90.9%
+-commutative90.9%
+-commutative90.9%
associate-*l/99.4%
+-commutative99.4%
associate-*r/99.4%
remove-double-neg99.4%
+-commutative99.4%
+-commutative99.4%
remove-double-neg99.4%
+-commutative99.4%
associate-+l+99.4%
Simplified99.4%
Taylor expanded in y around 0 88.2%
associate-/r*88.4%
+-commutative88.4%
Simplified88.4%
if 3.8e-13 < y Initial program 70.5%
associate-/r*78.4%
*-commutative78.4%
+-commutative78.4%
+-commutative78.4%
associate-*l/91.8%
+-commutative91.8%
associate-*r/91.9%
remove-double-neg91.9%
+-commutative91.9%
+-commutative91.9%
remove-double-neg91.9%
+-commutative91.9%
associate-+l+91.9%
Simplified91.9%
Taylor expanded in y around inf 76.5%
expm1-log1p-u76.5%
expm1-udef60.2%
frac-times60.2%
*-un-lft-identity60.2%
associate-+r+60.2%
+-commutative60.2%
associate-+r+60.2%
Applied egg-rr60.2%
expm1-def77.7%
expm1-log1p77.7%
Simplified77.7%
Final simplification67.3%
(FPCore (x y)
:precision binary64
(if (<= y -2.1e-294)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= y 1.6e-130)
(* x (/ (/ y (+ y x)) (+ y x)))
(if (<= y 9e-67)
(/ (/ y x) (+ x 1.0))
(* (/ y (* (+ y x) (+ y x))) (/ x (+ y 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -2.1e-294) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 1.6e-130) {
tmp = x * ((y / (y + x)) / (y + x));
} else if (y <= 9e-67) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-2.1d-294)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (y <= 1.6d-130) then
tmp = x * ((y / (y + x)) / (y + x))
else if (y <= 9d-67) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.1e-294) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 1.6e-130) {
tmp = x * ((y / (y + x)) / (y + x));
} else if (y <= 9e-67) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.1e-294: tmp = (y / (x + 1.0)) / (y + x) elif y <= 1.6e-130: tmp = x * ((y / (y + x)) / (y + x)) elif y <= 9e-67: tmp = (y / x) / (x + 1.0) else: tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.1e-294) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (y <= 1.6e-130) tmp = Float64(x * Float64(Float64(y / Float64(y + x)) / Float64(y + x))); elseif (y <= 9e-67) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(y + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.1e-294) tmp = (y / (x + 1.0)) / (y + x); elseif (y <= 1.6e-130) tmp = x * ((y / (y + x)) / (y + x)); elseif (y <= 9e-67) tmp = (y / x) / (x + 1.0); else tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.1e-294], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e-130], N[(x * N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e-67], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{-294}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-130}:\\
\;\;\;\;x \cdot \frac{\frac{y}{y + x}}{y + x}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-67}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if y < -2.09999999999999984e-294Initial program 61.2%
times-frac85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
times-frac61.2%
associate-*l/75.8%
*-commutative75.8%
*-commutative75.8%
distribute-rgt1-in50.7%
fma-def75.8%
+-commutative75.8%
+-commutative75.8%
cube-unmult75.8%
+-commutative75.8%
Simplified75.8%
associate-*r/61.2%
fma-udef47.0%
cube-mult47.0%
distribute-rgt1-in61.2%
associate-+r+61.2%
*-commutative61.2%
frac-times84.9%
associate-/r*99.6%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 43.2%
+-commutative43.2%
Simplified43.2%
if -2.09999999999999984e-294 < y < 1.6e-130Initial program 72.4%
associate-/r*72.4%
*-commutative72.4%
+-commutative72.4%
+-commutative72.4%
associate-*l/81.5%
+-commutative81.5%
associate-*r/81.5%
remove-double-neg81.5%
+-commutative81.5%
+-commutative81.5%
remove-double-neg81.5%
+-commutative81.5%
associate-+l+81.5%
Simplified81.5%
Taylor expanded in x around 0 76.0%
+-commutative76.0%
Simplified76.0%
Taylor expanded in y around 0 76.0%
associate-/r*94.3%
div-inv94.3%
Applied egg-rr94.3%
associate-*r/94.3%
*-rgt-identity94.3%
Simplified94.3%
if 1.6e-130 < y < 9.00000000000000031e-67Initial program 79.8%
associate-/r*90.9%
*-commutative90.9%
+-commutative90.9%
+-commutative90.9%
associate-*l/99.4%
+-commutative99.4%
associate-*r/99.4%
remove-double-neg99.4%
+-commutative99.4%
+-commutative99.4%
remove-double-neg99.4%
+-commutative99.4%
associate-+l+99.4%
Simplified99.4%
Taylor expanded in y around 0 88.2%
associate-/r*88.4%
+-commutative88.4%
Simplified88.4%
if 9.00000000000000031e-67 < y Initial program 73.6%
associate-/r*81.5%
*-commutative81.5%
+-commutative81.5%
+-commutative81.5%
associate-*l/93.0%
+-commutative93.0%
associate-*r/93.0%
remove-double-neg93.0%
+-commutative93.0%
+-commutative93.0%
remove-double-neg93.0%
+-commutative93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around 0 86.6%
+-commutative86.6%
Simplified86.6%
Final simplification70.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y (+ y x)))))
(if (<= y -8.5e-8)
t_0
(if (<= y 4.5e-59)
(/ y x)
(if (<= y 3800000000.0) (/ x (* y (+ y 1.0))) t_0)))))
double code(double x, double y) {
double t_0 = x / (y * (y + x));
double tmp;
if (y <= -8.5e-8) {
tmp = t_0;
} else if (y <= 4.5e-59) {
tmp = y / x;
} else if (y <= 3800000000.0) {
tmp = x / (y * (y + 1.0));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (y * (y + x))
if (y <= (-8.5d-8)) then
tmp = t_0
else if (y <= 4.5d-59) then
tmp = y / x
else if (y <= 3800000000.0d0) then
tmp = x / (y * (y + 1.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y * (y + x));
double tmp;
if (y <= -8.5e-8) {
tmp = t_0;
} else if (y <= 4.5e-59) {
tmp = y / x;
} else if (y <= 3800000000.0) {
tmp = x / (y * (y + 1.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / (y * (y + x)) tmp = 0 if y <= -8.5e-8: tmp = t_0 elif y <= 4.5e-59: tmp = y / x elif y <= 3800000000.0: tmp = x / (y * (y + 1.0)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y * Float64(y + x))) tmp = 0.0 if (y <= -8.5e-8) tmp = t_0; elseif (y <= 4.5e-59) tmp = Float64(y / x); elseif (y <= 3800000000.0) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y * (y + x)); tmp = 0.0; if (y <= -8.5e-8) tmp = t_0; elseif (y <= 4.5e-59) tmp = y / x; elseif (y <= 3800000000.0) tmp = x / (y * (y + 1.0)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.5e-8], t$95$0, If[LessEqual[y, 4.5e-59], N[(y / x), $MachinePrecision], If[LessEqual[y, 3800000000.0], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot \left(y + x\right)}\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{-8}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-59}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 3800000000:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -8.49999999999999935e-8 or 3.8e9 < y Initial program 61.7%
*-un-lft-identity61.7%
associate-+r+61.7%
associate-*l*61.7%
times-frac68.6%
associate-+r+68.6%
+-commutative68.6%
associate-+l+68.6%
Applied egg-rr68.6%
associate-/l*88.9%
frac-times86.7%
*-un-lft-identity86.7%
+-commutative86.7%
+-commutative86.7%
Applied egg-rr86.7%
Taylor expanded in y around inf 79.4%
if -8.49999999999999935e-8 < y < 4.50000000000000012e-59Initial program 72.7%
times-frac85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
times-frac72.7%
associate-*l/83.0%
*-commutative83.0%
*-commutative83.0%
distribute-rgt1-in67.9%
fma-def83.1%
+-commutative83.1%
+-commutative83.1%
cube-unmult83.1%
+-commutative83.1%
Simplified83.1%
associate-*r/72.7%
fma-udef57.6%
cube-mult57.6%
distribute-rgt1-in72.7%
associate-+r+72.7%
*-commutative72.7%
frac-times85.3%
associate-/r*99.7%
associate-*l/99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
clear-num99.7%
frac-times99.7%
*-un-lft-identity99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in x around 0 54.2%
if 4.50000000000000012e-59 < y < 3.8e9Initial program 93.4%
associate-/r*99.4%
*-commutative99.4%
+-commutative99.4%
+-commutative99.4%
associate-*l/99.5%
+-commutative99.5%
associate-*r/99.5%
remove-double-neg99.5%
+-commutative99.5%
+-commutative99.5%
remove-double-neg99.5%
+-commutative99.5%
associate-+l+99.5%
Simplified99.5%
Taylor expanded in x around 0 28.3%
+-commutative28.3%
Simplified28.3%
Final simplification64.7%
(FPCore (x y) :precision binary64 (if (<= y 1.4e-32) (/ (* (/ y (+ y x)) (/ x (+ x 1.0))) (+ y x)) (* (/ y (* (+ y x) (+ y x))) (/ x (+ x (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= 1.4e-32) {
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
} else {
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.4d-32) then
tmp = ((y / (y + x)) * (x / (x + 1.0d0))) / (y + x)
else
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.4e-32) {
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
} else {
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.4e-32: tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x) else: tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.4e-32) tmp = Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(x + 1.0))) / Float64(y + x)); else tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.4e-32) tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x); else tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.4e-32], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{-32}:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{x + 1}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 1.3999999999999999e-32Initial program 67.9%
times-frac86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
times-frac67.9%
associate-*l/79.8%
*-commutative79.8%
*-commutative79.8%
distribute-rgt1-in58.6%
fma-def79.8%
+-commutative79.8%
+-commutative79.8%
cube-unmult79.8%
+-commutative79.8%
Simplified79.8%
associate-*r/67.9%
fma-udef53.1%
cube-mult53.0%
distribute-rgt1-in67.9%
associate-+r+67.9%
*-commutative67.9%
frac-times86.1%
associate-/r*99.7%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 81.3%
+-commutative81.3%
Simplified81.3%
if 1.3999999999999999e-32 < y Initial program 70.4%
associate-/r*79.3%
*-commutative79.3%
+-commutative79.3%
+-commutative79.3%
associate-*l/92.2%
+-commutative92.2%
associate-*r/92.2%
remove-double-neg92.2%
+-commutative92.2%
+-commutative92.2%
remove-double-neg92.2%
+-commutative92.2%
associate-+l+92.2%
Simplified92.2%
Final simplification84.5%
(FPCore (x y)
:precision binary64
(if (<= y 1.05e-66)
(/ (/ y x) (+ x 1.0))
(if (<= y 6.6e-13)
(* x (/ y (* (+ y x) (+ y x))))
(/ x (* y (+ y (+ x 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= 1.05e-66) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6.6e-13) {
tmp = x * (y / ((y + x) * (y + x)));
} else {
tmp = x / (y * (y + (x + 1.0)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.05d-66) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 6.6d-13) then
tmp = x * (y / ((y + x) * (y + x)))
else
tmp = x / (y * (y + (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.05e-66) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6.6e-13) {
tmp = x * (y / ((y + x) * (y + x)));
} else {
tmp = x / (y * (y + (x + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.05e-66: tmp = (y / x) / (x + 1.0) elif y <= 6.6e-13: tmp = x * (y / ((y + x) * (y + x))) else: tmp = x / (y * (y + (x + 1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.05e-66) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 6.6e-13) tmp = Float64(x * Float64(y / Float64(Float64(y + x) * Float64(y + x)))); else tmp = Float64(x / Float64(y * Float64(y + Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.05e-66) tmp = (y / x) / (x + 1.0); elseif (y <= 6.6e-13) tmp = x * (y / ((y + x) * (y + x))); else tmp = x / (y * (y + (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.05e-66], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e-13], N[(x * N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.05 \cdot 10^{-66}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-13}:\\
\;\;\;\;x \cdot \frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if y < 1.05e-66Initial program 66.3%
associate-/r*69.5%
*-commutative69.5%
+-commutative69.5%
+-commutative69.5%
associate-*l/85.4%
+-commutative85.4%
associate-*r/85.4%
remove-double-neg85.4%
+-commutative85.4%
+-commutative85.4%
remove-double-neg85.4%
+-commutative85.4%
associate-+l+85.4%
Simplified85.4%
Taylor expanded in y around 0 61.6%
associate-/r*60.6%
+-commutative60.6%
Simplified60.6%
if 1.05e-66 < y < 6.6000000000000001e-13Initial program 92.0%
associate-/r*99.6%
*-commutative99.6%
+-commutative99.6%
+-commutative99.6%
associate-*l/99.7%
+-commutative99.7%
associate-*r/99.7%
remove-double-neg99.7%
+-commutative99.7%
+-commutative99.7%
remove-double-neg99.7%
+-commutative99.7%
associate-+l+99.7%
Simplified99.7%
Taylor expanded in x around 0 91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in y around 0 91.7%
if 6.6000000000000001e-13 < y Initial program 70.5%
associate-/r*78.4%
*-commutative78.4%
+-commutative78.4%
+-commutative78.4%
associate-*l/91.8%
+-commutative91.8%
associate-*r/91.9%
remove-double-neg91.9%
+-commutative91.9%
+-commutative91.9%
remove-double-neg91.9%
+-commutative91.9%
associate-+l+91.9%
Simplified91.9%
Taylor expanded in y around inf 76.5%
expm1-log1p-u76.5%
expm1-udef60.2%
frac-times60.2%
*-un-lft-identity60.2%
associate-+r+60.2%
+-commutative60.2%
associate-+r+60.2%
Applied egg-rr60.2%
expm1-def77.7%
expm1-log1p77.7%
Simplified77.7%
Final simplification66.8%
(FPCore (x y) :precision binary64 (if (<= y 7e-17) (/ (* (/ y (+ y x)) (/ x (+ x 1.0))) (+ y x)) (* x (/ (/ 1.0 (+ x (+ y (+ x 1.0)))) (+ y x)))))
double code(double x, double y) {
double tmp;
if (y <= 7e-17) {
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
} else {
tmp = x * ((1.0 / (x + (y + (x + 1.0)))) / (y + x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 7d-17) then
tmp = ((y / (y + x)) * (x / (x + 1.0d0))) / (y + x)
else
tmp = x * ((1.0d0 / (x + (y + (x + 1.0d0)))) / (y + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 7e-17) {
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
} else {
tmp = x * ((1.0 / (x + (y + (x + 1.0)))) / (y + x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 7e-17: tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x) else: tmp = x * ((1.0 / (x + (y + (x + 1.0)))) / (y + x)) return tmp
function code(x, y) tmp = 0.0 if (y <= 7e-17) tmp = Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(x + 1.0))) / Float64(y + x)); else tmp = Float64(x * Float64(Float64(1.0 / Float64(x + Float64(y + Float64(x + 1.0)))) / Float64(y + x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 7e-17) tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x); else tmp = x * ((1.0 / (x + (y + (x + 1.0)))) / (y + x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 7e-17], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(1.0 / N[(x + N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{x + 1}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{x + \left(y + \left(x + 1\right)\right)}}{y + x}\\
\end{array}
\end{array}
if y < 7.0000000000000003e-17Initial program 67.7%
times-frac86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
times-frac67.7%
associate-*l/79.5%
*-commutative79.5%
*-commutative79.5%
distribute-rgt1-in58.0%
fma-def79.5%
+-commutative79.5%
+-commutative79.5%
cube-unmult79.5%
+-commutative79.5%
Simplified79.5%
associate-*r/67.8%
fma-udef52.5%
cube-mult52.5%
distribute-rgt1-in67.7%
associate-+r+67.7%
*-commutative67.7%
frac-times86.2%
associate-/r*99.7%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 81.5%
+-commutative81.5%
Simplified81.5%
if 7.0000000000000003e-17 < y Initial program 70.9%
times-frac92.0%
+-commutative92.0%
+-commutative92.0%
+-commutative92.0%
times-frac70.9%
associate-*l/79.8%
*-commutative79.8%
*-commutative79.8%
distribute-rgt1-in70.2%
fma-def79.9%
+-commutative79.9%
+-commutative79.9%
cube-unmult79.9%
+-commutative79.9%
Simplified79.9%
associate-*r/71.0%
fma-udef65.6%
cube-mult65.6%
distribute-rgt1-in70.9%
associate-+r+70.9%
*-commutative70.9%
frac-times92.0%
associate-/r*99.8%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
clear-num99.8%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around -inf 76.5%
mul-1-neg76.5%
unsub-neg76.5%
neg-mul-176.5%
distribute-lft-in76.5%
metadata-eval76.5%
neg-mul-176.5%
associate-+r+76.5%
unsub-neg76.5%
+-commutative76.5%
unsub-neg76.5%
Simplified76.5%
div-inv76.4%
+-commutative76.4%
*-un-lft-identity76.4%
times-frac86.1%
/-rgt-identity86.1%
associate--r-86.1%
Applied egg-rr86.1%
Final simplification82.8%
(FPCore (x y) :precision binary64 (if (or (<= y -4e-20) (not (<= y 2.7e-59))) (/ x (* y (+ y 1.0))) (/ y x)))
double code(double x, double y) {
double tmp;
if ((y <= -4e-20) || !(y <= 2.7e-59)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = y / x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-4d-20)) .or. (.not. (y <= 2.7d-59))) then
tmp = x / (y * (y + 1.0d0))
else
tmp = y / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -4e-20) || !(y <= 2.7e-59)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = y / x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -4e-20) or not (y <= 2.7e-59): tmp = x / (y * (y + 1.0)) else: tmp = y / x return tmp
function code(x, y) tmp = 0.0 if ((y <= -4e-20) || !(y <= 2.7e-59)) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(y / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -4e-20) || ~((y <= 2.7e-59))) tmp = x / (y * (y + 1.0)); else tmp = y / x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -4e-20], N[Not[LessEqual[y, 2.7e-59]], $MachinePrecision]], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-20} \lor \neg \left(y \leq 2.7 \cdot 10^{-59}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x}\\
\end{array}
\end{array}
if y < -3.99999999999999978e-20 or 2.6999999999999999e-59 < y Initial program 65.6%
associate-/r*72.3%
*-commutative72.3%
+-commutative72.3%
+-commutative72.3%
associate-*l/90.2%
+-commutative90.2%
associate-*r/90.2%
remove-double-neg90.2%
+-commutative90.2%
+-commutative90.2%
remove-double-neg90.2%
+-commutative90.2%
associate-+l+90.2%
Simplified90.2%
Taylor expanded in x around 0 71.9%
+-commutative71.9%
Simplified71.9%
if -3.99999999999999978e-20 < y < 2.6999999999999999e-59Initial program 72.2%
times-frac85.1%
+-commutative85.1%
+-commutative85.1%
+-commutative85.1%
times-frac72.2%
associate-*l/82.8%
*-commutative82.8%
*-commutative82.8%
distribute-rgt1-in67.4%
fma-def82.8%
+-commutative82.8%
+-commutative82.8%
cube-unmult82.8%
+-commutative82.8%
Simplified82.8%
associate-*r/72.2%
fma-udef56.9%
cube-mult56.8%
distribute-rgt1-in72.2%
associate-+r+72.2%
*-commutative72.2%
frac-times85.0%
associate-/r*99.7%
associate-*l/99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
clear-num99.7%
frac-times99.7%
*-un-lft-identity99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 79.7%
+-commutative79.7%
Simplified79.7%
Taylor expanded in x around 0 55.1%
Final simplification64.2%
(FPCore (x y) :precision binary64 (if (<= y 2.7e-59) (/ y x) (if (<= y 0.76) (- (/ x y) x) (* (/ x y) (/ 1.0 y)))))
double code(double x, double y) {
double tmp;
if (y <= 2.7e-59) {
tmp = y / x;
} else if (y <= 0.76) {
tmp = (x / y) - x;
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.7d-59) then
tmp = y / x
else if (y <= 0.76d0) then
tmp = (x / y) - x
else
tmp = (x / y) * (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.7e-59) {
tmp = y / x;
} else if (y <= 0.76) {
tmp = (x / y) - x;
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.7e-59: tmp = y / x elif y <= 0.76: tmp = (x / y) - x else: tmp = (x / y) * (1.0 / y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.7e-59) tmp = Float64(y / x); elseif (y <= 0.76) tmp = Float64(Float64(x / y) - x); else tmp = Float64(Float64(x / y) * Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.7e-59) tmp = y / x; elseif (y <= 0.76) tmp = (x / y) - x; else tmp = (x / y) * (1.0 / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.7e-59], N[(y / x), $MachinePrecision], If[LessEqual[y, 0.76], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.7 \cdot 10^{-59}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 0.76:\\
\;\;\;\;\frac{x}{y} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 2.6999999999999999e-59Initial program 66.6%
times-frac85.6%
+-commutative85.6%
+-commutative85.6%
+-commutative85.6%
times-frac66.6%
associate-*l/79.0%
*-commutative79.0%
*-commutative79.0%
distribute-rgt1-in57.5%
fma-def79.0%
+-commutative79.0%
+-commutative79.0%
cube-unmult79.0%
+-commutative79.0%
Simplified79.0%
associate-*r/66.7%
fma-udef51.8%
cube-mult51.7%
distribute-rgt1-in66.6%
associate-+r+66.6%
*-commutative66.6%
frac-times85.5%
associate-/r*99.7%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
clear-num99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 62.0%
+-commutative62.0%
Simplified62.0%
Taylor expanded in x around 0 37.6%
if 2.6999999999999999e-59 < y < 0.76000000000000001Initial program 91.2%
associate-/r*99.4%
*-commutative99.4%
+-commutative99.4%
+-commutative99.4%
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 x around 0 37.5%
+-commutative37.5%
Simplified37.5%
Taylor expanded in y around 0 37.5%
neg-mul-137.5%
+-commutative37.5%
unsub-neg37.5%
Simplified37.5%
if 0.76000000000000001 < y Initial program 70.1%
associate-/r*78.1%
*-commutative78.1%
+-commutative78.1%
+-commutative78.1%
associate-*l/91.8%
+-commutative91.8%
associate-*r/91.8%
remove-double-neg91.8%
+-commutative91.8%
+-commutative91.8%
remove-double-neg91.8%
+-commutative91.8%
associate-+l+91.8%
Simplified91.8%
Taylor expanded in y around inf 76.2%
Taylor expanded in y around inf 75.6%
Final simplification48.0%
(FPCore (x y) :precision binary64 (* (/ y (+ y x)) (/ (/ x (+ y (+ x 1.0))) (+ y x))))
double code(double x, double y) {
return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y / (y + x)) * ((x / (y + (x + 1.0d0))) / (y + x))
end function
public static double code(double x, double y) {
return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x));
}
def code(x, y): return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x))
function code(x, y) return Float64(Float64(y / Float64(y + x)) * Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x))) end
function tmp = code(x, y) tmp = (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x)); end
code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(x + 1\right)}}{y + x}
\end{array}
Initial program 68.6%
associate-+r+68.6%
*-commutative68.6%
frac-times87.8%
associate-*l/83.1%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y) :precision binary64 (if (<= y 3e-13) (/ (/ y x) (+ x 1.0)) (/ x (* y (+ y (+ x 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= 3e-13) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = x / (y * (y + (x + 1.0)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3d-13) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = x / (y * (y + (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 3e-13) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = x / (y * (y + (x + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3e-13: tmp = (y / x) / (x + 1.0) else: tmp = x / (y * (y + (x + 1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= 3e-13) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(x / Float64(y * Float64(y + Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3e-13) tmp = (y / x) / (x + 1.0); else tmp = x / (y * (y + (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3e-13], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{-13}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if y < 2.99999999999999984e-13Initial program 67.9%
associate-/r*71.5%
*-commutative71.5%
+-commutative71.5%
+-commutative71.5%
associate-*l/86.3%
+-commutative86.3%
associate-*r/86.3%
remove-double-neg86.3%
+-commutative86.3%
+-commutative86.3%
remove-double-neg86.3%
+-commutative86.3%
associate-+l+86.3%
Simplified86.3%
Taylor expanded in y around 0 62.5%
associate-/r*61.6%
+-commutative61.6%
Simplified61.6%
if 2.99999999999999984e-13 < y Initial program 70.5%
associate-/r*78.4%
*-commutative78.4%
+-commutative78.4%
+-commutative78.4%
associate-*l/91.8%
+-commutative91.8%
associate-*r/91.9%
remove-double-neg91.9%
+-commutative91.9%
+-commutative91.9%
remove-double-neg91.9%
+-commutative91.9%
associate-+l+91.9%
Simplified91.9%
Taylor expanded in y around inf 76.5%
expm1-log1p-u76.5%
expm1-udef60.2%
frac-times60.2%
*-un-lft-identity60.2%
associate-+r+60.2%
+-commutative60.2%
associate-+r+60.2%
Applied egg-rr60.2%
expm1-def77.7%
expm1-log1p77.7%
Simplified77.7%
Final simplification66.1%
(FPCore (x y) :precision binary64 (if (<= y 2.5e+17) (/ y (* x (+ x 1.0))) (/ x (* y (+ y x)))))
double code(double x, double y) {
double tmp;
if (y <= 2.5e+17) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.5d+17) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.5e+17) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.5e+17: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + x)) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.5e+17) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.5e+17) tmp = y / (x * (x + 1.0)); else tmp = x / (y * (y + x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.5e+17], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + x\right)}\\
\end{array}
\end{array}
if y < 2.5e17Initial program 69.0%
associate-/r*72.4%
*-commutative72.4%
+-commutative72.4%
+-commutative72.4%
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 y around 0 63.3%
if 2.5e17 < y Initial program 67.6%
*-un-lft-identity67.6%
associate-+r+67.6%
associate-*l*67.6%
times-frac76.3%
associate-+r+76.3%
+-commutative76.3%
associate-+l+76.3%
Applied egg-rr76.3%
associate-/l*91.3%
frac-times88.4%
*-un-lft-identity88.4%
+-commutative88.4%
+-commutative88.4%
Applied egg-rr88.4%
Taylor expanded in y around inf 84.3%
Final simplification68.6%
(FPCore (x y) :precision binary64 (if (<= y 2.6e+16) (/ (/ y x) (+ x 1.0)) (/ x (* y (+ y x)))))
double code(double x, double y) {
double tmp;
if (y <= 2.6e+16) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = x / (y * (y + x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.6d+16) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = x / (y * (y + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.6e+16) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = x / (y * (y + x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.6e+16: tmp = (y / x) / (x + 1.0) else: tmp = x / (y * (y + x)) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.6e+16) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(x / Float64(y * Float64(y + x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.6e+16) tmp = (y / x) / (x + 1.0); else tmp = x / (y * (y + x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.6e+16], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + x\right)}\\
\end{array}
\end{array}
if y < 2.6e16Initial program 69.0%
associate-/r*72.4%
*-commutative72.4%
+-commutative72.4%
+-commutative72.4%
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 y around 0 63.3%
associate-/r*62.5%
+-commutative62.5%
Simplified62.5%
if 2.6e16 < y Initial program 67.6%
*-un-lft-identity67.6%
associate-+r+67.6%
associate-*l*67.6%
times-frac76.3%
associate-+r+76.3%
+-commutative76.3%
associate-+l+76.3%
Applied egg-rr76.3%
associate-/l*91.3%
frac-times88.4%
*-un-lft-identity88.4%
+-commutative88.4%
+-commutative88.4%
Applied egg-rr88.4%
Taylor expanded in y around inf 84.3%
Final simplification67.9%
(FPCore (x y) :precision binary64 (if (<= y 2.7e-59) (/ y x) (/ x (+ y x))))
double code(double x, double y) {
double tmp;
if (y <= 2.7e-59) {
tmp = y / x;
} else {
tmp = x / (y + x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.7d-59) then
tmp = y / x
else
tmp = x / (y + x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.7e-59) {
tmp = y / x;
} else {
tmp = x / (y + x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.7e-59: tmp = y / x else: tmp = x / (y + x) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.7e-59) tmp = Float64(y / x); else tmp = Float64(x / Float64(y + x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.7e-59) tmp = y / x; else tmp = x / (y + x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.7e-59], N[(y / x), $MachinePrecision], N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.7 \cdot 10^{-59}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + x}\\
\end{array}
\end{array}
if y < 2.6999999999999999e-59Initial program 66.6%
times-frac85.6%
+-commutative85.6%
+-commutative85.6%
+-commutative85.6%
times-frac66.6%
associate-*l/79.0%
*-commutative79.0%
*-commutative79.0%
distribute-rgt1-in57.5%
fma-def79.0%
+-commutative79.0%
+-commutative79.0%
cube-unmult79.0%
+-commutative79.0%
Simplified79.0%
associate-*r/66.7%
fma-udef51.8%
cube-mult51.7%
distribute-rgt1-in66.6%
associate-+r+66.6%
*-commutative66.6%
frac-times85.5%
associate-/r*99.7%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
clear-num99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 62.0%
+-commutative62.0%
Simplified62.0%
Taylor expanded in x around 0 37.6%
if 2.6999999999999999e-59 < y Initial program 73.0%
times-frac92.9%
+-commutative92.9%
+-commutative92.9%
+-commutative92.9%
times-frac73.0%
associate-*l/80.9%
*-commutative80.9%
*-commutative80.9%
distribute-rgt1-in69.9%
fma-def80.9%
+-commutative80.9%
+-commutative80.9%
cube-unmult81.0%
+-commutative81.0%
Simplified81.0%
associate-*r/73.0%
fma-udef65.8%
cube-mult65.8%
distribute-rgt1-in73.0%
associate-+r+73.0%
*-commutative73.0%
frac-times92.9%
associate-/r*99.8%
associate-*l/99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 60.5%
+-commutative60.5%
Simplified60.5%
Taylor expanded in x around 0 33.4%
Final simplification36.3%
(FPCore (x y) :precision binary64 (if (<= y 2.45e-58) (/ y x) (/ x y)))
double code(double x, double y) {
double tmp;
if (y <= 2.45e-58) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.45d-58) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.45e-58) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.45e-58: tmp = y / x else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (y <= 2.45e-58) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.45e-58) tmp = y / x; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.45e-58], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.45 \cdot 10^{-58}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < 2.45000000000000015e-58Initial program 66.6%
times-frac85.6%
+-commutative85.6%
+-commutative85.6%
+-commutative85.6%
times-frac66.6%
associate-*l/79.0%
*-commutative79.0%
*-commutative79.0%
distribute-rgt1-in57.5%
fma-def79.0%
+-commutative79.0%
+-commutative79.0%
cube-unmult79.0%
+-commutative79.0%
Simplified79.0%
associate-*r/66.7%
fma-udef51.8%
cube-mult51.7%
distribute-rgt1-in66.6%
associate-+r+66.6%
*-commutative66.6%
frac-times85.5%
associate-/r*99.7%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
clear-num99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 62.0%
+-commutative62.0%
Simplified62.0%
Taylor expanded in x around 0 37.6%
if 2.45000000000000015e-58 < y Initial program 73.0%
associate-/r*81.0%
*-commutative81.0%
+-commutative81.0%
+-commutative81.0%
associate-*l/92.8%
+-commutative92.8%
associate-*r/92.9%
remove-double-neg92.9%
+-commutative92.9%
+-commutative92.9%
remove-double-neg92.9%
+-commutative92.9%
associate-+l+92.9%
Simplified92.9%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
Taylor expanded in y around 0 33.1%
Final simplification36.2%
(FPCore (x y) :precision binary64 (/ 0.5 x))
double code(double x, double y) {
return 0.5 / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.5d0 / x
end function
public static double code(double x, double y) {
return 0.5 / x;
}
def code(x, y): return 0.5 / x
function code(x, y) return Float64(0.5 / x) end
function tmp = code(x, y) tmp = 0.5 / x; end
code[x_, y_] := N[(0.5 / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{x}
\end{array}
Initial program 68.6%
times-frac87.9%
+-commutative87.9%
+-commutative87.9%
+-commutative87.9%
times-frac68.6%
associate-*l/79.6%
*-commutative79.6%
*-commutative79.6%
distribute-rgt1-in61.4%
fma-def79.6%
+-commutative79.6%
+-commutative79.6%
cube-unmult79.6%
+-commutative79.6%
Simplified79.6%
associate-*r/68.7%
fma-udef56.2%
cube-mult56.2%
distribute-rgt1-in68.6%
associate-+r+68.6%
*-commutative68.6%
frac-times87.8%
associate-/r*99.7%
associate-*l/99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
clear-num99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around -inf 50.7%
mul-1-neg50.7%
unsub-neg50.7%
neg-mul-150.7%
distribute-lft-in50.7%
metadata-eval50.7%
neg-mul-150.7%
associate-+r+50.7%
unsub-neg50.7%
+-commutative50.7%
unsub-neg50.7%
Simplified50.7%
Taylor expanded in x around inf 4.2%
Final simplification4.2%
(FPCore (x y) :precision binary64 (/ x y))
double code(double x, double y) {
return x / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
public static double code(double x, double y) {
return x / y;
}
def code(x, y): return x / y
function code(x, y) return Float64(x / y) end
function tmp = code(x, y) tmp = x / y; end
code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y}
\end{array}
Initial program 68.6%
associate-/r*73.4%
*-commutative73.4%
+-commutative73.4%
+-commutative73.4%
associate-*l/87.8%
+-commutative87.8%
associate-*r/87.8%
remove-double-neg87.8%
+-commutative87.8%
+-commutative87.8%
remove-double-neg87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
Taylor expanded in x around 0 48.8%
+-commutative48.8%
Simplified48.8%
Taylor expanded in y around 0 24.7%
Final simplification24.7%
(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 2024020
(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))))