
(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 67.6%
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%
Final simplification99.8%
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 -3.35e-74)
(/ (* 1.0 (/ y t_0)) (+ x y))
(if (<= y 4.5e-12)
(* (/ x (* (+ x 1.0) (+ x y))) (/ y (+ x y)))
(if (<= y 3.1e+80)
(/ (* x y) (* (* (+ x y) (+ x y)) t_0))
(/ (/ x y) (+ x y)))))))assert(x < y);
double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (y <= -3.35e-74) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 4.5e-12) {
tmp = (x / ((x + 1.0) * (x + y))) * (y / (x + y));
} else if (y <= 3.1e+80) {
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
} 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) :: t_0
real(8) :: tmp
t_0 = (x + y) + 1.0d0
if (y <= (-3.35d-74)) then
tmp = (1.0d0 * (y / t_0)) / (x + y)
else if (y <= 4.5d-12) then
tmp = (x / ((x + 1.0d0) * (x + y))) * (y / (x + y))
else if (y <= 3.1d+80) then
tmp = (x * y) / (((x + y) * (x + y)) * t_0)
else
tmp = (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 <= -3.35e-74) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 4.5e-12) {
tmp = (x / ((x + 1.0) * (x + y))) * (y / (x + y));
} else if (y <= 3.1e+80) {
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
} else {
tmp = (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 <= -3.35e-74: tmp = (1.0 * (y / t_0)) / (x + y) elif y <= 4.5e-12: tmp = (x / ((x + 1.0) * (x + y))) * (y / (x + y)) elif y <= 3.1e+80: tmp = (x * y) / (((x + y) * (x + y)) * t_0) else: tmp = (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 <= -3.35e-74) tmp = Float64(Float64(1.0 * Float64(y / t_0)) / Float64(x + y)); elseif (y <= 4.5e-12) tmp = Float64(Float64(x / Float64(Float64(x + 1.0) * Float64(x + y))) * Float64(y / Float64(x + y))); elseif (y <= 3.1e+80) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * t_0)); else tmp = Float64(Float64(x / y) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (x + y) + 1.0;
tmp = 0.0;
if (y <= -3.35e-74)
tmp = (1.0 * (y / t_0)) / (x + y);
elseif (y <= 4.5e-12)
tmp = (x / ((x + 1.0) * (x + y))) * (y / (x + y));
elseif (y <= 3.1e+80)
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
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_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, -3.35e-74], N[(N[(1.0 * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e-12], N[(N[(x / N[(N[(x + 1.0), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+80], N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(x + y\right) + 1\\
\mathbf{if}\;y \leq -3.35 \cdot 10^{-74}:\\
\;\;\;\;\frac{1 \cdot \frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{\left(x + 1\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + y}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+80}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if y < -3.3499999999999998e-74Initial program 63.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites39.9%
if -3.3499999999999998e-74 < y < 4.49999999999999981e-12Initial program 71.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
if 4.49999999999999981e-12 < y < 3.09999999999999988e80Initial program 89.6%
if 3.09999999999999988e80 < y Initial program 56.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.8%
Taylor expanded in y around inf
lower-/.f6480.6
Applied rewrites80.6%
Final simplification77.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y -1.24e+17)
(/ (/ (fma (fma 3.0 y 1.0) (/ (- y) x) y) x) x)
(if (<= y 8.8e+133)
(/ (* (/ y (+ x y)) 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.24e+17) {
tmp = (fma(fma(3.0, y, 1.0), (-y / x), y) / x) / x;
} else if (y <= 8.8e+133) {
tmp = ((y / (x + y)) * 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.24e+17) tmp = Float64(Float64(fma(fma(3.0, y, 1.0), Float64(Float64(-y) / x), y) / x) / x); elseif (y <= 8.8e+133) tmp = Float64(Float64(Float64(y / Float64(x + y)) * x) / Float64(Float64(Float64(x + y) + 1.0) * Float64(x + y))); else tmp = 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.24e+17], N[(N[(N[(N[(3.0 * y + 1.0), $MachinePrecision] * N[((-y) / x), $MachinePrecision] + y), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 8.8e+133], N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * 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.24 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(3, y, 1\right), \frac{-y}{x}, y\right)}{x}}{x}\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{y}{x + y} \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.24e17Initial program 52.3%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-fma.f6422.3
Applied rewrites22.3%
Applied rewrites32.0%
if -1.24e17 < y < 8.8e133Initial program 75.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6499.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.3
Applied rewrites99.3%
if 8.8e133 < y Initial program 55.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6486.3
Applied rewrites86.3%
Final simplification83.4%
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.24e+17)
(/ (* 1.0 (/ y t_0)) (+ x y))
(if (<= y 8.8e+133)
(/ (* (/ y (+ x y)) x) (* t_0 (+ x y)))
(/ (/ 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.24e+17) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 8.8e+133) {
tmp = ((y / (x + y)) * x) / (t_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) :: t_0
real(8) :: tmp
t_0 = (x + y) + 1.0d0
if (y <= (-1.24d+17)) then
tmp = (1.0d0 * (y / t_0)) / (x + y)
else if (y <= 8.8d+133) then
tmp = ((y / (x + y)) * x) / (t_0 * (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 t_0 = (x + y) + 1.0;
double tmp;
if (y <= -1.24e+17) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 8.8e+133) {
tmp = ((y / (x + y)) * x) / (t_0 * (x + y));
} else {
tmp = (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.24e+17: tmp = (1.0 * (y / t_0)) / (x + y) elif y <= 8.8e+133: tmp = ((y / (x + y)) * x) / (t_0 * (x + y)) else: tmp = (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.24e+17) tmp = Float64(Float64(1.0 * Float64(y / t_0)) / Float64(x + y)); elseif (y <= 8.8e+133) tmp = Float64(Float64(Float64(y / Float64(x + y)) * x) / Float64(t_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)
t_0 = (x + y) + 1.0;
tmp = 0.0;
if (y <= -1.24e+17)
tmp = (1.0 * (y / t_0)) / (x + y);
elseif (y <= 8.8e+133)
tmp = ((y / (x + y)) * x) / (t_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_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, -1.24e+17], N[(N[(1.0 * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.8e+133], N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(t$95$0 * 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}
t_0 := \left(x + y\right) + 1\\
\mathbf{if}\;y \leq -1.24 \cdot 10^{+17}:\\
\;\;\;\;\frac{1 \cdot \frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{y}{x + y} \cdot x}{t\_0 \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if y < -1.24e17Initial program 52.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.7%
Taylor expanded in y around 0
Applied rewrites34.2%
if -1.24e17 < y < 8.8e133Initial program 75.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6499.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.3
Applied rewrites99.3%
if 8.8e133 < y Initial program 55.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6486.3
Applied rewrites86.3%
Final simplification83.8%
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 -3.35e-74)
(/ (* 1.0 (/ y t_0)) (+ x y))
(if (<= y 8.8e+133)
(* (/ x (* t_0 (+ x y))) (/ y (+ x y)))
(/ (/ x y) (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (y <= -3.35e-74) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 8.8e+133) {
tmp = (x / (t_0 * (x + y))) * (y / (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) :: t_0
real(8) :: tmp
t_0 = (x + y) + 1.0d0
if (y <= (-3.35d-74)) then
tmp = (1.0d0 * (y / t_0)) / (x + y)
else if (y <= 8.8d+133) then
tmp = (x / (t_0 * (x + y))) * (y / (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 t_0 = (x + y) + 1.0;
double tmp;
if (y <= -3.35e-74) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (y <= 8.8e+133) {
tmp = (x / (t_0 * (x + y))) * (y / (x + y));
} else {
tmp = (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 <= -3.35e-74: tmp = (1.0 * (y / t_0)) / (x + y) elif y <= 8.8e+133: tmp = (x / (t_0 * (x + y))) * (y / (x + y)) else: tmp = (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 <= -3.35e-74) tmp = Float64(Float64(1.0 * Float64(y / t_0)) / Float64(x + y)); elseif (y <= 8.8e+133) tmp = Float64(Float64(x / Float64(t_0 * Float64(x + y))) * Float64(y / 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)
t_0 = (x + y) + 1.0;
tmp = 0.0;
if (y <= -3.35e-74)
tmp = (1.0 * (y / t_0)) / (x + y);
elseif (y <= 8.8e+133)
tmp = (x / (t_0 * (x + y))) * (y / (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_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, -3.35e-74], N[(N[(1.0 * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.8e+133], N[(N[(x / N[(t$95$0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(x + y\right) + 1\\
\mathbf{if}\;y \leq -3.35 \cdot 10^{-74}:\\
\;\;\;\;\frac{1 \cdot \frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+133}:\\
\;\;\;\;\frac{x}{t\_0 \cdot \left(x + y\right)} \cdot \frac{y}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if y < -3.3499999999999998e-74Initial program 63.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites39.9%
if -3.3499999999999998e-74 < y < 8.8e133Initial program 73.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.2
Applied rewrites99.2%
if 8.8e133 < y Initial program 55.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6486.3
Applied rewrites86.3%
Final simplification80.0%
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.3e+60)
(/ (* 1.0 (/ y t_0)) (+ x y))
(if (<= x -4.4e-158)
(/ (* x y) (* (* t_0 (+ x y)) (+ x y)))
(/ (/ x (+ 1.0 y)) (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (x <= -1.3e+60) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (x <= -4.4e-158) {
tmp = (x * y) / ((t_0 * (x + y)) * (x + y));
} else {
tmp = (x / (1.0 + 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 (x <= (-1.3d+60)) then
tmp = (1.0d0 * (y / t_0)) / (x + y)
else if (x <= (-4.4d-158)) then
tmp = (x * y) / ((t_0 * (x + y)) * (x + y))
else
tmp = (x / (1.0d0 + 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 (x <= -1.3e+60) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (x <= -4.4e-158) {
tmp = (x * y) / ((t_0 * (x + y)) * (x + y));
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (x + y) + 1.0 tmp = 0 if x <= -1.3e+60: tmp = (1.0 * (y / t_0)) / (x + y) elif x <= -4.4e-158: tmp = (x * y) / ((t_0 * (x + y)) * (x + y)) else: tmp = (x / (1.0 + 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 (x <= -1.3e+60) tmp = Float64(Float64(1.0 * Float64(y / t_0)) / Float64(x + y)); elseif (x <= -4.4e-158) tmp = Float64(Float64(x * y) / Float64(Float64(t_0 * Float64(x + y)) * Float64(x + y))); else tmp = Float64(Float64(x / Float64(1.0 + 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 (x <= -1.3e+60)
tmp = (1.0 * (y / t_0)) / (x + y);
elseif (x <= -4.4e-158)
tmp = (x * y) / ((t_0 * (x + y)) * (x + y));
else
tmp = (x / (1.0 + 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[x, -1.3e+60], N[(N[(1.0 * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.4e-158], N[(N[(x * y), $MachinePrecision] / N[(N[(t$95$0 * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $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}\;x \leq -1.3 \cdot 10^{+60}:\\
\;\;\;\;\frac{1 \cdot \frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-158}:\\
\;\;\;\;\frac{x \cdot y}{\left(t\_0 \cdot \left(x + y\right)\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{x + y}\\
\end{array}
\end{array}
if x < -1.30000000000000004e60Initial program 49.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites81.4%
if -1.30000000000000004e60 < x < -4.4000000000000002e-158Initial program 89.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6489.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6489.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6489.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6489.9
Applied rewrites89.9%
if -4.4000000000000002e-158 < x Initial program 69.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6457.9
Applied rewrites57.9%
Final simplification68.0%
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.3e+60)
(/ (* 1.0 (/ y t_0)) (+ x y))
(if (<= x -4.4e-158)
(/ (* x y) (* (* (+ x y) (+ x y)) t_0))
(/ (/ x (+ 1.0 y)) (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = (x + y) + 1.0;
double tmp;
if (x <= -1.3e+60) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (x <= -4.4e-158) {
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
} else {
tmp = (x / (1.0 + 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 (x <= (-1.3d+60)) then
tmp = (1.0d0 * (y / t_0)) / (x + y)
else if (x <= (-4.4d-158)) then
tmp = (x * y) / (((x + y) * (x + y)) * t_0)
else
tmp = (x / (1.0d0 + 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 (x <= -1.3e+60) {
tmp = (1.0 * (y / t_0)) / (x + y);
} else if (x <= -4.4e-158) {
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (x + y) + 1.0 tmp = 0 if x <= -1.3e+60: tmp = (1.0 * (y / t_0)) / (x + y) elif x <= -4.4e-158: tmp = (x * y) / (((x + y) * (x + y)) * t_0) else: tmp = (x / (1.0 + 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 (x <= -1.3e+60) tmp = Float64(Float64(1.0 * Float64(y / t_0)) / Float64(x + y)); elseif (x <= -4.4e-158) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * t_0)); else tmp = Float64(Float64(x / Float64(1.0 + 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 (x <= -1.3e+60)
tmp = (1.0 * (y / t_0)) / (x + y);
elseif (x <= -4.4e-158)
tmp = (x * y) / (((x + y) * (x + y)) * t_0);
else
tmp = (x / (1.0 + 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[x, -1.3e+60], N[(N[(1.0 * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.4e-158], N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $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}\;x \leq -1.3 \cdot 10^{+60}:\\
\;\;\;\;\frac{1 \cdot \frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-158}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{x + y}\\
\end{array}
\end{array}
if x < -1.30000000000000004e60Initial program 49.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites81.4%
if -1.30000000000000004e60 < x < -4.4000000000000002e-158Initial program 89.7%
if -4.4000000000000002e-158 < x Initial program 69.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6457.9
Applied rewrites57.9%
Final simplification67.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.45e+17)
(/ (/ y x) (+ x y))
(if (<= x -5.7e-87)
(/ y (* (+ x 1.0) x))
(if (<= x 5e+25) (/ x (fma y y y)) (/ (/ x y) (+ x y))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.45e+17) {
tmp = (y / x) / (x + y);
} else if (x <= -5.7e-87) {
tmp = y / ((x + 1.0) * x);
} else if (x <= 5e+25) {
tmp = x / fma(y, y, y);
} else {
tmp = (x / y) / (x + y);
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.45e+17) tmp = Float64(Float64(y / x) / Float64(x + y)); elseif (x <= -5.7e-87) tmp = Float64(y / Float64(Float64(x + 1.0) * x)); elseif (x <= 5e+25) tmp = Float64(x / fma(y, y, y)); else tmp = 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[x, -2.45e+17], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.7e-87], N[(y / N[(N[(x + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e+25], N[(x / N[(y * y + y), $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}\;x \leq -2.45 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\
\mathbf{elif}\;x \leq -5.7 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot x}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+25}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if x < -2.45e17Initial program 53.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in x around inf
lower-/.f6478.8
Applied rewrites78.8%
if -2.45e17 < x < -5.7e-87Initial program 89.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.7%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6461.8
Applied rewrites61.8%
if -5.7e-87 < x < 5.00000000000000024e25Initial program 74.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6476.0
Applied rewrites76.0%
if 5.00000000000000024e25 < x Initial program 61.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6424.0
Applied rewrites24.0%
Final simplification64.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1e+27)
(/ (/ y x) x)
(if (<= x -5.7e-87)
(/ y (* (+ x 1.0) x))
(if (<= x 5e+25) (/ x (fma y y y)) (/ (/ x y) (+ x y))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1e+27) {
tmp = (y / x) / x;
} else if (x <= -5.7e-87) {
tmp = y / ((x + 1.0) * x);
} else if (x <= 5e+25) {
tmp = x / fma(y, y, y);
} else {
tmp = (x / y) / (x + y);
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1e+27) tmp = Float64(Float64(y / x) / x); elseif (x <= -5.7e-87) tmp = Float64(y / Float64(Float64(x + 1.0) * x)); elseif (x <= 5e+25) tmp = Float64(x / fma(y, y, y)); else tmp = 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[x, -1e+27], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -5.7e-87], N[(y / N[(N[(x + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e+25], N[(x / N[(y * y + y), $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}\;x \leq -1 \cdot 10^{+27}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -5.7 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot x}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+25}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if x < -1e27Initial program 53.4%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-fma.f6471.6
Applied rewrites71.6%
Taylor expanded in x around inf
Applied rewrites78.5%
if -1e27 < x < -5.7e-87Initial program 89.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.7%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6461.8
Applied rewrites61.8%
if -5.7e-87 < x < 5.00000000000000024e25Initial program 74.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6476.0
Applied rewrites76.0%
if 5.00000000000000024e25 < x Initial program 61.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6424.0
Applied rewrites24.0%
Final simplification64.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.7e-87) (/ (* 1.0 (/ y (+ (+ x y) 1.0))) (+ x y)) (/ (/ x (+ 1.0 y)) (+ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.7e-87) {
tmp = (1.0 * (y / ((x + y) + 1.0))) / (x + y);
} else {
tmp = (x / (1.0 + 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 (x <= (-5.7d-87)) then
tmp = (1.0d0 * (y / ((x + y) + 1.0d0))) / (x + y)
else
tmp = (x / (1.0d0 + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -5.7e-87) {
tmp = (1.0 * (y / ((x + y) + 1.0))) / (x + y);
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5.7e-87: tmp = (1.0 * (y / ((x + y) + 1.0))) / (x + y) else: tmp = (x / (1.0 + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.7e-87) tmp = Float64(Float64(1.0 * Float64(y / Float64(Float64(x + y) + 1.0))) / Float64(x + y)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -5.7e-87)
tmp = (1.0 * (y / ((x + y) + 1.0))) / (x + y);
else
tmp = (x / (1.0 + 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[x, -5.7e-87], N[(N[(1.0 * N[(y / N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.7 \cdot 10^{-87}:\\
\;\;\;\;\frac{1 \cdot \frac{y}{\left(x + y\right) + 1}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{x + y}\\
\end{array}
\end{array}
if x < -5.7e-87Initial program 61.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites75.8%
if -5.7e-87 < x Initial program 70.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6459.8
Applied rewrites59.8%
Final simplification65.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1e+27)
(/ (/ y x) x)
(if (<= x -5.7e-87)
(/ y (* (+ x 1.0) x))
(if (<= x 1.6e+35) (/ x (fma y y y)) (/ (/ x y) y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1e+27) {
tmp = (y / x) / x;
} else if (x <= -5.7e-87) {
tmp = y / ((x + 1.0) * x);
} else if (x <= 1.6e+35) {
tmp = x / fma(y, y, y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1e+27) tmp = Float64(Float64(y / x) / x); elseif (x <= -5.7e-87) tmp = Float64(y / Float64(Float64(x + 1.0) * x)); elseif (x <= 1.6e+35) tmp = Float64(x / fma(y, y, y)); else tmp = Float64(Float64(x / 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, -1e+27], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -5.7e-87], N[(y / N[(N[(x + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.6e+35], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+27}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -5.7 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot x}\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -1e27Initial program 53.4%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-fma.f6471.6
Applied rewrites71.6%
Taylor expanded in x around inf
Applied rewrites78.5%
if -1e27 < x < -5.7e-87Initial program 89.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.7%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6461.8
Applied rewrites61.8%
if -5.7e-87 < x < 1.59999999999999991e35Initial program 74.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6476.0
Applied rewrites76.0%
if 1.59999999999999991e35 < x Initial program 61.7%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6414.7
Applied rewrites14.7%
Applied rewrites23.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.45e+17) (/ (/ y x) (+ x y)) (if (<= x -5.7e-87) (/ y (* (+ x 1.0) x)) (/ (/ x (+ 1.0 y)) (+ x y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.45e+17) {
tmp = (y / x) / (x + y);
} else if (x <= -5.7e-87) {
tmp = y / ((x + 1.0) * x);
} else {
tmp = (x / (1.0 + 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 (x <= (-2.45d+17)) then
tmp = (y / x) / (x + y)
else if (x <= (-5.7d-87)) then
tmp = y / ((x + 1.0d0) * x)
else
tmp = (x / (1.0d0 + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.45e+17) {
tmp = (y / x) / (x + y);
} else if (x <= -5.7e-87) {
tmp = y / ((x + 1.0) * x);
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.45e+17: tmp = (y / x) / (x + y) elif x <= -5.7e-87: tmp = y / ((x + 1.0) * x) else: tmp = (x / (1.0 + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.45e+17) tmp = Float64(Float64(y / x) / Float64(x + y)); elseif (x <= -5.7e-87) tmp = Float64(y / Float64(Float64(x + 1.0) * x)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.45e+17)
tmp = (y / x) / (x + y);
elseif (x <= -5.7e-87)
tmp = y / ((x + 1.0) * x);
else
tmp = (x / (1.0 + 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[x, -2.45e+17], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.7e-87], N[(y / N[(N[(x + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\
\mathbf{elif}\;x \leq -5.7 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{x + y}\\
\end{array}
\end{array}
if x < -2.45e17Initial program 53.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in x around inf
lower-/.f6478.8
Applied rewrites78.8%
if -2.45e17 < x < -5.7e-87Initial program 89.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.7%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6461.8
Applied rewrites61.8%
if -5.7e-87 < x Initial program 70.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6459.8
Applied rewrites59.8%
Final simplification64.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.7e-87) (/ (/ y (+ x 1.0)) (+ x y)) (/ (/ x (+ 1.0 y)) (+ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.7e-87) {
tmp = (y / (x + 1.0)) / (x + y);
} else {
tmp = (x / (1.0 + 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 (x <= (-5.7d-87)) then
tmp = (y / (x + 1.0d0)) / (x + y)
else
tmp = (x / (1.0d0 + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -5.7e-87) {
tmp = (y / (x + 1.0)) / (x + y);
} else {
tmp = (x / (1.0 + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5.7e-87: tmp = (y / (x + 1.0)) / (x + y) else: tmp = (x / (1.0 + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.7e-87) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -5.7e-87)
tmp = (y / (x + 1.0)) / (x + y);
else
tmp = (x / (1.0 + 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[x, -5.7e-87], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.7 \cdot 10^{-87}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{x + y}\\
\end{array}
\end{array}
if x < -5.7e-87Initial program 61.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6475.2
Applied rewrites75.2%
if -5.7e-87 < x Initial program 70.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6459.8
Applied rewrites59.8%
Final simplification64.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1e+27) (/ (/ y x) x) (if (<= x -5.7e-87) (/ y (* (+ x 1.0) x)) (/ x (fma y y y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1e+27) {
tmp = (y / x) / x;
} else if (x <= -5.7e-87) {
tmp = y / ((x + 1.0) * x);
} else {
tmp = x / fma(y, y, y);
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1e+27) tmp = Float64(Float64(y / x) / x); elseif (x <= -5.7e-87) tmp = Float64(y / Float64(Float64(x + 1.0) * 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, -1e+27], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -5.7e-87], N[(y / N[(N[(x + 1.0), $MachinePrecision] * 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 -1 \cdot 10^{+27}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -5.7 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if x < -1e27Initial program 53.4%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-fma.f6471.6
Applied rewrites71.6%
Taylor expanded in x around inf
Applied rewrites78.5%
if -1e27 < x < -5.7e-87Initial program 89.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.7%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6461.8
Applied rewrites61.8%
if -5.7e-87 < x Initial program 70.7%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6456.8
Applied rewrites56.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.7e-87) (/ y (* (+ x 1.0) x)) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.7e-87) {
tmp = y / ((x + 1.0) * x);
} else {
tmp = x / fma(y, y, y);
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.7e-87) tmp = Float64(y / Float64(Float64(x + 1.0) * 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, -5.7e-87], N[(y / N[(N[(x + 1.0), $MachinePrecision] * 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 -5.7 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if x < -5.7e-87Initial program 61.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6471.1
Applied rewrites71.1%
if -5.7e-87 < x Initial program 70.7%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6456.8
Applied rewrites56.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.7e-87) (/ y (fma x x x)) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.7e-87) {
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 <= -5.7e-87) 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, -5.7e-87], 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 -5.7 \cdot 10^{-87}:\\
\;\;\;\;\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 < -5.7e-87Initial program 61.1%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6471.1
Applied rewrites71.1%
if -5.7e-87 < x Initial program 70.7%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6456.8
Applied rewrites56.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -65000.0) (/ y (* x x)) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -65000.0) {
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 <= -65000.0) 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, -65000.0], 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 -65000:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if x < -65000Initial program 56.0%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6472.9
Applied rewrites72.9%
if -65000 < x Initial program 71.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6456.4
Applied rewrites56.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -65000.0) (/ y (* x x)) (/ x (* y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -65000.0) {
tmp = y / (x * x);
} else {
tmp = x / (y * y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-65000.0d0)) then
tmp = y / (x * x)
else
tmp = x / (y * y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -65000.0) {
tmp = y / (x * x);
} else {
tmp = x / (y * y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -65000.0: tmp = y / (x * x) else: tmp = x / (y * y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -65000.0) tmp = Float64(y / Float64(x * x)); 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 (x <= -65000.0)
tmp = y / (x * x);
else
tmp = x / (y * y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -65000.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -65000:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if x < -65000Initial program 56.0%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6472.9
Applied rewrites72.9%
if -65000 < x Initial program 71.9%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6439.4
Applied rewrites39.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x (* y y)))
assert(x < y);
double code(double x, double y) {
return x / (y * 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 * y)
end function
assert x < y;
public static double code(double x, double y) {
return x / (y * y);
}
[x, y] = sort([x, y]) def code(x, y): return x / (y * y)
x, y = sort([x, y]) function code(x, y) return Float64(x / Float64(y * y)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / (y * y);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y \cdot y}
\end{array}
Initial program 67.6%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6431.9
Applied rewrites31.9%
(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 2024270
(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))))