
(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}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (* (/ x (+ x y)) (/ y (+ (+ x y) 1.0))) (+ x y)))
assert(x < y);
double code(double x, double y) {
return ((x / (x + y)) * (y / ((x + y) + 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 / ((x + y) + 1.0d0))) / (x + y)
end function
assert x < y;
public static double code(double x, double y) {
return ((x / (x + y)) * (y / ((x + y) + 1.0))) / (x + y);
}
[x, y] = sort([x, y]) def code(x, y): return ((x / (x + y)) * (y / ((x + y) + 1.0))) / (x + y)
x, y = sort([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
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((x / (x + y)) * (y / ((x + y) + 1.0))) / (x + y);
end
NOTE: x and y should be sorted in increasing order before calling this function. 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}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) + 1}}{x + y}
\end{array}
Initial program 73.9%
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%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ x y) 1.0)))
(if (<= y 2.1e-130)
(/ (* 1.0 (/ y t_0)) (+ x y))
(if (<= y 2.9e+79)
(/ (* x y) (* (* (+ x y) (+ x y)) t_0))
(/ (* 1.0 (/ x (+ x y))) (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (y <= 2.1e-130) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 2.9e+79) {
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
} else {
tmp = (1.0 * (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 = (x + y) + 1.0d0
if (y <= 2.1d-130) then
tmp = (1.0d0 * (y / t_0)) / (x + y)
else if (y <= 2.9d+79) then
tmp = (x * y) / (((x + y) * (x + y)) * t_0)
else
tmp = (1.0d0 * (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 = (x + y) + 1.0;
double tmp;
if (y <= 2.1e-130) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 2.9e+79) {
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
} else {
tmp = (1.0 * (x / (x + y))) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (x + y) + 1.0 tmp = 0 if y <= 2.1e-130: tmp = (1.0 * (y / t_0)) / (x + y) elif y <= 2.9e+79: tmp = (x * y) / (((x + y) * (x + y)) * t_0) else: tmp = (1.0 * (x / (x + y))) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(x + y) + 1.0) tmp = 0.0 if (y <= 2.1e-130) tmp = Float64(Float64(1.0 * Float64(y / t_0)) / Float64(x + y)); elseif (y <= 2.9e+79) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * t_0)); else tmp = Float64(Float64(1.0 * 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 = (x + y) + 1.0;
tmp = 0.0;
if (y <= 2.1e-130)
tmp = (1.0 * (y / t_0)) / (x + y);
elseif (y <= 2.9e+79)
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
else
tmp = (1.0 * (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[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, 2.1e-130], N[(N[(1.0 * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+79], N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(x + y\right) + 1\\
\mathbf{if}\;y \leq 2.1 \cdot 10^{-130}:\\
\;\;\;\;\frac{1 \cdot \frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+79}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot \frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 2.10000000000000002e-130Initial program 72.8%
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 y around 0
Applied rewrites57.2%
if 2.10000000000000002e-130 < y < 2.89999999999999992e79Initial program 89.8%
if 2.89999999999999992e79 < y Initial program 60.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
Applied rewrites86.0%
Final simplification68.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ x y) 1.0)))
(if (<= x -1.95e+158)
(* (/ 1.0 (+ x y)) (/ y t_0))
(/ (* (/ y (+ x y)) x) (* t_0 (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (x <= -1.95e+158) {
tmp = (1.0 / (x + y)) * (y / t_0);
} else {
tmp = ((y / (x + y)) * x) / (t_0 * (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 = (x + y) + 1.0d0
if (x <= (-1.95d+158)) then
tmp = (1.0d0 / (x + y)) * (y / t_0)
else
tmp = ((y / (x + y)) * x) / (t_0 * (x + y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (x <= -1.95e+158) {
tmp = (1.0 / (x + y)) * (y / t_0);
} else {
tmp = ((y / (x + y)) * x) / (t_0 * (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (x + y) + 1.0 tmp = 0 if x <= -1.95e+158: tmp = (1.0 / (x + y)) * (y / t_0) else: tmp = ((y / (x + y)) * x) / (t_0 * (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(x + y) + 1.0) tmp = 0.0 if (x <= -1.95e+158) tmp = Float64(Float64(1.0 / Float64(x + y)) * Float64(y / t_0)); else tmp = Float64(Float64(Float64(y / Float64(x + y)) * x) / Float64(t_0 * Float64(x + y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (x + y) + 1.0;
tmp = 0.0;
if (x <= -1.95e+158)
tmp = (1.0 / (x + y)) * (y / t_0);
else
tmp = ((y / (x + y)) * x) / (t_0 * (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[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -1.95e+158], N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(t$95$0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(x + y\right) + 1\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{+158}:\\
\;\;\;\;\frac{1}{x + y} \cdot \frac{y}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x + y} \cdot x}{t\_0 \cdot \left(x + y\right)}\\
\end{array}
\end{array}
if x < -1.95e158Initial program 59.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 y around 0
Applied rewrites90.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6490.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6490.8
Applied rewrites90.8%
if -1.95e158 < x Initial program 75.7%
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-*.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%
Final simplification95.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ x y) 1.0)))
(if (<= x -1.95e+158)
(* (/ 1.0 (+ x y)) (/ y t_0))
(* (/ y (* t_0 (+ x y))) (/ x (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (x <= -1.95e+158) {
tmp = (1.0 / (x + y)) * (y / t_0);
} else {
tmp = (y / (t_0 * (x + y))) * (x / (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 = (x + y) + 1.0d0
if (x <= (-1.95d+158)) then
tmp = (1.0d0 / (x + y)) * (y / t_0)
else
tmp = (y / (t_0 * (x + y))) * (x / (x + y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (x <= -1.95e+158) {
tmp = (1.0 / (x + y)) * (y / t_0);
} else {
tmp = (y / (t_0 * (x + y))) * (x / (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (x + y) + 1.0 tmp = 0 if x <= -1.95e+158: tmp = (1.0 / (x + y)) * (y / t_0) else: tmp = (y / (t_0 * (x + y))) * (x / (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(x + y) + 1.0) tmp = 0.0 if (x <= -1.95e+158) tmp = Float64(Float64(1.0 / Float64(x + y)) * Float64(y / t_0)); else tmp = Float64(Float64(y / Float64(t_0 * Float64(x + y))) * Float64(x / Float64(x + y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (x + y) + 1.0;
tmp = 0.0;
if (x <= -1.95e+158)
tmp = (1.0 / (x + y)) * (y / t_0);
else
tmp = (y / (t_0 * (x + y))) * (x / (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[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -1.95e+158], N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(t$95$0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(x + y\right) + 1\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{+158}:\\
\;\;\;\;\frac{1}{x + y} \cdot \frac{y}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t\_0 \cdot \left(x + y\right)} \cdot \frac{x}{x + y}\\
\end{array}
\end{array}
if x < -1.95e158Initial program 59.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 y around 0
Applied rewrites90.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6490.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6490.8
Applied rewrites90.8%
if -1.95e158 < x Initial program 75.7%
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-/.f6496.3
lift-+.f64N/A
+-commutativeN/A
Applied rewrites96.3%
Final simplification95.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ (/ y (+ (+ x y) 1.0)) (+ x y)) (/ x (+ x y))))
assert(x < y);
double code(double x, double y) {
return ((y / ((x + y) + 1.0)) / (x + y)) * (x / (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 = ((y / ((x + y) + 1.0d0)) / (x + y)) * (x / (x + y))
end function
assert x < y;
public static double code(double x, double y) {
return ((y / ((x + y) + 1.0)) / (x + y)) * (x / (x + y));
}
[x, y] = sort([x, y]) def code(x, y): return ((y / ((x + y) + 1.0)) / (x + y)) * (x / (x + y))
x, y = sort([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
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((y / ((x + y) + 1.0)) / (x + y)) * (x / (x + y));
end
NOTE: x and y should be sorted in increasing order before calling this function. 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}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{\left(x + y\right) + 1}}{x + y} \cdot \frac{x}{x + y}
\end{array}
Initial program 73.9%
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.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.02e-10)
(/ (* (/ y (+ x y)) x) (* (+ x 1.0) (+ x y)))
(if (<= y 2.9e+146)
(/ (* 1.0 x) (* (+ (+ x y) 1.0) (+ x y)))
(/ (* 1.0 (/ x (+ x y))) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.02e-10) {
tmp = ((y / (x + y)) * x) / ((x + 1.0) * (x + y));
} else if (y <= 2.9e+146) {
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (1.0 * (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.02d-10) then
tmp = ((y / (x + y)) * x) / ((x + 1.0d0) * (x + y))
else if (y <= 2.9d+146) then
tmp = (1.0d0 * x) / (((x + y) + 1.0d0) * (x + y))
else
tmp = (1.0d0 * (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.02e-10) {
tmp = ((y / (x + y)) * x) / ((x + 1.0) * (x + y));
} else if (y <= 2.9e+146) {
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (1.0 * (x / (x + y))) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.02e-10: tmp = ((y / (x + y)) * x) / ((x + 1.0) * (x + y)) elif y <= 2.9e+146: tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y)) else: tmp = (1.0 * (x / (x + y))) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.02e-10) tmp = Float64(Float64(Float64(y / Float64(x + y)) * x) / Float64(Float64(x + 1.0) * Float64(x + y))); elseif (y <= 2.9e+146) tmp = Float64(Float64(1.0 * x) / Float64(Float64(Float64(x + y) + 1.0) * Float64(x + y))); else tmp = Float64(Float64(1.0 * 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 <= 1.02e-10)
tmp = ((y / (x + y)) * x) / ((x + 1.0) * (x + y));
elseif (y <= 2.9e+146)
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
else
tmp = (1.0 * (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.02e-10], N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+146], N[(N[(1.0 * x), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.02 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{y}{x + y} \cdot x}{\left(x + 1\right) \cdot \left(x + y\right)}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+146}:\\
\;\;\;\;\frac{1 \cdot x}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot \frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.01999999999999997e-10Initial program 76.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-*.f6496.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.4
Applied rewrites96.4%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6486.2
Applied rewrites86.2%
if 1.01999999999999997e-10 < y < 2.8999999999999998e146Initial program 59.9%
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-*.f6492.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6492.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6492.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6492.1
Applied rewrites92.1%
Taylor expanded in y around inf
Applied rewrites79.2%
if 2.8999999999999998e146 < y Initial program 75.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 rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification86.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ x y) 1.0)))
(if (<= y 1.85e-118)
(/ (* 1.0 (/ y t_0)) (+ x y))
(if (<= y 2.9e+146)
(/ (* 1.0 x) (* t_0 (+ x y)))
(/ (* 1.0 (/ x (+ x y))) (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (y <= 1.85e-118) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 2.9e+146) {
tmp = (1.0 * x) / (t_0 * (x + y));
} else {
tmp = (1.0 * (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 = (x + y) + 1.0d0
if (y <= 1.85d-118) then
tmp = (1.0d0 * (y / t_0)) / (x + y)
else if (y <= 2.9d+146) then
tmp = (1.0d0 * x) / (t_0 * (x + y))
else
tmp = (1.0d0 * (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 = (x + y) + 1.0;
double tmp;
if (y <= 1.85e-118) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 2.9e+146) {
tmp = (1.0 * x) / (t_0 * (x + y));
} else {
tmp = (1.0 * (x / (x + y))) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (x + y) + 1.0 tmp = 0 if y <= 1.85e-118: tmp = (1.0 * (y / t_0)) / (x + y) elif y <= 2.9e+146: tmp = (1.0 * x) / (t_0 * (x + y)) else: tmp = (1.0 * (x / (x + y))) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(x + y) + 1.0) tmp = 0.0 if (y <= 1.85e-118) tmp = Float64(Float64(1.0 * Float64(y / t_0)) / Float64(x + y)); elseif (y <= 2.9e+146) tmp = Float64(Float64(1.0 * x) / Float64(t_0 * Float64(x + y))); else tmp = Float64(Float64(1.0 * 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 = (x + y) + 1.0;
tmp = 0.0;
if (y <= 1.85e-118)
tmp = (1.0 * (y / t_0)) / (x + y);
elseif (y <= 2.9e+146)
tmp = (1.0 * x) / (t_0 * (x + y));
else
tmp = (1.0 * (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[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, 1.85e-118], N[(N[(1.0 * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+146], N[(N[(1.0 * x), $MachinePrecision] / N[(t$95$0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(x + y\right) + 1\\
\mathbf{if}\;y \leq 1.85 \cdot 10^{-118}:\\
\;\;\;\;\frac{1 \cdot \frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+146}:\\
\;\;\;\;\frac{1 \cdot x}{t\_0 \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot \frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.85000000000000007e-118Initial program 73.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 y around 0
Applied rewrites57.9%
if 1.85000000000000007e-118 < y < 2.8999999999999998e146Initial program 74.5%
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-*.f6495.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.4
Applied rewrites95.4%
Taylor expanded in y around inf
Applied rewrites79.1%
if 2.8999999999999998e146 < y Initial program 75.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 rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification68.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.85e-118)
(/ (/ y (+ x 1.0)) (+ x y))
(if (<= y 2.9e+146)
(/ (* 1.0 x) (* (+ (+ x y) 1.0) (+ x y)))
(/ (* 1.0 (/ x (+ x y))) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.85e-118) {
tmp = (y / (x + 1.0)) / (x + y);
} else if (y <= 2.9e+146) {
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (1.0 * (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.85d-118) then
tmp = (y / (x + 1.0d0)) / (x + y)
else if (y <= 2.9d+146) then
tmp = (1.0d0 * x) / (((x + y) + 1.0d0) * (x + y))
else
tmp = (1.0d0 * (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.85e-118) {
tmp = (y / (x + 1.0)) / (x + y);
} else if (y <= 2.9e+146) {
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (1.0 * (x / (x + y))) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.85e-118: tmp = (y / (x + 1.0)) / (x + y) elif y <= 2.9e+146: tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y)) else: tmp = (1.0 * (x / (x + y))) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.85e-118) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y)); elseif (y <= 2.9e+146) tmp = Float64(Float64(1.0 * x) / Float64(Float64(Float64(x + y) + 1.0) * Float64(x + y))); else tmp = Float64(Float64(1.0 * 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 <= 1.85e-118)
tmp = (y / (x + 1.0)) / (x + y);
elseif (y <= 2.9e+146)
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
else
tmp = (1.0 * (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.85e-118], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+146], N[(N[(1.0 * x), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{-118}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+146}:\\
\;\;\;\;\frac{1 \cdot x}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot \frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.85000000000000007e-118Initial program 73.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 y around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6457.1
Applied rewrites57.1%
if 1.85000000000000007e-118 < y < 2.8999999999999998e146Initial program 74.5%
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-*.f6495.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.4
Applied rewrites95.4%
Taylor expanded in y around inf
Applied rewrites79.1%
if 2.8999999999999998e146 < y Initial program 75.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 rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification67.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.85e-118)
(/ (/ y (+ x 1.0)) (+ x y))
(if (<= y 2.9e+146)
(/ (* 1.0 x) (* (+ (+ x y) 1.0) (+ x y)))
(/ (/ x y) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.85e-118) {
tmp = (y / (x + 1.0)) / (x + y);
} else if (y <= 2.9e+146) {
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (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.85d-118) then
tmp = (y / (x + 1.0d0)) / (x + y)
else if (y <= 2.9d+146) then
tmp = (1.0d0 * x) / (((x + y) + 1.0d0) * (x + y))
else
tmp = (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.85e-118) {
tmp = (y / (x + 1.0)) / (x + y);
} else if (y <= 2.9e+146) {
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (x / y) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.85e-118: tmp = (y / (x + 1.0)) / (x + y) elif y <= 2.9e+146: tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y)) else: tmp = (x / y) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.85e-118) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y)); elseif (y <= 2.9e+146) 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
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.85e-118)
tmp = (y / (x + 1.0)) / (x + y);
elseif (y <= 2.9e+146)
tmp = (1.0 * x) / (((x + y) + 1.0) * (x + y));
else
tmp = (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.85e-118], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+146], 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}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{-118}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+146}:\\
\;\;\;\;\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.85000000000000007e-118Initial program 73.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 y around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6457.1
Applied rewrites57.1%
if 1.85000000000000007e-118 < y < 2.8999999999999998e146Initial program 74.5%
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-*.f6495.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.4
Applied rewrites95.4%
Taylor expanded in y around inf
Applied rewrites79.1%
if 2.8999999999999998e146 < y Initial program 75.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 rewrites100.0%
Taylor expanded in y around inf
lower-/.f64100.0
Applied rewrites100.0%
Final simplification67.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.75e+148)
(/ (/ y x) (+ x y))
(if (<= x -1.45e-117)
(/ (* 1.0 y) (* (+ (+ x y) 1.0) (+ x y)))
(/ (/ x (+ 1.0 y)) y))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e+148) {
tmp = (y / x) / (x + y);
} else if (x <= -1.45e-117) {
tmp = (1.0 * y) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d+148)) then
tmp = (y / x) / (x + y)
else if (x <= (-1.45d-117)) then
tmp = (1.0d0 * y) / (((x + y) + 1.0d0) * (x + y))
else
tmp = (x / (1.0d0 + y)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e+148) {
tmp = (y / x) / (x + y);
} else if (x <= -1.45e-117) {
tmp = (1.0 * y) / (((x + y) + 1.0) * (x + y));
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e+148: tmp = (y / x) / (x + y) elif x <= -1.45e-117: tmp = (1.0 * y) / (((x + y) + 1.0) * (x + y)) else: tmp = (x / (1.0 + y)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e+148) tmp = Float64(Float64(y / x) / Float64(x + y)); elseif (x <= -1.45e-117) 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)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.75e+148)
tmp = (y / x) / (x + y);
elseif (x <= -1.45e-117)
tmp = (1.0 * y) / (((x + y) + 1.0) * (x + y));
else
tmp = (x / (1.0 + y)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e+148], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.45e-117], 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] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+148}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-117}:\\
\;\;\;\;\frac{1 \cdot y}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if x < -1.7499999999999999e148Initial program 58.9%
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 inf
lower-/.f6491.1
Applied rewrites91.1%
if -1.7499999999999999e148 < x < -1.45e-117Initial program 77.5%
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 0
Applied rewrites54.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6477.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.9
Applied rewrites77.9%
if -1.45e-117 < x Initial program 75.4%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6475.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6475.4
Applied rewrites75.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
associate-/l/N/A
Applied rewrites99.5%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6459.7
Applied rewrites59.7%
Applied rewrites61.3%
Final simplification68.3%
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 (<= x -2e+20)
(/ y (* x x))
(if (<= x -1.35e-133) t_0 (if (<= x 1.55e-186) (/ x y) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (x <= -2e+20) {
tmp = y / (x * x);
} else if (x <= -1.35e-133) {
tmp = t_0;
} else if (x <= 1.55e-186) {
tmp = x / y;
} 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 (x <= (-2d+20)) then
tmp = y / (x * x)
else if (x <= (-1.35d-133)) then
tmp = t_0
else if (x <= 1.55d-186) then
tmp = x / y
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 (x <= -2e+20) {
tmp = y / (x * x);
} else if (x <= -1.35e-133) {
tmp = t_0;
} else if (x <= 1.55e-186) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (y * y) tmp = 0 if x <= -2e+20: tmp = y / (x * x) elif x <= -1.35e-133: tmp = t_0 elif x <= 1.55e-186: tmp = x / y 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 (x <= -2e+20) tmp = Float64(y / Float64(x * x)); elseif (x <= -1.35e-133) tmp = t_0; elseif (x <= 1.55e-186) tmp = Float64(x / y); 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 (x <= -2e+20)
tmp = y / (x * x);
elseif (x <= -1.35e-133)
tmp = t_0;
elseif (x <= 1.55e-186)
tmp = x / y;
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[x, -2e+20], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.35e-133], t$95$0, If[LessEqual[x, 1.55e-186], N[(x / y), $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}\;x \leq -2 \cdot 10^{+20}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-133}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-186}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2e20Initial program 65.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6477.9
Applied rewrites77.9%
if -2e20 < x < -1.3499999999999999e-133 or 1.55000000000000005e-186 < x Initial program 77.0%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6440.5
Applied rewrites40.5%
if -1.3499999999999999e-133 < x < 1.55000000000000005e-186Initial program 74.0%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6474.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.0
Applied rewrites74.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
associate-/l/N/A
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6490.9
Applied rewrites90.9%
Taylor expanded in y around 0
Applied rewrites80.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -8e-41) (/ (/ y (+ x 1.0)) (+ x y)) (/ (/ x (+ 1.0 y)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8e-41) {
tmp = (y / (x + 1.0)) / (x + y);
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-8d-41)) then
tmp = (y / (x + 1.0d0)) / (x + y)
else
tmp = (x / (1.0d0 + y)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -8e-41) {
tmp = (y / (x + 1.0)) / (x + y);
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -8e-41: tmp = (y / (x + 1.0)) / (x + y) else: tmp = (x / (1.0 + y)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -8e-41) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -8e-41)
tmp = (y / (x + 1.0)) / (x + y);
else
tmp = (x / (1.0 + y)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -8e-41], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-41}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if x < -8.00000000000000005e-41Initial program 67.8%
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 y around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6478.7
Applied rewrites78.7%
if -8.00000000000000005e-41 < x Initial program 75.9%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6475.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6475.9
Applied rewrites75.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
associate-/l/N/A
Applied rewrites99.5%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6461.2
Applied rewrites61.2%
Applied rewrites62.6%
Final simplification66.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2e+20) (/ (/ y x) (+ x y)) (/ (/ x (+ 1.0 y)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2e+20) {
tmp = (y / x) / (x + y);
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2d+20)) then
tmp = (y / x) / (x + y)
else
tmp = (x / (1.0d0 + y)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2e+20) {
tmp = (y / x) / (x + y);
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2e+20: tmp = (y / x) / (x + y) else: tmp = (x / (1.0 + y)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2e+20) tmp = Float64(Float64(y / x) / Float64(x + y)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2e+20)
tmp = (y / x) / (x + y);
else
tmp = (x / (1.0 + y)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2e+20], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+20}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if x < -2e20Initial program 65.5%
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-/.f6483.7
Applied rewrites83.7%
if -2e20 < x Initial program 76.1%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6476.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.1
Applied rewrites76.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
associate-/l/N/A
Applied rewrites99.5%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6460.7
Applied rewrites60.7%
Applied rewrites62.1%
Final simplification66.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2e+20) (/ (/ y x) x) (/ (/ x (+ 1.0 y)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2e+20) {
tmp = (y / x) / x;
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2d+20)) then
tmp = (y / x) / x
else
tmp = (x / (1.0d0 + y)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2e+20) {
tmp = (y / x) / x;
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2e+20: tmp = (y / x) / x else: tmp = (x / (1.0 + y)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2e+20) tmp = Float64(Float64(y / x) / x); else tmp = Float64(Float64(x / Float64(1.0 + y)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2e+20)
tmp = (y / x) / x;
else
tmp = (x / (1.0 + y)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2e+20], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+20}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if x < -2e20Initial program 65.5%
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-*.f6477.9
Applied rewrites77.9%
Applied rewrites83.4%
if -2e20 < x Initial program 76.1%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6476.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.1
Applied rewrites76.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
associate-/l/N/A
Applied rewrites99.5%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6460.7
Applied rewrites60.7%
Applied rewrites62.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2e+20) (/ (/ y x) x) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2e+20) {
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 <= -2e+20) tmp = Float64(Float64(y / 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, -2e+20], N[(N[(y / x), $MachinePrecision] / x), $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 -2 \cdot 10^{+20}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if x < -2e20Initial program 65.5%
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-*.f6477.9
Applied rewrites77.9%
Applied rewrites83.4%
if -2e20 < x Initial program 76.1%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6460.7
Applied rewrites60.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -8e-41) (/ y (fma x x x)) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8e-41) {
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 <= -8e-41) 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, -8e-41], 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 -8 \cdot 10^{-41}:\\
\;\;\;\;\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 < -8.00000000000000005e-41Initial program 67.8%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6473.7
Applied rewrites73.7%
if -8.00000000000000005e-41 < x Initial program 75.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6461.2
Applied rewrites61.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2e+20) (/ y (* x x)) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2e+20) {
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 <= -2e+20) 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, -2e+20], 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 -2 \cdot 10^{+20}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if x < -2e20Initial program 65.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6477.9
Applied rewrites77.9%
if -2e20 < x Initial program 76.1%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6460.7
Applied rewrites60.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.0) (/ x y) (/ x (* y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.0) {
tmp = x / y;
} else {
tmp = x / (y * y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.0d0) then
tmp = x / y
else
tmp = x / (y * y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.0) {
tmp = x / y;
} else {
tmp = x / (y * y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.0: tmp = x / y else: tmp = x / (y * y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.0) tmp = Float64(x / y); else tmp = Float64(x / Float64(y * y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.0)
tmp = x / y;
else
tmp = x / (y * y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.0], N[(x / y), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 1Initial program 76.5%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6476.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.5
Applied rewrites76.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
associate-/l/N/A
Applied rewrites99.3%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6444.0
Applied rewrites44.0%
Taylor expanded in y around 0
Applied rewrites28.8%
if 1 < y Initial program 66.1%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6470.5
Applied rewrites70.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
assert x < y;
public static double code(double x, double y) {
return x / y;
}
[x, y] = sort([x, y]) def code(x, y): return x / y
x, y = sort([x, y]) function code(x, y) return Float64(x / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Initial program 73.9%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6473.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6473.9
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
associate-/l/N/A
Applied rewrites99.4%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6450.7
Applied rewrites50.7%
Taylor expanded in y around 0
Applied rewrites28.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 2024249
(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))))