
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ x (+ x y)) (/ (/ y (+ y (+ x 1.0))) (+ x y))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (x + y)) * ((y / (y + (x + 1.0d0))) / (x + y))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{y + \left(x + 1\right)}}{x + y}
\end{array}
Initial program 72.2%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Final simplification99.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y 9.6e-147)
(/ (/ y t_0) (+ x y))
(if (<= y 1.35e+112)
(* y (/ x (* t_0 (* (+ x y) (+ x y)))))
(/ (/ x (+ x y)) (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 9.6e-147) {
tmp = (y / t_0) / (x + y);
} else if (y <= 1.35e+112) {
tmp = y * (x / (t_0 * ((x + y) * (x + y))));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (y <= 9.6d-147) then
tmp = (y / t_0) / (x + y)
else if (y <= 1.35d+112) then
tmp = y * (x / (t_0 * ((x + y) * (x + y))))
else
tmp = (x / (x + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 9.6e-147) {
tmp = (y / t_0) / (x + y);
} else if (y <= 1.35e+112) {
tmp = y * (x / (t_0 * ((x + y) * (x + y))));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= 9.6e-147: tmp = (y / t_0) / (x + y) elif y <= 1.35e+112: tmp = y * (x / (t_0 * ((x + y) * (x + y)))) else: tmp = (x / (x + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 9.6e-147) tmp = Float64(Float64(y / t_0) / Float64(x + y)); elseif (y <= 1.35e+112) tmp = Float64(y * Float64(x / Float64(t_0 * Float64(Float64(x + y) * Float64(x + y))))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (y <= 9.6e-147)
tmp = (y / t_0) / (x + y);
elseif (y <= 1.35e+112)
tmp = y * (x / (t_0 * ((x + y) * (x + y))));
else
tmp = (x / (x + y)) / (x + y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 9.6e-147], N[(N[(y / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+112], N[(y * N[(x / N[(t$95$0 * N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 9.6 \cdot 10^{-147}:\\
\;\;\;\;\frac{\frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+112}:\\
\;\;\;\;y \cdot \frac{x}{t\_0 \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 9.59999999999999994e-147Initial program 69.4%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites60.8%
if 9.59999999999999994e-147 < y < 1.3500000000000001e112Initial program 87.2%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6493.6
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
lower-+.f6493.6
Applied rewrites93.6%
if 1.3500000000000001e112 < y Initial program 60.3%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites77.2%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
un-div-invN/A
lower-/.f6477.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.2
Applied rewrites77.2%
Final simplification70.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 4.5e-111)
(/ (/ y (+ y (+ x 1.0))) (+ x y))
(if (<= y 1.55e+89)
(/ (* x y) (* (* (+ x y) (+ x y)) (+ y 1.0)))
(/ (/ x (+ x y)) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.5e-111) {
tmp = (y / (y + (x + 1.0))) / (x + y);
} else if (y <= 1.55e+89) {
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 4.5d-111) then
tmp = (y / (y + (x + 1.0d0))) / (x + y)
else if (y <= 1.55d+89) then
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0d0))
else
tmp = (x / (x + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.5e-111) {
tmp = (y / (y + (x + 1.0))) / (x + y);
} else if (y <= 1.55e+89) {
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.5e-111: tmp = (y / (y + (x + 1.0))) / (x + y) elif y <= 1.55e+89: tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0)) else: tmp = (x / (x + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.5e-111) tmp = Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y)); elseif (y <= 1.55e+89) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(y + 1.0))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4.5e-111)
tmp = (y / (y + (x + 1.0))) / (x + y);
elseif (y <= 1.55e+89)
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
else
tmp = (x / (x + y)) / (x + y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 4.5e-111], N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e+89], N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{-111}:\\
\;\;\;\;\frac{\frac{y}{y + \left(x + 1\right)}}{x + y}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+89}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 4.49999999999999994e-111Initial program 69.9%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites61.6%
if 4.49999999999999994e-111 < y < 1.55e89Initial program 87.4%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f6480.0
Applied rewrites80.0%
if 1.55e89 < y Initial program 61.4%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites77.8%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
un-div-invN/A
lower-/.f6477.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.8
Applied rewrites77.8%
Final simplification67.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 4.5e-111)
(/ (/ y (+ x 1.0)) x)
(if (<= y 1.55e+89)
(/ (* x y) (* (* (+ x y) (+ x y)) (+ y 1.0)))
(/ (/ x (+ x y)) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.5e-111) {
tmp = (y / (x + 1.0)) / x;
} else if (y <= 1.55e+89) {
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 4.5d-111) then
tmp = (y / (x + 1.0d0)) / x
else if (y <= 1.55d+89) then
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0d0))
else
tmp = (x / (x + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.5e-111) {
tmp = (y / (x + 1.0)) / x;
} else if (y <= 1.55e+89) {
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.5e-111: tmp = (y / (x + 1.0)) / x elif y <= 1.55e+89: tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0)) else: tmp = (x / (x + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.5e-111) tmp = Float64(Float64(y / Float64(x + 1.0)) / x); elseif (y <= 1.55e+89) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(y + 1.0))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4.5e-111)
tmp = (y / (x + 1.0)) / x;
elseif (y <= 1.55e+89)
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
else
tmp = (x / (x + y)) / (x + y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 4.5e-111], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 1.55e+89], N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{-111}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+89}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 4.49999999999999994e-111Initial program 69.9%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6460.8
Applied rewrites60.8%
distribute-lft1-inN/A
+-commutativeN/A
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6460.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6460.5
Applied rewrites60.5%
if 4.49999999999999994e-111 < y < 1.55e89Initial program 87.4%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f6480.0
Applied rewrites80.0%
if 1.55e89 < y Initial program 61.4%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites77.8%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
un-div-invN/A
lower-/.f6477.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.8
Applied rewrites77.8%
Final simplification67.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ y (+ x y)) (/ x (* (+ x y) (+ y (+ x 1.0))))))
assert(x < y);
double code(double x, double y) {
return (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0))));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0d0))))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0))));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0))))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(x + y)) * Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0))))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0))));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}
\end{array}
Initial program 72.2%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6494.9
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
lower-+.f6494.9
Applied rewrites94.9%
Final simplification94.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.9e-92)
(/ (/ y (+ x 1.0)) x)
(if (<= y 210000000.0)
(* x (/ 1.0 (* (+ x y) (+ y 1.0))))
(/ x (* (+ x y) (+ x y))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.9e-92) {
tmp = (y / (x + 1.0)) / x;
} else if (y <= 210000000.0) {
tmp = x * (1.0 / ((x + y) * (y + 1.0)));
} else {
tmp = x / ((x + y) * (x + y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.9d-92) then
tmp = (y / (x + 1.0d0)) / x
else if (y <= 210000000.0d0) then
tmp = x * (1.0d0 / ((x + y) * (y + 1.0d0)))
else
tmp = x / ((x + y) * (x + y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.9e-92) {
tmp = (y / (x + 1.0)) / x;
} else if (y <= 210000000.0) {
tmp = x * (1.0 / ((x + y) * (y + 1.0)));
} else {
tmp = x / ((x + y) * (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.9e-92: tmp = (y / (x + 1.0)) / x elif y <= 210000000.0: tmp = x * (1.0 / ((x + y) * (y + 1.0))) else: tmp = x / ((x + y) * (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.9e-92) tmp = Float64(Float64(y / Float64(x + 1.0)) / x); elseif (y <= 210000000.0) tmp = Float64(x * Float64(1.0 / Float64(Float64(x + y) * Float64(y + 1.0)))); else tmp = Float64(x / Float64(Float64(x + y) * Float64(x + y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.9e-92)
tmp = (y / (x + 1.0)) / x;
elseif (y <= 210000000.0)
tmp = x * (1.0 / ((x + y) * (y + 1.0)));
else
tmp = x / ((x + y) * (x + y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.9e-92], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 210000000.0], N[(x * N[(1.0 / N[(N[(x + y), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{-92}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\
\mathbf{elif}\;y \leq 210000000:\\
\;\;\;\;x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\
\end{array}
\end{array}
if y < 1.9e-92Initial program 70.4%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6461.6
Applied rewrites61.6%
distribute-lft1-inN/A
+-commutativeN/A
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6461.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.4
Applied rewrites61.4%
if 1.9e-92 < y < 2.1e8Initial program 85.3%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6443.8
Applied rewrites43.8%
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
/-rgt-identityN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-*.f6443.5
Applied rewrites43.5%
if 2.1e8 < y Initial program 71.7%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
Applied rewrites72.6%
lift-+.f64N/A
lift-+.f64N/A
/-rgt-identityN/A
clear-numN/A
frac-timesN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-*.f6481.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6481.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6481.1
Applied rewrites81.1%
Final simplification64.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -9.5e-102) (* (/ y (+ x y)) (/ 1.0 (+ x 1.0))) (/ (/ x (+ x y)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9.5e-102) {
tmp = (y / (x + y)) * (1.0 / (x + 1.0));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9.5d-102)) then
tmp = (y / (x + y)) * (1.0d0 / (x + 1.0d0))
else
tmp = (x / (x + y)) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -9.5e-102) {
tmp = (y / (x + y)) * (1.0 / (x + 1.0));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -9.5e-102: tmp = (y / (x + y)) * (1.0 / (x + 1.0)) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9.5e-102) tmp = Float64(Float64(y / Float64(x + y)) * Float64(1.0 / Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -9.5e-102)
tmp = (y / (x + y)) * (1.0 / (x + 1.0));
else
tmp = (x / (x + y)) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -9.5e-102], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-102}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if x < -9.50000000000000025e-102Initial program 77.4%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Applied rewrites93.6%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6471.4
Applied rewrites71.4%
if -9.50000000000000025e-102 < x Initial program 69.2%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6459.0
Applied rewrites59.0%
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
/-rgt-identityN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6459.0
lift-+.f64N/A
+-commutativeN/A
lift-+.f6459.0
Applied rewrites59.0%
Final simplification63.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* x x))))
(if (<= y -1.1e-173)
t_0
(if (<= y 1.1e-148) (/ y x) (if (<= y 2000000000.0) t_0 (/ x (* y y)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (x * x);
double tmp;
if (y <= -1.1e-173) {
tmp = t_0;
} else if (y <= 1.1e-148) {
tmp = y / x;
} else if (y <= 2000000000.0) {
tmp = t_0;
} else {
tmp = x / (y * y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (x * x)
if (y <= (-1.1d-173)) then
tmp = t_0
else if (y <= 1.1d-148) then
tmp = y / x
else if (y <= 2000000000.0d0) then
tmp = t_0
else
tmp = x / (y * y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (x * x);
double tmp;
if (y <= -1.1e-173) {
tmp = t_0;
} else if (y <= 1.1e-148) {
tmp = y / x;
} else if (y <= 2000000000.0) {
tmp = t_0;
} else {
tmp = x / (y * y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (x * x) tmp = 0 if y <= -1.1e-173: tmp = t_0 elif y <= 1.1e-148: tmp = y / x elif y <= 2000000000.0: tmp = t_0 else: tmp = x / (y * y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(x * x)) tmp = 0.0 if (y <= -1.1e-173) tmp = t_0; elseif (y <= 1.1e-148) tmp = Float64(y / x); elseif (y <= 2000000000.0) tmp = t_0; else tmp = Float64(x / Float64(y * y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (x * x);
tmp = 0.0;
if (y <= -1.1e-173)
tmp = t_0;
elseif (y <= 1.1e-148)
tmp = y / x;
elseif (y <= 2000000000.0)
tmp = t_0;
else
tmp = x / (y * y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.1e-173], t$95$0, If[LessEqual[y, 1.1e-148], N[(y / x), $MachinePrecision], If[LessEqual[y, 2000000000.0], t$95$0, N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot x}\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{-173}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-148}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 2000000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < -1.1e-173 or 1.10000000000000009e-148 < y < 2e9Initial program 73.3%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6447.3
Applied rewrites47.3%
if -1.1e-173 < y < 1.10000000000000009e-148Initial program 70.3%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6485.5
Applied rewrites85.5%
Taylor expanded in x around 0
lower-/.f6467.2
Applied rewrites67.2%
if 2e9 < y Initial program 71.7%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6474.3
Applied rewrites74.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.9e-92) (/ (/ y (+ x 1.0)) x) (if (<= y 210000000.0) (/ x (fma y y y)) (/ x (* (+ x y) (+ x y))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.9e-92) {
tmp = (y / (x + 1.0)) / x;
} else if (y <= 210000000.0) {
tmp = x / fma(y, y, y);
} else {
tmp = x / ((x + y) * (x + y));
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.9e-92) tmp = Float64(Float64(y / Float64(x + 1.0)) / x); elseif (y <= 210000000.0) tmp = Float64(x / fma(y, y, y)); else tmp = Float64(x / Float64(Float64(x + y) * Float64(x + y))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.9e-92], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 210000000.0], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{-92}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\
\mathbf{elif}\;y \leq 210000000:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\
\end{array}
\end{array}
if y < 1.9e-92Initial program 70.4%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6461.6
Applied rewrites61.6%
distribute-lft1-inN/A
+-commutativeN/A
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6461.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.4
Applied rewrites61.4%
if 1.9e-92 < y < 2.1e8Initial program 85.3%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6443.0
Applied rewrites43.0%
if 2.1e8 < y Initial program 71.7%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
Applied rewrites72.6%
lift-+.f64N/A
lift-+.f64N/A
/-rgt-identityN/A
clear-numN/A
frac-timesN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-*.f6481.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6481.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6481.1
Applied rewrites81.1%
Final simplification64.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.9e-92) (/ y (fma x x x)) (if (<= y 210000000.0) (/ x (fma y y y)) (/ x (* (+ x y) (+ x y))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.9e-92) {
tmp = y / fma(x, x, x);
} else if (y <= 210000000.0) {
tmp = x / fma(y, y, y);
} else {
tmp = x / ((x + y) * (x + y));
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.9e-92) tmp = Float64(y / fma(x, x, x)); elseif (y <= 210000000.0) tmp = Float64(x / fma(y, y, y)); else tmp = Float64(x / Float64(Float64(x + y) * Float64(x + y))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.9e-92], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 210000000.0], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{-92}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{elif}\;y \leq 210000000:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\
\end{array}
\end{array}
if y < 1.9e-92Initial program 70.4%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6461.6
Applied rewrites61.6%
if 1.9e-92 < y < 2.1e8Initial program 85.3%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6443.0
Applied rewrites43.0%
if 2.1e8 < y Initial program 71.7%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
Applied rewrites72.6%
lift-+.f64N/A
lift-+.f64N/A
/-rgt-identityN/A
clear-numN/A
frac-timesN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-*.f6481.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6481.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6481.1
Applied rewrites81.1%
Final simplification64.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -9.5e-102) (/ (/ y (+ x 1.0)) x) (/ (/ x (+ x y)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9.5e-102) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9.5d-102)) then
tmp = (y / (x + 1.0d0)) / x
else
tmp = (x / (x + y)) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -9.5e-102) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -9.5e-102: tmp = (y / (x + 1.0)) / x else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9.5e-102) tmp = Float64(Float64(y / Float64(x + 1.0)) / x); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -9.5e-102)
tmp = (y / (x + 1.0)) / x;
else
tmp = (x / (x + y)) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -9.5e-102], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-102}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if x < -9.50000000000000025e-102Initial program 77.4%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6472.0
Applied rewrites72.0%
distribute-lft1-inN/A
+-commutativeN/A
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6471.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6471.2
Applied rewrites71.2%
if -9.50000000000000025e-102 < x Initial program 69.2%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6459.0
Applied rewrites59.0%
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
/-rgt-identityN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
clear-numN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6459.0
lift-+.f64N/A
+-commutativeN/A
lift-+.f6459.0
Applied rewrites59.0%
Final simplification63.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (let* ((t_0 (/ x (* y y)))) (if (<= y -2.05e+96) t_0 (if (<= y 5.2e-22) (/ y x) t_0))))
assert(x < y);
double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (y <= -2.05e+96) {
tmp = t_0;
} else if (y <= 5.2e-22) {
tmp = y / x;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (y * y)
if (y <= (-2.05d+96)) then
tmp = t_0
else if (y <= 5.2d-22) then
tmp = y / x
else
tmp = t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (y <= -2.05e+96) {
tmp = t_0;
} else if (y <= 5.2e-22) {
tmp = y / x;
} else {
tmp = t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (y * y) tmp = 0 if y <= -2.05e+96: tmp = t_0 elif y <= 5.2e-22: tmp = y / x else: tmp = t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(y * y)) tmp = 0.0 if (y <= -2.05e+96) tmp = t_0; elseif (y <= 5.2e-22) tmp = Float64(y / x); else tmp = t_0; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (y * y);
tmp = 0.0;
if (y <= -2.05e+96)
tmp = t_0;
elseif (y <= 5.2e-22)
tmp = y / x;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.05e+96], t$95$0, If[LessEqual[y, 5.2e-22], N[(y / x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot y}\\
\mathbf{if}\;y \leq -2.05 \cdot 10^{+96}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-22}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.04999999999999999e96 or 5.2e-22 < y Initial program 65.8%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6476.7
Applied rewrites76.7%
if -2.04999999999999999e96 < y < 5.2e-22Initial program 76.8%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
lower-/.f6437.6
Applied rewrites37.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -9.5e-102) (/ y (fma x x x)) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9.5e-102) {
tmp = y / fma(x, x, x);
} else {
tmp = x / fma(y, y, y);
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9.5e-102) tmp = Float64(y / fma(x, x, x)); else tmp = Float64(x / fma(y, y, y)); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -9.5e-102], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-102}:\\
\;\;\;\;\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 x < -9.50000000000000025e-102Initial program 77.4%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6472.0
Applied rewrites72.0%
if -9.50000000000000025e-102 < x Initial program 69.2%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6458.3
Applied rewrites58.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.4e+24) (/ y (* x x)) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.4e+24) {
tmp = y / (x * x);
} else {
tmp = x / fma(y, y, y);
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.4e+24) tmp = Float64(y / Float64(x * x)); else tmp = Float64(x / fma(y, y, y)); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -3.4e+24], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+24}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if x < -3.4000000000000001e24Initial program 71.8%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6483.5
Applied rewrites83.5%
if -3.4000000000000001e24 < x Initial program 72.4%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6459.3
Applied rewrites59.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ y x))
assert(x < y);
double code(double x, double y) {
return y / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = y / x
end function
assert x < y;
public static double code(double x, double y) {
return y / x;
}
[x, y] = sort([x, y]) def code(x, y): return y / x
x, y = sort([x, y]) function code(x, y) return Float64(y / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = y / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(y / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{x}
\end{array}
Initial program 72.2%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6451.5
Applied rewrites51.5%
Taylor expanded in x around 0
lower-/.f6423.0
Applied rewrites23.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / x;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / x
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Initial program 72.2%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites36.1%
Taylor expanded in x around inf
lower-/.f644.5
Applied rewrites4.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 1.0)
assert(x < y);
double code(double x, double y) {
return 1.0;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
assert x < y;
public static double code(double x, double y) {
return 1.0;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0
x, y = sort([x, y]) function code(x, y) return 1.0 end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := 1.0
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
1
\end{array}
Initial program 72.2%
lift-+.f64N/A
lift-+.f64N/A
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
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6448.5
Applied rewrites48.5%
Taylor expanded in y around 0
Applied rewrites3.5%
(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 2024212
(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))))