
(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 18 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 (/ (* (/ x (+ x y)) (/ y (+ (+ x y) 1.0))) (+ x y)))
double code(double x, double y) {
return ((x / (x + y)) * (y / ((x + y) + 1.0))) / (x + y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / (x + y)) * (y / ((x + y) + 1.0d0))) / (x + y)
end function
public static double code(double x, double y) {
return ((x / (x + y)) * (y / ((x + y) + 1.0))) / (x + y);
}
def code(x, y): return ((x / (x + y)) * (y / ((x + y) + 1.0))) / (x + y)
function code(x, y) return Float64(Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(Float64(x + y) + 1.0))) / Float64(x + y)) end
function tmp = code(x, y) tmp = ((x / (x + y)) * (y / ((x + y) + 1.0))) / (x + y); end
code[x_, y_] := N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) + 1}}{x + y}
\end{array}
Initial program 67.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= x -1.8e+96)
(/ (/ y x) (+ x y))
(if (<= x -4.8e-6)
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0)))
(if (<= x 2e-121)
(/ (* (/ x (+ x y)) y) (* (+ 1.0 y) (+ x y)))
(/ (/ x (+ 1.0 y)) (+ x y))))))
double code(double x, double y) {
double tmp;
if (x <= -1.8e+96) {
tmp = (y / x) / (x + y);
} else if (x <= -4.8e-6) {
tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
} else if (x <= 2e-121) {
tmp = ((x / (x + y)) * y) / ((1.0 + y) * (x + y));
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.8d+96)) then
tmp = (y / x) / (x + y)
else if (x <= (-4.8d-6)) then
tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
else if (x <= 2d-121) then
tmp = ((x / (x + y)) * y) / ((1.0d0 + y) * (x + y))
else
tmp = (x / (1.0d0 + y)) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.8e+96) {
tmp = (y / x) / (x + y);
} else if (x <= -4.8e-6) {
tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
} else if (x <= 2e-121) {
tmp = ((x / (x + y)) * y) / ((1.0 + y) * (x + y));
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.8e+96: tmp = (y / x) / (x + y) elif x <= -4.8e-6: tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)) elif x <= 2e-121: tmp = ((x / (x + y)) * y) / ((1.0 + y) * (x + y)) else: tmp = (x / (1.0 + y)) / (x + y) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.8e+96) tmp = Float64(Float64(y / x) / Float64(x + y)); elseif (x <= -4.8e-6) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))); elseif (x <= 2e-121) tmp = Float64(Float64(Float64(x / Float64(x + y)) * y) / Float64(Float64(1.0 + y) * Float64(x + y))); else tmp = Float64(Float64(x / Float64(1.0 + y)) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.8e+96) tmp = (y / x) / (x + y); elseif (x <= -4.8e-6) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); elseif (x <= 2e-121) tmp = ((x / (x + y)) * y) / ((1.0 + y) * (x + y)); else tmp = (x / (1.0 + y)) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.8e+96], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.8e-6], 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], If[LessEqual[x, 2e-121], N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / N[(N[(1.0 + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+96}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-6}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-121}:\\
\;\;\;\;\frac{\frac{x}{x + y} \cdot y}{\left(1 + y\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{x + y}\\
\end{array}
\end{array}
if x < -1.80000000000000007e96Initial program 57.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
lower-/.f6491.6
Applied rewrites91.6%
if -1.80000000000000007e96 < x < -4.7999999999999998e-6Initial program 78.8%
if -4.7999999999999998e-6 < x < 2e-121Initial program 70.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
lower-+.f6499.9
Applied rewrites99.9%
if 2e-121 < x Initial program 64.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6437.1
Applied rewrites37.1%
Final simplification73.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ x y) 1.0)))
(if (<= y 1.75e-146)
(/ (/ y (+ x 1.0)) (+ x y))
(if (<= y 7.2e-83)
(/ (* 1.0 x) (* t_0 (+ x y)))
(if (<= y 5.3e+102)
(/ (* x y) (* (* (+ x y) (+ x y)) t_0))
(/ (/ x y) (+ x y)))))))
double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (y <= 1.75e-146) {
tmp = (y / (x + 1.0)) / (x + y);
} else if (y <= 7.2e-83) {
tmp = (1.0 * x) / (t_0 * (x + y));
} else if (y <= 5.3e+102) {
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
} else {
tmp = (x / y) / (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) + 1.0d0
if (y <= 1.75d-146) then
tmp = (y / (x + 1.0d0)) / (x + y)
else if (y <= 7.2d-83) then
tmp = (1.0d0 * x) / (t_0 * (x + y))
else if (y <= 5.3d+102) then
tmp = (x * y) / (((x + y) * (x + y)) * t_0)
else
tmp = (x / y) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (y <= 1.75e-146) {
tmp = (y / (x + 1.0)) / (x + y);
} else if (y <= 7.2e-83) {
tmp = (1.0 * x) / (t_0 * (x + y));
} else if (y <= 5.3e+102) {
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
} else {
tmp = (x / y) / (x + y);
}
return tmp;
}
def code(x, y): t_0 = (x + y) + 1.0 tmp = 0 if y <= 1.75e-146: tmp = (y / (x + 1.0)) / (x + y) elif y <= 7.2e-83: tmp = (1.0 * x) / (t_0 * (x + y)) elif y <= 5.3e+102: tmp = (x * y) / (((x + y) * (x + y)) * t_0) else: tmp = (x / y) / (x + y) return tmp
function code(x, y) t_0 = Float64(Float64(x + y) + 1.0) tmp = 0.0 if (y <= 1.75e-146) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y)); elseif (y <= 7.2e-83) tmp = Float64(Float64(1.0 * x) / Float64(t_0 * Float64(x + y))); elseif (y <= 5.3e+102) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * t_0)); else tmp = Float64(Float64(x / y) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (x + y) + 1.0; tmp = 0.0; if (y <= 1.75e-146) tmp = (y / (x + 1.0)) / (x + y); elseif (y <= 7.2e-83) tmp = (1.0 * x) / (t_0 * (x + y)); elseif (y <= 5.3e+102) tmp = (x * y) / (((x + y) * (x + y)) * t_0); else tmp = (x / y) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, 1.75e-146], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e-83], N[(N[(1.0 * x), $MachinePrecision] / N[(t$95$0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.3e+102], N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + y\right) + 1\\
\mathbf{if}\;y \leq 1.75 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-83}:\\
\;\;\;\;\frac{1 \cdot x}{t\_0 \cdot \left(x + y\right)}\\
\mathbf{elif}\;y \leq 5.3 \cdot 10^{+102}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if y < 1.7500000000000001e-146Initial program 66.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites100.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6453.4
Applied rewrites53.4%
if 1.7500000000000001e-146 < y < 7.20000000000000025e-83Initial program 70.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in y around inf
Applied rewrites56.9%
if 7.20000000000000025e-83 < y < 5.2999999999999997e102Initial program 88.1%
if 5.2999999999999997e102 < y Initial program 55.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6480.7
Applied rewrites80.7%
Final simplification63.4%
(FPCore (x y) :precision binary64 (if (<= y 2.35e+127) (* (/ x (* (+ (+ x y) 1.0) (+ x y))) (/ y (+ x y))) (/ (/ x y) (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= 2.35e+127) {
tmp = (x / (((x + y) + 1.0) * (x + y))) * (y / (x + y));
} else {
tmp = (x / y) / (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.35d+127) then
tmp = (x / (((x + y) + 1.0d0) * (x + y))) * (y / (x + y))
else
tmp = (x / y) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.35e+127) {
tmp = (x / (((x + y) + 1.0) * (x + y))) * (y / (x + y));
} else {
tmp = (x / y) / (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.35e+127: tmp = (x / (((x + y) + 1.0) * (x + y))) * (y / (x + y)) else: tmp = (x / y) / (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.35e+127) tmp = Float64(Float64(x / Float64(Float64(Float64(x + y) + 1.0) * Float64(x + y))) * Float64(y / Float64(x + y))); else tmp = Float64(Float64(x / y) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.35e+127) tmp = (x / (((x + y) + 1.0) * (x + y))) * (y / (x + y)); else tmp = (x / y) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.35e+127], N[(N[(x / N[(N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.35 \cdot 10^{+127}:\\
\;\;\;\;\frac{x}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if y < 2.35000000000000018e127Initial program 68.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6494.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6494.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6494.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6494.4
Applied rewrites94.4%
if 2.35000000000000018e127 < y Initial program 59.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6487.8
Applied rewrites87.8%
Final simplification93.3%
(FPCore (x y) :precision binary64 (if (<= y 2.35e+127) (* (/ y (* (+ (+ x y) 1.0) (+ x y))) (/ x (+ x y))) (/ (/ x y) (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= 2.35e+127) {
tmp = (y / (((x + y) + 1.0) * (x + y))) * (x / (x + y));
} else {
tmp = (x / y) / (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.35d+127) then
tmp = (y / (((x + y) + 1.0d0) * (x + y))) * (x / (x + y))
else
tmp = (x / y) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.35e+127) {
tmp = (y / (((x + y) + 1.0) * (x + y))) * (x / (x + y));
} else {
tmp = (x / y) / (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.35e+127: tmp = (y / (((x + y) + 1.0) * (x + y))) * (x / (x + y)) else: tmp = (x / y) / (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.35e+127) tmp = Float64(Float64(y / Float64(Float64(Float64(x + y) + 1.0) * Float64(x + y))) * Float64(x / Float64(x + y))); else tmp = Float64(Float64(x / y) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.35e+127) tmp = (y / (((x + y) + 1.0) * (x + y))) * (x / (x + y)); else tmp = (x / y) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.35e+127], N[(N[(y / N[(N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.35 \cdot 10^{+127}:\\
\;\;\;\;\frac{y}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if y < 2.35000000000000018e127Initial program 68.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6494.4
lift-+.f64N/A
+-commutativeN/A
Applied rewrites94.4%
if 2.35000000000000018e127 < y Initial program 59.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6487.8
Applied rewrites87.8%
Final simplification93.3%
(FPCore (x y) :precision binary64 (/ (* (/ (/ y (+ x y)) (+ (+ x y) 1.0)) x) (+ x y)))
double code(double x, double y) {
return (((y / (x + y)) / ((x + y) + 1.0)) * x) / (x + y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (((y / (x + y)) / ((x + y) + 1.0d0)) * x) / (x + y)
end function
public static double code(double x, double y) {
return (((y / (x + y)) / ((x + y) + 1.0)) * x) / (x + y);
}
def code(x, y): return (((y / (x + y)) / ((x + y) + 1.0)) * x) / (x + y)
function code(x, y) return Float64(Float64(Float64(Float64(y / Float64(x + y)) / Float64(Float64(x + y) + 1.0)) * x) / Float64(x + y)) end
function tmp = code(x, y) tmp = (((y / (x + y)) / ((x + y) + 1.0)) * x) / (x + y); end
code[x_, y_] := N[(N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{y}{x + y}}{\left(x + y\right) + 1} \cdot x}{x + y}
\end{array}
Initial program 67.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.9
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (* (/ (/ y (+ (+ x y) 1.0)) (+ x y)) (/ x (+ x y))))
double code(double x, double y) {
return ((y / ((x + y) + 1.0)) / (x + y)) * (x / (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y / ((x + y) + 1.0d0)) / (x + y)) * (x / (x + y))
end function
public static double code(double x, double y) {
return ((y / ((x + y) + 1.0)) / (x + y)) * (x / (x + y));
}
def code(x, y): return ((y / ((x + y) + 1.0)) / (x + y)) * (x / (x + y))
function code(x, y) return Float64(Float64(Float64(y / Float64(Float64(x + y) + 1.0)) / Float64(x + y)) * Float64(x / Float64(x + y))) end
function tmp = code(x, y) tmp = ((y / ((x + y) + 1.0)) / (x + y)) * (x / (x + y)); end
code[x_, y_] := N[(N[(N[(y / N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{\left(x + y\right) + 1}}{x + y} \cdot \frac{x}{x + y}
\end{array}
Initial program 67.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y 1.75e-146)
(/ (/ y (+ x 1.0)) (+ x y))
(if (<= y 2.7e+110)
(/ (* 1.0 x) (* (+ (+ x y) 1.0) (+ x y)))
(/ (/ x y) (+ x y)))))
double code(double x, double y) {
double tmp;
if (y <= 1.75e-146) {
tmp = (y / (x + 1.0)) / (x + y);
} else if (y <= 2.7e+110) {
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (x / y) / (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 <= 1.75d-146) then
tmp = (y / (x + 1.0d0)) / (x + y)
else if (y <= 2.7d+110) then
tmp = (1.0d0 * x) / (((x + y) + 1.0d0) * (x + y))
else
tmp = (x / y) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.75e-146) {
tmp = (y / (x + 1.0)) / (x + y);
} else if (y <= 2.7e+110) {
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (x / y) / (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.75e-146: tmp = (y / (x + 1.0)) / (x + y) elif y <= 2.7e+110: tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y)) else: tmp = (x / y) / (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.75e-146) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y)); elseif (y <= 2.7e+110) tmp = Float64(Float64(1.0 * x) / Float64(Float64(Float64(x + y) + 1.0) * Float64(x + y))); else tmp = Float64(Float64(x / y) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.75e-146) tmp = (y / (x + 1.0)) / (x + y); elseif (y <= 2.7e+110) tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y)); else tmp = (x / y) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.75e-146], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.7e+110], N[(N[(1.0 * x), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+110}:\\
\;\;\;\;\frac{1 \cdot x}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if y < 1.7500000000000001e-146Initial program 66.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites100.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6453.4
Applied rewrites53.4%
if 1.7500000000000001e-146 < y < 2.7000000000000001e110Initial program 81.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6497.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.7
Applied rewrites97.7%
Taylor expanded in y around inf
Applied rewrites65.5%
if 2.7000000000000001e110 < y Initial program 56.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6482.2
Applied rewrites82.2%
Final simplification61.1%
(FPCore (x y) :precision binary64 (if (<= x -1.95e-142) (/ (* 1.0 y) (* (+ (+ x y) 1.0) (+ x y))) (/ (/ x (+ 1.0 y)) (+ x y))))
double code(double x, double y) {
double tmp;
if (x <= -1.95e-142) {
tmp = (1.0 * y) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.95d-142)) then
tmp = (1.0d0 * y) / (((x + y) + 1.0d0) * (x + y))
else
tmp = (x / (1.0d0 + y)) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.95e-142) {
tmp = (1.0 * y) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.95e-142: tmp = (1.0 * y) / (((x + y) + 1.0) * (x + y)) else: tmp = (x / (1.0 + y)) / (x + y) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.95e-142) tmp = Float64(Float64(1.0 * y) / Float64(Float64(Float64(x + y) + 1.0) * Float64(x + y))); else tmp = Float64(Float64(x / Float64(1.0 + y)) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.95e-142) tmp = (1.0 * y) / (((x + y) + 1.0) * (x + y)); else tmp = (x / (1.0 + y)) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.95e-142], N[(N[(1.0 * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{-142}:\\
\;\;\;\;\frac{1 \cdot y}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{x + y}\\
\end{array}
\end{array}
if x < -1.9500000000000002e-142Initial program 73.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.3
Applied rewrites96.3%
Taylor expanded in y around 0
Applied rewrites80.4%
if -1.9500000000000002e-142 < x Initial program 64.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6458.7
Applied rewrites58.7%
Final simplification65.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y y))))
(if (<= x -1.25e+23)
(/ y (* x x))
(if (<= x -6.2e-161) t_0 (if (<= x 3.5e-102) (/ x y) t_0)))))
double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (x <= -1.25e+23) {
tmp = y / (x * x);
} else if (x <= -6.2e-161) {
tmp = t_0;
} else if (x <= 3.5e-102) {
tmp = x / y;
} 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)
if (x <= (-1.25d+23)) then
tmp = y / (x * x)
else if (x <= (-6.2d-161)) then
tmp = t_0
else if (x <= 3.5d-102) then
tmp = x / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (x <= -1.25e+23) {
tmp = y / (x * x);
} else if (x <= -6.2e-161) {
tmp = t_0;
} else if (x <= 3.5e-102) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / (y * y) tmp = 0 if x <= -1.25e+23: tmp = y / (x * x) elif x <= -6.2e-161: tmp = t_0 elif x <= 3.5e-102: tmp = x / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y * y)) tmp = 0.0 if (x <= -1.25e+23) tmp = Float64(y / Float64(x * x)); elseif (x <= -6.2e-161) tmp = t_0; elseif (x <= 3.5e-102) tmp = Float64(x / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y * y); tmp = 0.0; if (x <= -1.25e+23) tmp = y / (x * x); elseif (x <= -6.2e-161) tmp = t_0; elseif (x <= 3.5e-102) tmp = x / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.25e+23], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.2e-161], t$95$0, If[LessEqual[x, 3.5e-102], N[(x / y), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot y}\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{+23}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-161}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-102}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.25e23Initial program 65.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
if -1.25e23 < x < -6.1999999999999997e-161 or 3.49999999999999986e-102 < x Initial program 68.7%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6439.1
Applied rewrites39.1%
if -6.1999999999999997e-161 < x < 3.49999999999999986e-102Initial program 66.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f641.9
Applied rewrites1.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6485.5
Applied rewrites85.5%
Taylor expanded in y around 0
Applied rewrites72.8%
(FPCore (x y) :precision binary64 (if (<= y 2.3e-155) (/ y (fma x x x)) (if (<= y 3.5e+22) (/ x (fma y y y)) (/ (/ x y) y))))
double code(double x, double y) {
double tmp;
if (y <= 2.3e-155) {
tmp = y / fma(x, x, x);
} else if (y <= 3.5e+22) {
tmp = x / fma(y, y, y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 2.3e-155) tmp = Float64(y / fma(x, x, x)); elseif (y <= 3.5e+22) tmp = Float64(x / fma(y, y, y)); else tmp = Float64(Float64(x / y) / y); end return tmp end
code[x_, y_] := If[LessEqual[y, 2.3e-155], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e+22], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{-155}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+22}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 2.30000000000000005e-155Initial program 66.9%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6449.7
Applied rewrites49.7%
if 2.30000000000000005e-155 < y < 3.5e22Initial program 83.6%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6438.8
Applied rewrites38.8%
if 3.5e22 < y Initial program 61.2%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6467.3
Applied rewrites67.3%
Applied rewrites72.2%
(FPCore (x y) :precision binary64 (if (<= y 1.75e-146) (/ (/ y (+ x 1.0)) (+ x y)) (/ (/ x (+ 1.0 y)) (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= 1.75e-146) {
tmp = (y / (x + 1.0)) / (x + y);
} else {
tmp = (x / (1.0 + y)) / (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 <= 1.75d-146) then
tmp = (y / (x + 1.0d0)) / (x + y)
else
tmp = (x / (1.0d0 + y)) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.75e-146) {
tmp = (y / (x + 1.0)) / (x + y);
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.75e-146: tmp = (y / (x + 1.0)) / (x + y) else: tmp = (x / (1.0 + y)) / (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.75e-146) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.75e-146) tmp = (y / (x + 1.0)) / (x + y); else tmp = (x / (1.0 + y)) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.75e-146], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.7500000000000001e-146Initial program 66.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites100.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6453.4
Applied rewrites53.4%
if 1.7500000000000001e-146 < y Initial program 68.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6462.9
Applied rewrites62.9%
Final simplification57.0%
(FPCore (x y) :precision binary64 (if (<= y 1.75e-146) (/ y (fma x x x)) (/ (/ x (+ 1.0 y)) (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= 1.75e-146) {
tmp = y / fma(x, x, x);
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 1.75e-146) tmp = Float64(y / fma(x, x, x)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / Float64(x + y)); end return tmp end
code[x_, y_] := If[LessEqual[y, 1.75e-146], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-146}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.7500000000000001e-146Initial program 66.7%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6449.7
Applied rewrites49.7%
if 1.7500000000000001e-146 < y Initial program 68.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6462.9
Applied rewrites62.9%
Final simplification54.7%
(FPCore (x y) :precision binary64 (if (<= y 2.3e-155) (/ y (fma x x x)) (/ (/ x (+ 1.0 y)) y)))
double code(double x, double y) {
double tmp;
if (y <= 2.3e-155) {
tmp = y / fma(x, x, x);
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 2.3e-155) tmp = Float64(y / fma(x, x, x)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / y); end return tmp end
code[x_, y_] := If[LessEqual[y, 2.3e-155], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{-155}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if y < 2.30000000000000005e-155Initial program 66.9%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6449.7
Applied rewrites49.7%
if 2.30000000000000005e-155 < y Initial program 68.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6431.4
Applied rewrites31.4%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6458.6
Applied rewrites58.6%
Applied rewrites62.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ x (* y y)))) (if (<= y -8.5e-84) t_0 (if (<= y 1.0) (/ x y) t_0))))
double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (y <= -8.5e-84) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = x / y;
} 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)
if (y <= (-8.5d-84)) then
tmp = t_0
else if (y <= 1.0d0) then
tmp = x / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (y <= -8.5e-84) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / (y * y) tmp = 0 if y <= -8.5e-84: tmp = t_0 elif y <= 1.0: tmp = x / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y * y)) tmp = 0.0 if (y <= -8.5e-84) tmp = t_0; elseif (y <= 1.0) tmp = Float64(x / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y * y); tmp = 0.0; if (y <= -8.5e-84) tmp = t_0; elseif (y <= 1.0) tmp = x / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.5e-84], t$95$0, If[LessEqual[y, 1.0], N[(x / y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot y}\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{-84}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -8.4999999999999994e-84 or 1 < y Initial program 67.5%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6463.4
Applied rewrites63.4%
if -8.4999999999999994e-84 < y < 1Initial program 67.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6443.5
Applied rewrites43.5%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6426.6
Applied rewrites26.6%
Taylor expanded in y around 0
Applied rewrites25.9%
(FPCore (x y) :precision binary64 (if (<= y 2.3e-155) (/ y (fma x x x)) (/ x (fma y y y))))
double code(double x, double y) {
double tmp;
if (y <= 2.3e-155) {
tmp = y / fma(x, x, x);
} else {
tmp = x / fma(y, y, y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 2.3e-155) tmp = Float64(y / fma(x, x, x)); else tmp = Float64(x / fma(y, y, y)); end return tmp end
code[x_, y_] := If[LessEqual[y, 2.3e-155], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{-155}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if y < 2.30000000000000005e-155Initial program 66.9%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6449.7
Applied rewrites49.7%
if 2.30000000000000005e-155 < y Initial program 68.1%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6458.6
Applied rewrites58.6%
(FPCore (x y) :precision binary64 (if (<= x -1.25e+23) (/ y (* x x)) (/ x (fma y y y))))
double code(double x, double y) {
double tmp;
if (x <= -1.25e+23) {
tmp = y / (x * x);
} else {
tmp = x / fma(y, y, y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -1.25e+23) tmp = Float64(y / Float64(x * x)); else tmp = Float64(x / fma(y, y, y)); end return tmp end
code[x_, y_] := If[LessEqual[x, -1.25e+23], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+23}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if x < -1.25e23Initial program 65.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
if -1.25e23 < x Initial program 67.7%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6457.5
Applied rewrites57.5%
(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 67.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6432.9
Applied rewrites32.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6451.7
Applied rewrites51.7%
Taylor expanded in y around 0
Applied rewrites27.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 2024276
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (/ (/ (/ x (+ (+ y 1) x)) (+ y x)) (/ 1 (/ y (+ y x)))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))