
(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 20 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 (/ (* (/ y (+ (+ y x) 1.0)) (/ x (+ y x))) (+ y x)))
assert(x < y);
double code(double x, double y) {
return ((y / ((y + x) + 1.0)) * (x / (y + x))) / (y + x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y / ((y + x) + 1.0d0)) * (x / (y + x))) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
return ((y / ((y + x) + 1.0)) * (x / (y + x))) / (y + x);
}
[x, y] = sort([x, y]) def code(x, y): return ((y / ((y + x) + 1.0)) * (x / (y + x))) / (y + x)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(y / Float64(Float64(y + x) + 1.0)) * Float64(x / Float64(y + x))) / Float64(y + x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((y / ((y + x) + 1.0)) * (x / (y + x))) / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{\left(y + x\right) + 1} \cdot \frac{x}{y + x}}{y + x}
\end{array}
Initial program 71.9%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.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 (+ (+ y x) 1.0)))
(if (<= y -1.4e-64)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= y 9.8e+151)
(/ (* x (/ y (+ y x))) (* (+ y x) t_0))
(/ (/ x (* (+ y x) (/ t_0 y))) y)))))assert(x < y);
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= -1.4e-64) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 9.8e+151) {
tmp = (x * (y / (y + x))) / ((y + x) * t_0);
} else {
tmp = (x / ((y + x) * (t_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) :: t_0
real(8) :: tmp
t_0 = (y + x) + 1.0d0
if (y <= (-1.4d-64)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (y <= 9.8d+151) then
tmp = (x * (y / (y + x))) / ((y + x) * t_0)
else
tmp = (x / ((y + x) * (t_0 / y))) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= -1.4e-64) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (y <= 9.8e+151) {
tmp = (x * (y / (y + x))) / ((y + x) * t_0);
} else {
tmp = (x / ((y + x) * (t_0 / y))) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if y <= -1.4e-64: tmp = (y / (x + 1.0)) / (y + x) elif y <= 9.8e+151: tmp = (x * (y / (y + x))) / ((y + x) * t_0) else: tmp = (x / ((y + x) * (t_0 / y))) / y return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (y <= -1.4e-64) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (y <= 9.8e+151) tmp = Float64(Float64(x * Float64(y / Float64(y + x))) / Float64(Float64(y + x) * t_0)); else tmp = Float64(Float64(x / Float64(Float64(y + x) * Float64(t_0 / y))) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (y + x) + 1.0;
tmp = 0.0;
if (y <= -1.4e-64)
tmp = (y / (x + 1.0)) / (y + x);
elseif (y <= 9.8e+151)
tmp = (x * (y / (y + x))) / ((y + x) * t_0);
else
tmp = (x / ((y + x) * (t_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_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, -1.4e-64], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e+151], N[(N[(x * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;y \leq -1.4 \cdot 10^{-64}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+151}:\\
\;\;\;\;\frac{x \cdot \frac{y}{y + x}}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{\left(y + x\right) \cdot \frac{t\_0}{y}}}{y}\\
\end{array}
\end{array}
if y < -1.40000000000000002e-64Initial program 67.3%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in y around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6427.9
Simplified27.9%
if -1.40000000000000002e-64 < y < 9.7999999999999998e151Initial program 77.0%
*-commutativeN/A
associate-*l*N/A
times-fracN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6498.6
Applied egg-rr98.6%
if 9.7999999999999998e151 < y Initial program 58.4%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
*-commutativeN/A
clear-numN/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
*-rgt-identityN/A
/-lowering-/.f64N/A
+-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-commutativeN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around 0
Simplified90.8%
Final simplification76.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ y x) 1.0)))
(if (<= x -4.6e+156)
(/ (/ y t_0) (+ y x))
(if (<= x -1.6e-162)
(/ (* y (/ x (* (+ y x) (+ y x)))) t_0)
(/ (/ x (+ y 1.0)) y)))))assert(x < y);
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (x <= -4.6e+156) {
tmp = (y / t_0) / (y + x);
} else if (x <= -1.6e-162) {
tmp = (y * (x / ((y + x) * (y + x)))) / t_0;
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y + x) + 1.0d0
if (x <= (-4.6d+156)) then
tmp = (y / t_0) / (y + x)
else if (x <= (-1.6d-162)) then
tmp = (y * (x / ((y + x) * (y + x)))) / t_0
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (x <= -4.6e+156) {
tmp = (y / t_0) / (y + x);
} else if (x <= -1.6e-162) {
tmp = (y * (x / ((y + x) * (y + x)))) / t_0;
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if x <= -4.6e+156: tmp = (y / t_0) / (y + x) elif x <= -1.6e-162: tmp = (y * (x / ((y + x) * (y + x)))) / t_0 else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (x <= -4.6e+156) tmp = Float64(Float64(y / t_0) / Float64(y + x)); elseif (x <= -1.6e-162) tmp = Float64(Float64(y * Float64(x / Float64(Float64(y + x) * Float64(y + x)))) / t_0); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (y + x) + 1.0;
tmp = 0.0;
if (x <= -4.6e+156)
tmp = (y / t_0) / (y + x);
elseif (x <= -1.6e-162)
tmp = (y * (x / ((y + x) * (y + x)))) / t_0;
else
tmp = (x / (y + 1.0)) / 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[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -4.6e+156], N[(N[(y / t$95$0), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.6e-162], N[(N[(y * N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;x \leq -4.6 \cdot 10^{+156}:\\
\;\;\;\;\frac{\frac{y}{t\_0}}{y + x}\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-162}:\\
\;\;\;\;\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -4.5999999999999998e156Initial program 60.0%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around inf
Simplified92.4%
if -4.5999999999999998e156 < x < -1.59999999999999988e-162Initial program 73.9%
times-fracN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6494.6
Applied egg-rr94.6%
if -1.59999999999999988e-162 < x Initial program 73.2%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6459.0
Simplified59.0%
Taylor expanded in x around 0
Simplified58.5%
Final simplification72.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ y x) 1.0)))
(if (<= x -1.2e+54)
(/ (/ y t_0) (+ y x))
(if (<= x -1.6e-162)
(* x (/ y (* t_0 (* (+ y x) (+ y x)))))
(/ (/ x (+ y 1.0)) y)))))assert(x < y);
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (x <= -1.2e+54) {
tmp = (y / t_0) / (y + x);
} else if (x <= -1.6e-162) {
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y + x) + 1.0d0
if (x <= (-1.2d+54)) then
tmp = (y / t_0) / (y + x)
else if (x <= (-1.6d-162)) then
tmp = x * (y / (t_0 * ((y + x) * (y + x))))
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (x <= -1.2e+54) {
tmp = (y / t_0) / (y + x);
} else if (x <= -1.6e-162) {
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if x <= -1.2e+54: tmp = (y / t_0) / (y + x) elif x <= -1.6e-162: tmp = x * (y / (t_0 * ((y + x) * (y + x)))) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (x <= -1.2e+54) tmp = Float64(Float64(y / t_0) / Float64(y + x)); elseif (x <= -1.6e-162) tmp = Float64(x * Float64(y / Float64(t_0 * Float64(Float64(y + x) * Float64(y + x))))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (y + x) + 1.0;
tmp = 0.0;
if (x <= -1.2e+54)
tmp = (y / t_0) / (y + x);
elseif (x <= -1.6e-162)
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
else
tmp = (x / (y + 1.0)) / 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[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -1.2e+54], N[(N[(y / t$95$0), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.6e-162], N[(x * N[(y / N[(t$95$0 * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;x \leq -1.2 \cdot 10^{+54}:\\
\;\;\;\;\frac{\frac{y}{t\_0}}{y + x}\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-162}:\\
\;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -1.19999999999999999e54Initial program 56.1%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around inf
Simplified77.5%
if -1.19999999999999999e54 < x < -1.59999999999999988e-162Initial program 88.7%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6494.0
Applied egg-rr94.0%
if -1.59999999999999988e-162 < x Initial program 73.2%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6459.0
Simplified59.0%
Taylor expanded in x around 0
Simplified58.5%
Final simplification68.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.4e+81)
(/ (/ y x) (+ y x))
(if (<= x -2.3e-137)
(* y (/ x (* (+ (+ y x) 1.0) (* (+ y x) (+ y x)))))
(/ (/ x (+ y 1.0)) y))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.4e+81) {
tmp = (y / x) / (y + x);
} else if (x <= -2.3e-137) {
tmp = y * (x / (((y + x) + 1.0) * ((y + x) * (y + x))));
} else {
tmp = (x / (y + 1.0)) / 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.4d+81)) then
tmp = (y / x) / (y + x)
else if (x <= (-2.3d-137)) then
tmp = y * (x / (((y + x) + 1.0d0) * ((y + x) * (y + x))))
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.4e+81) {
tmp = (y / x) / (y + x);
} else if (x <= -2.3e-137) {
tmp = y * (x / (((y + x) + 1.0) * ((y + x) * (y + x))));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.4e+81: tmp = (y / x) / (y + x) elif x <= -2.3e-137: tmp = y * (x / (((y + x) + 1.0) * ((y + x) * (y + x)))) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.4e+81) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -2.3e-137) tmp = Float64(y * Float64(x / Float64(Float64(Float64(y + x) + 1.0) * Float64(Float64(y + x) * Float64(y + x))))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.4e+81)
tmp = (y / x) / (y + x);
elseif (x <= -2.3e-137)
tmp = y * (x / (((y + x) + 1.0) * ((y + x) * (y + x))));
else
tmp = (x / (y + 1.0)) / 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.4e+81], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.3e-137], N[(y * N[(x / N[(N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+81}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-137}:\\
\;\;\;\;y \cdot \frac{x}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -1.39999999999999997e81Initial program 56.5%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around inf
/-lowering-/.f6480.7
Simplified80.7%
if -1.39999999999999997e81 < x < -2.30000000000000008e-137Initial program 84.1%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6491.8
Applied egg-rr91.8%
if -2.30000000000000008e-137 < x Initial program 73.9%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6460.0
Simplified60.0%
Taylor expanded in x around 0
Simplified59.6%
Final simplification69.5%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ y x) 1.0)))
(if (<= x -2.2e+160)
(/ (/ y t_0) (+ y x))
(/ (* x (/ y (+ y x))) (* (+ y x) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (x <= -2.2e+160) {
tmp = (y / t_0) / (y + x);
} else {
tmp = (x * (y / (y + x))) / ((y + x) * 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 = (y + x) + 1.0d0
if (x <= (-2.2d+160)) then
tmp = (y / t_0) / (y + x)
else
tmp = (x * (y / (y + x))) / ((y + x) * t_0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (x <= -2.2e+160) {
tmp = (y / t_0) / (y + x);
} else {
tmp = (x * (y / (y + x))) / ((y + x) * t_0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if x <= -2.2e+160: tmp = (y / t_0) / (y + x) else: tmp = (x * (y / (y + x))) / ((y + x) * t_0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (x <= -2.2e+160) tmp = Float64(Float64(y / t_0) / Float64(y + x)); else tmp = Float64(Float64(x * Float64(y / Float64(y + x))) / Float64(Float64(y + x) * t_0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (y + x) + 1.0;
tmp = 0.0;
if (x <= -2.2e+160)
tmp = (y / t_0) / (y + x);
else
tmp = (x * (y / (y + x))) / ((y + x) * 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[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -2.2e+160], N[(N[(y / t$95$0), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{y}{t\_0}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{y}{y + x}}{\left(y + x\right) \cdot t\_0}\\
\end{array}
\end{array}
if x < -2.19999999999999992e160Initial program 62.1%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around inf
Simplified95.4%
if -2.19999999999999992e160 < x Initial program 73.1%
*-commutativeN/A
associate-*l*N/A
times-fracN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6494.7
Applied egg-rr94.7%
Final simplification94.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ x (+ y x)) (/ (/ y (+ (+ y x) 1.0)) (+ y x))))
assert(x < y);
double code(double x, double y) {
return (x / (y + x)) * ((y / ((y + x) + 1.0)) / (y + x));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (y + x)) * ((y / ((y + x) + 1.0d0)) / (y + x))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (y + x)) * ((y / ((y + x) + 1.0)) / (y + x));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (y + x)) * ((y / ((y + x) + 1.0)) / (y + x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(y + x)) * Float64(Float64(y / Float64(Float64(y + x) + 1.0)) / Float64(y + x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (y + x)) * ((y / ((y + x) + 1.0)) / (y + x));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y + x} \cdot \frac{\frac{y}{\left(y + x\right) + 1}}{y + x}
\end{array}
Initial program 71.9%
times-fracN/A
associate-*l/N/A
times-fracN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.95e+15) (/ (/ y x) (+ y x)) (if (<= x -5.8e-92) (/ y (fma x x x)) (/ (/ x (+ y 1.0)) y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.95e+15) {
tmp = (y / x) / (y + x);
} else if (x <= -5.8e-92) {
tmp = y / fma(x, x, x);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.95e+15) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -5.8e-92) tmp = Float64(y / fma(x, x, x)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / 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.95e+15], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.8e-92], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.95 \cdot 10^{+15}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-92}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -2.95e15Initial program 58.9%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around inf
/-lowering-/.f6473.1
Simplified73.1%
if -2.95e15 < x < -5.79999999999999969e-92Initial program 87.8%
Taylor expanded in y around 0
/-lowering-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6448.4
Simplified48.4%
if -5.79999999999999969e-92 < x Initial program 75.0%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6461.7
Simplified61.7%
Taylor expanded in x around 0
Simplified61.3%
Final simplification63.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5e+131) (/ (/ y x) x) (if (<= x -5.8e-92) (/ y (fma x x x)) (/ (/ x (+ y 1.0)) y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5e+131) {
tmp = (y / x) / x;
} else if (x <= -5.8e-92) {
tmp = y / fma(x, x, x);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5e+131) tmp = Float64(Float64(y / x) / x); elseif (x <= -5.8e-92) tmp = Float64(y / fma(x, x, x)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / 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, -5e+131], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -5.8e-92], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+131}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-92}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -4.99999999999999995e131Initial program 56.3%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6478.5
Applied egg-rr78.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6480.6
Simplified80.6%
un-div-invN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f6483.7
Applied egg-rr83.7%
if -4.99999999999999995e131 < x < -5.79999999999999969e-92Initial program 75.1%
Taylor expanded in y around 0
/-lowering-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6451.1
Simplified51.1%
if -5.79999999999999969e-92 < x Initial program 75.0%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6461.7
Simplified61.7%
Taylor expanded in x around 0
Simplified61.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.5e-92) (/ (/ y (+ (+ y x) 1.0)) (+ y x)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.5e-92) {
tmp = (y / ((y + x) + 1.0)) / (y + x);
} else {
tmp = (x / (y + 1.0)) / 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 <= (-3.5d-92)) then
tmp = (y / ((y + x) + 1.0d0)) / (y + x)
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.5e-92) {
tmp = (y / ((y + x) + 1.0)) / (y + x);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.5e-92: tmp = (y / ((y + x) + 1.0)) / (y + x) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.5e-92) tmp = Float64(Float64(y / Float64(Float64(y + x) + 1.0)) / Float64(y + x)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.5e-92)
tmp = (y / ((y + x) + 1.0)) / (y + x);
else
tmp = (x / (y + 1.0)) / 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, -3.5e-92], N[(N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-92}:\\
\;\;\;\;\frac{\frac{y}{\left(y + x\right) + 1}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -3.5e-92Initial program 66.2%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around inf
Simplified67.6%
if -3.5e-92 < x Initial program 75.0%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6461.7
Simplified61.7%
Taylor expanded in x around 0
Simplified61.3%
Final simplification63.5%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y y))))
(if (<= x -0.00045)
(/ y (* x x))
(if (<= x -9.6e-218) t_0 (if (<= x 9.8e-228) (/ x y) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (x <= -0.00045) {
tmp = y / (x * x);
} else if (x <= -9.6e-218) {
tmp = t_0;
} else if (x <= 9.8e-228) {
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 <= (-0.00045d0)) then
tmp = y / (x * x)
else if (x <= (-9.6d-218)) then
tmp = t_0
else if (x <= 9.8d-228) 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 <= -0.00045) {
tmp = y / (x * x);
} else if (x <= -9.6e-218) {
tmp = t_0;
} else if (x <= 9.8e-228) {
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 <= -0.00045: tmp = y / (x * x) elif x <= -9.6e-218: tmp = t_0 elif x <= 9.8e-228: 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 <= -0.00045) tmp = Float64(y / Float64(x * x)); elseif (x <= -9.6e-218) tmp = t_0; elseif (x <= 9.8e-228) 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 <= -0.00045)
tmp = y / (x * x);
elseif (x <= -9.6e-218)
tmp = t_0;
elseif (x <= 9.8e-228)
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, -0.00045], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.6e-218], t$95$0, If[LessEqual[x, 9.8e-228], 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 -0.00045:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -9.6 \cdot 10^{-218}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{-228}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.4999999999999999e-4Initial program 61.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6469.2
Simplified69.2%
if -4.4999999999999999e-4 < x < -9.6000000000000003e-218 or 9.79999999999999976e-228 < x Initial program 79.9%
Taylor expanded in y around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6443.0
Simplified43.0%
if -9.6000000000000003e-218 < x < 9.79999999999999976e-228Initial program 58.2%
Taylor expanded in x around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6458.3
Simplified58.3%
Taylor expanded in y around 0
/-lowering-/.f6481.2
Simplified81.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.8e-92) (/ (/ y (+ x 1.0)) (+ y x)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.8e-92) {
tmp = (y / (x + 1.0)) / (y + x);
} else {
tmp = (x / (y + 1.0)) / 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.8d-92)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -5.8e-92) {
tmp = (y / (x + 1.0)) / (y + x);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5.8e-92: tmp = (y / (x + 1.0)) / (y + x) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.8e-92) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -5.8e-92)
tmp = (y / (x + 1.0)) / (y + x);
else
tmp = (x / (y + 1.0)) / 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.8e-92], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-92}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -5.79999999999999969e-92Initial program 66.2%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in y around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6467.0
Simplified67.0%
if -5.79999999999999969e-92 < x Initial program 75.0%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6461.7
Simplified61.7%
Taylor expanded in x around 0
Simplified61.3%
Final simplification63.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5e+131) (/ (/ y x) x) (if (<= x -5.8e-92) (/ y (fma x x x)) (/ x (fma y y y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5e+131) {
tmp = (y / x) / x;
} else if (x <= -5.8e-92) {
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 <= -5e+131) tmp = Float64(Float64(y / x) / x); elseif (x <= -5.8e-92) 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, -5e+131], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -5.8e-92], 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 \cdot 10^{+131}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-92}:\\
\;\;\;\;\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 < -4.99999999999999995e131Initial program 56.3%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6478.5
Applied egg-rr78.5%
Taylor expanded in x around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6480.6
Simplified80.6%
un-div-invN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f6483.7
Applied egg-rr83.7%
if -4.99999999999999995e131 < x < -5.79999999999999969e-92Initial program 75.1%
Taylor expanded in y around 0
/-lowering-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6451.1
Simplified51.1%
if -5.79999999999999969e-92 < x Initial program 75.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6461.5
Simplified61.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7.3e-93) (/ y (fma x x x)) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7.3e-93) {
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 <= -7.3e-93) 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, -7.3e-93], 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 -7.3 \cdot 10^{-93}:\\
\;\;\;\;\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 < -7.29999999999999976e-93Initial program 66.2%
Taylor expanded in y around 0
/-lowering-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6465.1
Simplified65.1%
if -7.29999999999999976e-93 < x Initial program 75.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6461.5
Simplified61.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2200.0) (/ y (* x x)) (/ x (fma y y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2200.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 <= -2200.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, -2200.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 -2200:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if x < -2200Initial program 61.2%
Taylor expanded in x around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6469.2
Simplified69.2%
if -2200 < x Initial program 76.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6461.3
Simplified61.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2400000.0) (/ x (+ y x)) (/ x (* y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2400000.0) {
tmp = x / (y + 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 (y <= 2400000.0d0) then
tmp = x / (y + 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 (y <= 2400000.0) {
tmp = x / (y + x);
} else {
tmp = x / (y * y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2400000.0: tmp = x / (y + x) else: tmp = x / (y * y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2400000.0) tmp = Float64(x / Float64(y + 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 (y <= 2400000.0)
tmp = x / (y + 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[y, 2400000.0], N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2400000:\\
\;\;\;\;\frac{x}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 2.4e6Initial program 74.0%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6445.2
Simplified45.2%
Taylor expanded in y around 0
Simplified24.3%
if 2.4e6 < y Initial program 65.5%
Taylor expanded in y around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6473.3
Simplified73.3%
Final simplification36.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x (+ y x)))
assert(x < y);
double code(double x, double y) {
return x / (y + x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
return x / (y + x);
}
[x, y] = sort([x, y]) def code(x, y): return x / (y + x)
x, y = sort([x, y]) function code(x, y) return Float64(x / Float64(y + x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y + x}
\end{array}
Initial program 71.9%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6452.3
Simplified52.3%
Taylor expanded in y around 0
Simplified23.7%
Final simplification23.7%
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 71.9%
Taylor expanded in x around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6435.9
Simplified35.9%
Taylor expanded in y around 0
/-lowering-/.f6423.3
Simplified23.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 0.5 y))
assert(x < y);
double code(double x, double y) {
return 0.5 / 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 = 0.5d0 / y
end function
assert x < y;
public static double code(double x, double y) {
return 0.5 / y;
}
[x, y] = sort([x, y]) def code(x, y): return 0.5 / y
x, y = sort([x, y]) function code(x, y) return Float64(0.5 / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 0.5 / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(0.5 / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{0.5}{y}
\end{array}
Initial program 71.9%
Taylor expanded in y around 0
*-commutativeN/A
associate-*r*N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6445.9
Simplified45.9%
Taylor expanded in y around inf
/-lowering-/.f644.2
Simplified4.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 1.0)
assert(x < y);
double code(double x, double y) {
return 1.0;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
assert x < y;
public static double code(double x, double y) {
return 1.0;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0
x, y = sort([x, y]) function code(x, y) return 1.0 end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := 1.0
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
1
\end{array}
Initial program 71.9%
times-fracN/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6452.3
Simplified52.3%
Taylor expanded in y around 0
Simplified3.3%
(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 2024205
(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))))