
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (* (/ y (+ x (+ y 1.0))) (/ x (+ y x))) (+ y x)))
assert(x < y);
double code(double x, double y) {
return ((y / (x + (y + 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 / (x + (y + 1.0d0))) * (x / (y + x))) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
return ((y / (x + (y + 1.0))) * (x / (y + x))) / (y + x);
}
[x, y] = sort([x, y]) def code(x, y): return ((y / (x + (y + 1.0))) * (x / (y + x))) / (y + x)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(x / Float64(y + x))) / Float64(y + x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((y / (x + (y + 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[(x + N[(y + 1.0), $MachinePrecision]), $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}{x + \left(y + 1\right)} \cdot \frac{x}{y + x}}{y + x}
\end{array}
Initial program 66.8%
*-un-lft-identity66.8%
associate-*l*66.8%
times-frac70.9%
+-commutative70.9%
*-commutative70.9%
+-commutative70.9%
associate-+r+70.9%
+-commutative70.9%
associate-+l+70.9%
Applied egg-rr70.9%
*-commutative70.9%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.9%
*-un-lft-identity99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Final simplification99.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.05e+54)
(* (/ 1.0 (+ y x)) (/ y x))
(if (or (<= x -5.5e+32) (not (<= x -0.185)))
(/ (* (/ x (+ y x)) (/ y (+ y 1.0))) (+ y x))
(/ (/ y (+ y x)) (+ x 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.05e+54) {
tmp = (1.0 / (y + x)) * (y / x);
} else if ((x <= -5.5e+32) || !(x <= -0.185)) {
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
} else {
tmp = (y / (y + x)) / (x + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.05d+54)) then
tmp = (1.0d0 / (y + x)) * (y / x)
else if ((x <= (-5.5d+32)) .or. (.not. (x <= (-0.185d0)))) then
tmp = ((x / (y + x)) * (y / (y + 1.0d0))) / (y + x)
else
tmp = (y / (y + x)) / (x + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.05e+54) {
tmp = (1.0 / (y + x)) * (y / x);
} else if ((x <= -5.5e+32) || !(x <= -0.185)) {
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
} else {
tmp = (y / (y + x)) / (x + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.05e+54: tmp = (1.0 / (y + x)) * (y / x) elif (x <= -5.5e+32) or not (x <= -0.185): tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x) else: tmp = (y / (y + x)) / (x + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.05e+54) tmp = Float64(Float64(1.0 / Float64(y + x)) * Float64(y / x)); elseif ((x <= -5.5e+32) || !(x <= -0.185)) tmp = Float64(Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(y + 1.0))) / Float64(y + x)); else tmp = Float64(Float64(y / Float64(y + x)) / Float64(x + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.05e+54)
tmp = (1.0 / (y + x)) * (y / x);
elseif ((x <= -5.5e+32) || ~((x <= -0.185)))
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
else
tmp = (y / (y + x)) / (x + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.05e+54], N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -5.5e+32], N[Not[LessEqual[x, -0.185]], $MachinePrecision]], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{+54}:\\
\;\;\;\;\frac{1}{y + x} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{+32} \lor \neg \left(x \leq -0.185\right):\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{x + 1}\\
\end{array}
\end{array}
if x < -1.04999999999999993e54Initial program 50.8%
*-un-lft-identity50.8%
associate-*l*50.8%
times-frac60.7%
+-commutative60.7%
*-commutative60.7%
+-commutative60.7%
associate-+r+60.7%
+-commutative60.7%
associate-+l+60.7%
Applied egg-rr60.7%
*-commutative60.7%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 75.5%
if -1.04999999999999993e54 < x < -5.49999999999999984e32 or -0.185 < x Initial program 70.3%
*-un-lft-identity70.3%
associate-*l*70.3%
times-frac72.7%
+-commutative72.7%
*-commutative72.7%
+-commutative72.7%
associate-+r+72.7%
+-commutative72.7%
associate-+l+72.7%
Applied egg-rr72.7%
*-commutative72.7%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.9%
*-un-lft-identity99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 80.9%
+-commutative80.9%
Simplified80.9%
if -5.49999999999999984e32 < x < -0.185Initial program 76.6%
*-un-lft-identity76.6%
associate-*l*76.6%
times-frac98.4%
+-commutative98.4%
*-commutative98.4%
+-commutative98.4%
associate-+r+98.4%
+-commutative98.4%
associate-+l+98.4%
Applied egg-rr98.4%
Taylor expanded in y around 0 52.4%
+-commutative52.4%
Simplified52.4%
associate-*r/52.8%
associate-*l/52.8%
*-un-lft-identity52.8%
+-commutative52.8%
Applied egg-rr52.8%
Final simplification79.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -3.1e+64)
(* (/ 1.0 (+ y x)) (/ y x))
(if (<= x -1.85e-14)
(/ (* y x) (* (* (+ y x) (+ y x)) (+ 1.0 (+ y x))))
(/ (* (/ x (+ y x)) (/ y (+ y 1.0))) (+ y x)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.1e+64) {
tmp = (1.0 / (y + x)) * (y / x);
} else if (x <= -1.85e-14) {
tmp = (y * x) / (((y + x) * (y + x)) * (1.0 + (y + x)));
} else {
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
}
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.1d+64)) then
tmp = (1.0d0 / (y + x)) * (y / x)
else if (x <= (-1.85d-14)) then
tmp = (y * x) / (((y + x) * (y + x)) * (1.0d0 + (y + x)))
else
tmp = ((x / (y + x)) * (y / (y + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.1e+64) {
tmp = (1.0 / (y + x)) * (y / x);
} else if (x <= -1.85e-14) {
tmp = (y * x) / (((y + x) * (y + x)) * (1.0 + (y + x)));
} else {
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.1e+64: tmp = (1.0 / (y + x)) * (y / x) elif x <= -1.85e-14: tmp = (y * x) / (((y + x) * (y + x)) * (1.0 + (y + x))) else: tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.1e+64) tmp = Float64(Float64(1.0 / Float64(y + x)) * Float64(y / x)); elseif (x <= -1.85e-14) tmp = Float64(Float64(y * x) / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(1.0 + Float64(y + x)))); else tmp = Float64(Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(y + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.1e+64)
tmp = (1.0 / (y + x)) * (y / x);
elseif (x <= -1.85e-14)
tmp = (y * x) / (((y + x) * (y + x)) * (1.0 + (y + x)));
else
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
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.1e+64], N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.85e-14], N[(N[(y * x), $MachinePrecision] / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+64}:\\
\;\;\;\;\frac{1}{y + x} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-14}:\\
\;\;\;\;\frac{y \cdot x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(1 + \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -3.0999999999999999e64Initial program 50.8%
*-un-lft-identity50.8%
associate-*l*50.8%
times-frac60.7%
+-commutative60.7%
*-commutative60.7%
+-commutative60.7%
associate-+r+60.7%
+-commutative60.7%
associate-+l+60.7%
Applied egg-rr60.7%
*-commutative60.7%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 75.5%
if -3.0999999999999999e64 < x < -1.85000000000000001e-14Initial program 85.0%
if -1.85000000000000001e-14 < x Initial program 69.5%
*-un-lft-identity69.5%
associate-*l*69.5%
times-frac72.0%
+-commutative72.0%
*-commutative72.0%
+-commutative72.0%
associate-+r+72.0%
+-commutative72.0%
associate-+l+72.0%
Applied egg-rr72.0%
*-commutative72.0%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.9%
*-un-lft-identity99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 80.5%
+-commutative80.5%
Simplified80.5%
Final simplification79.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.6e+64)
(* (/ 1.0 (+ y x)) (/ y x))
(if (<= x -8.8e-45)
(* x (/ (/ y (* (+ y x) (+ y (+ x 1.0)))) (+ y x)))
(/ (* (/ x (+ y x)) (/ y (+ y 1.0))) (+ y x)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.6e+64) {
tmp = (1.0 / (y + x)) * (y / x);
} else if (x <= -8.8e-45) {
tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x));
} else {
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
}
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.6d+64)) then
tmp = (1.0d0 / (y + x)) * (y / x)
else if (x <= (-8.8d-45)) then
tmp = x * ((y / ((y + x) * (y + (x + 1.0d0)))) / (y + x))
else
tmp = ((x / (y + x)) * (y / (y + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.6e+64) {
tmp = (1.0 / (y + x)) * (y / x);
} else if (x <= -8.8e-45) {
tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x));
} else {
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.6e+64: tmp = (1.0 / (y + x)) * (y / x) elif x <= -8.8e-45: tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x)) else: tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.6e+64) tmp = Float64(Float64(1.0 / Float64(y + x)) * Float64(y / x)); elseif (x <= -8.8e-45) tmp = Float64(x * Float64(Float64(y / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))) / Float64(y + x))); else tmp = Float64(Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(y + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.6e+64)
tmp = (1.0 / (y + x)) * (y / x);
elseif (x <= -8.8e-45)
tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x));
else
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
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.6e+64], N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.8e-45], N[(x * N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+64}:\\
\;\;\;\;\frac{1}{y + x} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -8.8 \cdot 10^{-45}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -2.59999999999999997e64Initial program 50.8%
*-un-lft-identity50.8%
associate-*l*50.8%
times-frac60.7%
+-commutative60.7%
*-commutative60.7%
+-commutative60.7%
associate-+r+60.7%
+-commutative60.7%
associate-+l+60.7%
Applied egg-rr60.7%
*-commutative60.7%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 75.5%
if -2.59999999999999997e64 < x < -8.79999999999999974e-45Initial program 85.6%
associate-/l*84.0%
associate-+l+84.0%
Simplified84.0%
*-un-lft-identity84.0%
associate-+r+84.0%
associate-*l*84.0%
times-frac93.1%
+-commutative93.1%
+-commutative93.1%
associate-+r+93.1%
+-commutative93.1%
associate-+l+93.1%
Applied egg-rr93.1%
associate-*l/93.1%
*-lft-identity93.1%
+-commutative93.1%
Simplified93.1%
if -8.79999999999999974e-45 < x Initial program 68.8%
*-un-lft-identity68.8%
associate-*l*68.9%
times-frac71.0%
+-commutative71.0%
*-commutative71.0%
+-commutative71.0%
associate-+r+71.0%
+-commutative71.0%
associate-+l+71.0%
Applied egg-rr71.0%
*-commutative71.0%
times-frac99.6%
+-commutative99.6%
Applied egg-rr99.6%
associate-*l/99.9%
*-un-lft-identity99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 79.8%
+-commutative79.8%
Simplified79.8%
Final simplification80.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -3.1e+64)
(* (/ 1.0 (+ y x)) (/ y x))
(if (<= x -5e-20)
(* x (/ y (* (* (+ y x) (+ y x)) (+ x (+ y 1.0)))))
(/ (* (/ x (+ y x)) (/ y (+ y 1.0))) (+ y x)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.1e+64) {
tmp = (1.0 / (y + x)) * (y / x);
} else if (x <= -5e-20) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
}
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.1d+64)) then
tmp = (1.0d0 / (y + x)) * (y / x)
else if (x <= (-5d-20)) then
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0d0))))
else
tmp = ((x / (y + x)) * (y / (y + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.1e+64) {
tmp = (1.0 / (y + x)) * (y / x);
} else if (x <= -5e-20) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.1e+64: tmp = (1.0 / (y + x)) * (y / x) elif x <= -5e-20: tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0)))) else: tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.1e+64) tmp = Float64(Float64(1.0 / Float64(y + x)) * Float64(y / x)); elseif (x <= -5e-20) tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(y + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.1e+64)
tmp = (1.0 / (y + x)) * (y / x);
elseif (x <= -5e-20)
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
else
tmp = ((x / (y + x)) * (y / (y + 1.0))) / (y + x);
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.1e+64], N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-20], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+64}:\\
\;\;\;\;\frac{1}{y + x} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-20}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -3.0999999999999999e64Initial program 50.8%
*-un-lft-identity50.8%
associate-*l*50.8%
times-frac60.7%
+-commutative60.7%
*-commutative60.7%
+-commutative60.7%
associate-+r+60.7%
+-commutative60.7%
associate-+l+60.7%
Applied egg-rr60.7%
*-commutative60.7%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 75.5%
if -3.0999999999999999e64 < x < -4.9999999999999999e-20Initial program 86.1%
associate-/l*83.6%
associate-+l+83.6%
Simplified83.6%
if -4.9999999999999999e-20 < x Initial program 69.3%
*-un-lft-identity69.3%
associate-*l*69.3%
times-frac71.8%
+-commutative71.8%
*-commutative71.8%
+-commutative71.8%
associate-+r+71.8%
+-commutative71.8%
associate-+l+71.8%
Applied egg-rr71.8%
*-commutative71.8%
times-frac99.6%
+-commutative99.6%
Applied egg-rr99.6%
associate-*l/99.9%
*-un-lft-identity99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 80.4%
+-commutative80.4%
Simplified80.4%
Final simplification79.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 2.5e-85)
(/ (/ y x) (+ x 1.0))
(if (<= y 1.55e+66)
(* (/ 1.0 (+ y x)) (/ x (+ y 1.0)))
(if (<= y 3.4e+141)
(* x (/ (/ 1.0 y) (+ y x)))
(/ (/ x (+ y x)) (+ y x))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.5e-85) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 1.55e+66) {
tmp = (1.0 / (y + x)) * (x / (y + 1.0));
} else if (y <= 3.4e+141) {
tmp = x * ((1.0 / y) / (y + x));
} else {
tmp = (x / (y + x)) / (y + x);
}
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 <= 2.5d-85) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 1.55d+66) then
tmp = (1.0d0 / (y + x)) * (x / (y + 1.0d0))
else if (y <= 3.4d+141) then
tmp = x * ((1.0d0 / y) / (y + x))
else
tmp = (x / (y + x)) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.5e-85) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 1.55e+66) {
tmp = (1.0 / (y + x)) * (x / (y + 1.0));
} else if (y <= 3.4e+141) {
tmp = x * ((1.0 / y) / (y + x));
} else {
tmp = (x / (y + x)) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.5e-85: tmp = (y / x) / (x + 1.0) elif y <= 1.55e+66: tmp = (1.0 / (y + x)) * (x / (y + 1.0)) elif y <= 3.4e+141: tmp = x * ((1.0 / y) / (y + x)) else: tmp = (x / (y + x)) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.5e-85) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 1.55e+66) tmp = Float64(Float64(1.0 / Float64(y + x)) * Float64(x / Float64(y + 1.0))); elseif (y <= 3.4e+141) tmp = Float64(x * Float64(Float64(1.0 / y) / Float64(y + x))); else tmp = Float64(Float64(x / Float64(y + x)) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.5e-85)
tmp = (y / x) / (x + 1.0);
elseif (y <= 1.55e+66)
tmp = (1.0 / (y + x)) * (x / (y + 1.0));
elseif (y <= 3.4e+141)
tmp = x * ((1.0 / y) / (y + x));
else
tmp = (x / (y + x)) / (y + x);
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, 2.5e-85], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e+66], N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e+141], N[(x * N[(N[(1.0 / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{-85}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+66}:\\
\;\;\;\;\frac{1}{y + x} \cdot \frac{x}{y + 1}\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+141}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y + x}\\
\end{array}
\end{array}
if y < 2.5000000000000001e-85Initial program 66.3%
associate-/l*78.6%
associate-+l+78.6%
Simplified78.6%
Taylor expanded in y around 0 55.7%
associate-/r*55.3%
+-commutative55.3%
Simplified55.3%
if 2.5000000000000001e-85 < y < 1.55000000000000009e66Initial program 91.2%
*-un-lft-identity91.2%
associate-*l*91.2%
times-frac94.2%
+-commutative94.2%
*-commutative94.2%
+-commutative94.2%
associate-+r+94.2%
+-commutative94.2%
associate-+l+94.2%
Applied egg-rr94.2%
Taylor expanded in x around 0 47.0%
+-commutative47.0%
Simplified47.0%
if 1.55000000000000009e66 < y < 3.3999999999999998e141Initial program 45.1%
associate-/l*61.2%
associate-+l+61.2%
Simplified61.2%
*-un-lft-identity61.2%
associate-+r+61.2%
associate-*l*61.2%
times-frac86.1%
+-commutative86.1%
+-commutative86.1%
associate-+r+86.1%
+-commutative86.1%
associate-+l+86.1%
Applied egg-rr86.1%
associate-*l/85.9%
*-lft-identity85.9%
+-commutative85.9%
Simplified85.9%
Taylor expanded in y around inf 78.0%
if 3.3999999999999998e141 < y Initial program 58.0%
*-un-lft-identity58.0%
associate-*l*58.0%
times-frac60.1%
+-commutative60.1%
*-commutative60.1%
+-commutative60.1%
associate-+r+60.1%
+-commutative60.1%
associate-+l+60.1%
Applied egg-rr60.1%
*-commutative60.1%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/99.9%
*-un-lft-identity99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 80.9%
Final simplification60.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 2.8e-85)
(/ (/ y x) (+ x 1.0))
(if (<= y 2e+65)
(* (/ 1.0 (+ y x)) (/ x (+ y 1.0)))
(if (<= y 1.76e+158)
(* x (/ (/ 1.0 y) (+ y x)))
(/ 1.0 (/ (+ y x) (/ x y)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.8e-85) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 2e+65) {
tmp = (1.0 / (y + x)) * (x / (y + 1.0));
} else if (y <= 1.76e+158) {
tmp = x * ((1.0 / y) / (y + x));
} else {
tmp = 1.0 / ((y + x) / (x / y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.8d-85) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 2d+65) then
tmp = (1.0d0 / (y + x)) * (x / (y + 1.0d0))
else if (y <= 1.76d+158) then
tmp = x * ((1.0d0 / y) / (y + x))
else
tmp = 1.0d0 / ((y + x) / (x / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.8e-85) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 2e+65) {
tmp = (1.0 / (y + x)) * (x / (y + 1.0));
} else if (y <= 1.76e+158) {
tmp = x * ((1.0 / y) / (y + x));
} else {
tmp = 1.0 / ((y + x) / (x / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.8e-85: tmp = (y / x) / (x + 1.0) elif y <= 2e+65: tmp = (1.0 / (y + x)) * (x / (y + 1.0)) elif y <= 1.76e+158: tmp = x * ((1.0 / y) / (y + x)) else: tmp = 1.0 / ((y + x) / (x / y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.8e-85) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 2e+65) tmp = Float64(Float64(1.0 / Float64(y + x)) * Float64(x / Float64(y + 1.0))); elseif (y <= 1.76e+158) tmp = Float64(x * Float64(Float64(1.0 / y) / Float64(y + x))); else tmp = Float64(1.0 / Float64(Float64(y + x) / Float64(x / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.8e-85)
tmp = (y / x) / (x + 1.0);
elseif (y <= 2e+65)
tmp = (1.0 / (y + x)) * (x / (y + 1.0));
elseif (y <= 1.76e+158)
tmp = x * ((1.0 / y) / (y + x));
else
tmp = 1.0 / ((y + x) / (x / y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.8e-85], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+65], N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.76e+158], N[(x * N[(N[(1.0 / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(y + x), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.8 \cdot 10^{-85}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+65}:\\
\;\;\;\;\frac{1}{y + x} \cdot \frac{x}{y + 1}\\
\mathbf{elif}\;y \leq 1.76 \cdot 10^{+158}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y + x}{\frac{x}{y}}}\\
\end{array}
\end{array}
if y < 2.80000000000000017e-85Initial program 66.3%
associate-/l*78.6%
associate-+l+78.6%
Simplified78.6%
Taylor expanded in y around 0 55.7%
associate-/r*55.3%
+-commutative55.3%
Simplified55.3%
if 2.80000000000000017e-85 < y < 2e65Initial program 91.2%
*-un-lft-identity91.2%
associate-*l*91.2%
times-frac94.2%
+-commutative94.2%
*-commutative94.2%
+-commutative94.2%
associate-+r+94.2%
+-commutative94.2%
associate-+l+94.2%
Applied egg-rr94.2%
Taylor expanded in x around 0 47.0%
+-commutative47.0%
Simplified47.0%
if 2e65 < y < 1.7600000000000001e158Initial program 47.1%
associate-/l*61.5%
associate-+l+61.5%
Simplified61.5%
*-un-lft-identity61.5%
associate-+r+61.5%
associate-*l*61.5%
times-frac79.6%
+-commutative79.6%
+-commutative79.6%
associate-+r+79.6%
+-commutative79.6%
associate-+l+79.6%
Applied egg-rr79.6%
associate-*l/79.6%
*-lft-identity79.6%
+-commutative79.6%
Simplified79.6%
Taylor expanded in y around inf 74.1%
if 1.7600000000000001e158 < y Initial program 60.3%
*-un-lft-identity60.3%
associate-*l*60.3%
times-frac60.3%
+-commutative60.3%
*-commutative60.3%
+-commutative60.3%
associate-+r+60.3%
+-commutative60.3%
associate-+l+60.3%
Applied egg-rr60.3%
*-commutative60.3%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 86.5%
associate-*l/86.6%
*-un-lft-identity86.6%
clear-num86.6%
Applied egg-rr86.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 2.8e-85)
(/ (/ y x) (+ x 1.0))
(if (<= y 4.9e+38)
(/ (/ x (+ y 1.0)) y)
(if (<= y 1.62e+159)
(* x (/ (/ 1.0 y) (+ y x)))
(/ 1.0 (/ (+ y x) (/ x y)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.8e-85) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 4.9e+38) {
tmp = (x / (y + 1.0)) / y;
} else if (y <= 1.62e+159) {
tmp = x * ((1.0 / y) / (y + x));
} else {
tmp = 1.0 / ((y + x) / (x / y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.8d-85) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 4.9d+38) then
tmp = (x / (y + 1.0d0)) / y
else if (y <= 1.62d+159) then
tmp = x * ((1.0d0 / y) / (y + x))
else
tmp = 1.0d0 / ((y + x) / (x / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.8e-85) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 4.9e+38) {
tmp = (x / (y + 1.0)) / y;
} else if (y <= 1.62e+159) {
tmp = x * ((1.0 / y) / (y + x));
} else {
tmp = 1.0 / ((y + x) / (x / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.8e-85: tmp = (y / x) / (x + 1.0) elif y <= 4.9e+38: tmp = (x / (y + 1.0)) / y elif y <= 1.62e+159: tmp = x * ((1.0 / y) / (y + x)) else: tmp = 1.0 / ((y + x) / (x / y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.8e-85) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 4.9e+38) tmp = Float64(Float64(x / Float64(y + 1.0)) / y); elseif (y <= 1.62e+159) tmp = Float64(x * Float64(Float64(1.0 / y) / Float64(y + x))); else tmp = Float64(1.0 / Float64(Float64(y + x) / Float64(x / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.8e-85)
tmp = (y / x) / (x + 1.0);
elseif (y <= 4.9e+38)
tmp = (x / (y + 1.0)) / y;
elseif (y <= 1.62e+159)
tmp = x * ((1.0 / y) / (y + x));
else
tmp = 1.0 / ((y + x) / (x / y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.8e-85], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e+38], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 1.62e+159], N[(x * N[(N[(1.0 / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(y + x), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.8 \cdot 10^{-85}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+38}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\mathbf{elif}\;y \leq 1.62 \cdot 10^{+159}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y + x}{\frac{x}{y}}}\\
\end{array}
\end{array}
if y < 2.80000000000000017e-85Initial program 66.3%
associate-/l*78.6%
associate-+l+78.6%
Simplified78.6%
Taylor expanded in y around 0 55.7%
associate-/r*55.3%
+-commutative55.3%
Simplified55.3%
if 2.80000000000000017e-85 < y < 4.90000000000000002e38Initial program 93.6%
associate-/l*99.2%
associate-+l+99.2%
Simplified99.2%
Taylor expanded in x around 0 44.5%
+-commutative44.5%
Simplified44.5%
*-un-lft-identity44.5%
times-frac44.3%
Applied egg-rr44.3%
associate-*l/44.5%
*-lft-identity44.5%
Simplified44.5%
if 4.90000000000000002e38 < y < 1.62e159Initial program 49.7%
associate-/l*62.3%
associate-+l+62.3%
Simplified62.3%
*-un-lft-identity62.3%
associate-+r+62.3%
associate-*l*62.3%
times-frac78.3%
+-commutative78.3%
+-commutative78.3%
associate-+r+78.3%
+-commutative78.3%
associate-+l+78.3%
Applied egg-rr78.3%
associate-*l/78.3%
*-lft-identity78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in y around inf 73.4%
if 1.62e159 < y Initial program 60.3%
*-un-lft-identity60.3%
associate-*l*60.3%
times-frac60.3%
+-commutative60.3%
*-commutative60.3%
+-commutative60.3%
associate-+r+60.3%
+-commutative60.3%
associate-+l+60.3%
Applied egg-rr60.3%
*-commutative60.3%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 86.5%
associate-*l/86.6%
*-un-lft-identity86.6%
clear-num86.6%
Applied egg-rr86.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.36e-85)
(/ (/ y x) (+ x 1.0))
(if (<= y 4.9e+38)
(/ (/ x (+ y 1.0)) y)
(if (<= y 3.5e+134) (* x (/ (/ 1.0 y) (+ y x))) (/ (/ x (+ y x)) y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.36e-85) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 4.9e+38) {
tmp = (x / (y + 1.0)) / y;
} else if (y <= 3.5e+134) {
tmp = x * ((1.0 / y) / (y + x));
} else {
tmp = (x / (y + x)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.36d-85) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 4.9d+38) then
tmp = (x / (y + 1.0d0)) / y
else if (y <= 3.5d+134) then
tmp = x * ((1.0d0 / y) / (y + x))
else
tmp = (x / (y + x)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.36e-85) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 4.9e+38) {
tmp = (x / (y + 1.0)) / y;
} else if (y <= 3.5e+134) {
tmp = x * ((1.0 / y) / (y + x));
} else {
tmp = (x / (y + x)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.36e-85: tmp = (y / x) / (x + 1.0) elif y <= 4.9e+38: tmp = (x / (y + 1.0)) / y elif y <= 3.5e+134: tmp = x * ((1.0 / y) / (y + x)) else: tmp = (x / (y + x)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.36e-85) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 4.9e+38) tmp = Float64(Float64(x / Float64(y + 1.0)) / y); elseif (y <= 3.5e+134) tmp = Float64(x * Float64(Float64(1.0 / y) / Float64(y + x))); else tmp = Float64(Float64(x / Float64(y + x)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.36e-85)
tmp = (y / x) / (x + 1.0);
elseif (y <= 4.9e+38)
tmp = (x / (y + 1.0)) / y;
elseif (y <= 3.5e+134)
tmp = x * ((1.0 / y) / (y + x));
else
tmp = (x / (y + x)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.36e-85], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e+38], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 3.5e+134], N[(x * N[(N[(1.0 / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.36 \cdot 10^{-85}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+38}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+134}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y}\\
\end{array}
\end{array}
if y < 1.36e-85Initial program 66.3%
associate-/l*78.6%
associate-+l+78.6%
Simplified78.6%
Taylor expanded in y around 0 55.7%
associate-/r*55.3%
+-commutative55.3%
Simplified55.3%
if 1.36e-85 < y < 4.90000000000000002e38Initial program 93.6%
associate-/l*99.2%
associate-+l+99.2%
Simplified99.2%
Taylor expanded in x around 0 44.5%
+-commutative44.5%
Simplified44.5%
*-un-lft-identity44.5%
times-frac44.3%
Applied egg-rr44.3%
associate-*l/44.5%
*-lft-identity44.5%
Simplified44.5%
if 4.90000000000000002e38 < y < 3.50000000000000003e134Initial program 46.3%
associate-/l*60.1%
associate-+l+60.1%
Simplified60.1%
*-un-lft-identity60.1%
associate-+r+60.1%
associate-*l*60.1%
times-frac81.6%
+-commutative81.6%
+-commutative81.6%
associate-+r+81.6%
+-commutative81.6%
associate-+l+81.6%
Applied egg-rr81.6%
associate-*l/81.5%
*-lft-identity81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in y around inf 74.5%
if 3.50000000000000003e134 < y Initial program 58.9%
*-un-lft-identity58.9%
associate-*l*58.9%
times-frac60.9%
+-commutative60.9%
*-commutative60.9%
+-commutative60.9%
associate-+r+60.9%
+-commutative60.9%
associate-+l+60.9%
Applied egg-rr60.9%
*-commutative60.9%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 80.9%
*-commutative80.9%
associate-*l/80.9%
div-inv80.9%
Applied egg-rr80.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.02e-85) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.02e-85) {
tmp = (y / x) / (x + 1.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) :: tmp
if (y <= 2.02d-85) then
tmp = (y / x) / (x + 1.0d0)
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 (y <= 2.02e-85) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.02e-85: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.02e-85) tmp = Float64(Float64(y / x) / Float64(x + 1.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)
tmp = 0.0;
if (y <= 2.02e-85)
tmp = (y / x) / (x + 1.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_] := If[LessEqual[y, 2.02e-85], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $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}\;y \leq 2.02 \cdot 10^{-85}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 2.02000000000000013e-85Initial program 66.3%
associate-/l*78.6%
associate-+l+78.6%
Simplified78.6%
Taylor expanded in y around 0 55.7%
associate-/r*55.3%
+-commutative55.3%
Simplified55.3%
if 2.02000000000000013e-85 < y Initial program 67.7%
associate-/l*82.1%
associate-+l+82.1%
Simplified82.1%
Taylor expanded in x around 0 65.6%
+-commutative65.6%
Simplified65.6%
*-un-lft-identity65.6%
times-frac65.9%
Applied egg-rr65.9%
associate-*l/65.9%
*-lft-identity65.9%
Simplified65.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.36e-85) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.36e-85) {
tmp = y / (x * (x + 1.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) :: tmp
if (y <= 1.36d-85) then
tmp = y / (x * (x + 1.0d0))
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 (y <= 1.36e-85) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.36e-85: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.36e-85) tmp = Float64(y / Float64(x * Float64(x + 1.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)
tmp = 0.0;
if (y <= 1.36e-85)
tmp = y / (x * (x + 1.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_] := If[LessEqual[y, 1.36e-85], N[(y / N[(x * N[(x + 1.0), $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}\;y \leq 1.36 \cdot 10^{-85}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 1.36e-85Initial program 66.3%
associate-/l*78.6%
associate-+l+78.6%
Simplified78.6%
Taylor expanded in y around 0 55.7%
if 1.36e-85 < y Initial program 67.7%
associate-/l*82.1%
associate-+l+82.1%
Simplified82.1%
Taylor expanded in x around 0 65.6%
+-commutative65.6%
Simplified65.6%
*-un-lft-identity65.6%
times-frac65.9%
Applied egg-rr65.9%
associate-*l/65.9%
*-lft-identity65.9%
Simplified65.9%
Final simplification59.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.5e-85) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.5e-85) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.5d-85) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.5e-85) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.5e-85: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.5e-85) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.5e-85)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.5e-85], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{-85}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 2.5000000000000001e-85Initial program 66.3%
associate-/l*78.6%
associate-+l+78.6%
Simplified78.6%
Taylor expanded in y around 0 55.7%
if 2.5000000000000001e-85 < y Initial program 67.7%
associate-/l*82.1%
associate-+l+82.1%
Simplified82.1%
Taylor expanded in x around 0 65.6%
+-commutative65.6%
Simplified65.6%
add-sqr-sqrt31.1%
*-commutative31.1%
times-frac29.9%
Applied egg-rr29.9%
associate-*l/29.9%
associate-*r/29.9%
add-sqr-sqrt65.9%
+-commutative65.9%
Applied egg-rr65.9%
Final simplification59.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4.7e-86) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.7e-86) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 4.7d-86) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.7e-86) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.7e-86: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.7e-86) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4.7e-86)
tmp = y / (x * (x + 1.0));
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 4.7e-86], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.7 \cdot 10^{-86}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 4.7000000000000001e-86Initial program 66.3%
associate-/l*78.6%
associate-+l+78.6%
Simplified78.6%
Taylor expanded in y around 0 55.7%
if 4.7000000000000001e-86 < y Initial program 67.7%
associate-/l*82.1%
associate-+l+82.1%
Simplified82.1%
Taylor expanded in x around 0 65.6%
+-commutative65.6%
Simplified65.6%
Final simplification59.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4.8e-135) (/ y x) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.8e-135) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 4.8d-135) then
tmp = y / x
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.8e-135) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.8e-135: tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.8e-135) tmp = Float64(y / x); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4.8e-135)
tmp = y / x;
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 4.8e-135], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-135}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 4.7999999999999997e-135Initial program 65.4%
associate-/l*77.4%
associate-+l+77.4%
Simplified77.4%
Taylor expanded in y around 0 54.1%
associate-/r*53.7%
+-commutative53.7%
Simplified53.7%
Taylor expanded in x around 0 34.4%
if 4.7999999999999997e-135 < y Initial program 69.0%
associate-/l*83.6%
associate-+l+83.6%
Simplified83.6%
Taylor expanded in x around 0 61.1%
+-commutative61.1%
Simplified61.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4.5e-135) (/ y x) (* x (/ 1.0 (+ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.5e-135) {
tmp = y / x;
} else {
tmp = x * (1.0 / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 4.5d-135) then
tmp = y / x
else
tmp = x * (1.0d0 / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.5e-135) {
tmp = y / x;
} else {
tmp = x * (1.0 / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.5e-135: tmp = y / x else: tmp = x * (1.0 / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.5e-135) tmp = Float64(y / x); else tmp = Float64(x * Float64(1.0 / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4.5e-135)
tmp = y / x;
else
tmp = x * (1.0 / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 4.5e-135], N[(y / x), $MachinePrecision], N[(x * N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{-135}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{y + x}\\
\end{array}
\end{array}
if y < 4.49999999999999987e-135Initial program 65.4%
associate-/l*77.4%
associate-+l+77.4%
Simplified77.4%
Taylor expanded in y around 0 54.1%
associate-/r*53.7%
+-commutative53.7%
Simplified53.7%
Taylor expanded in x around 0 34.4%
if 4.49999999999999987e-135 < y Initial program 69.0%
*-un-lft-identity69.0%
associate-*l*69.0%
times-frac74.1%
+-commutative74.1%
*-commutative74.1%
+-commutative74.1%
associate-+r+74.1%
+-commutative74.1%
associate-+l+74.1%
Applied egg-rr74.1%
Taylor expanded in x around 0 61.9%
+-commutative61.9%
Simplified61.9%
Taylor expanded in y around 0 36.2%
Final simplification35.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4.4e-135) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.4e-135) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 4.4d-135) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.4e-135) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.4e-135: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.4e-135) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4.4e-135)
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 4.4e-135], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.4 \cdot 10^{-135}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < 4.3999999999999999e-135Initial program 65.4%
associate-/l*77.4%
associate-+l+77.4%
Simplified77.4%
Taylor expanded in y around 0 54.1%
associate-/r*53.7%
+-commutative53.7%
Simplified53.7%
Taylor expanded in x around 0 34.4%
if 4.3999999999999999e-135 < y Initial program 69.0%
associate-/l*83.6%
associate-+l+83.6%
Simplified83.6%
Taylor expanded in x around 0 61.1%
+-commutative61.1%
Simplified61.1%
Taylor expanded in y around 0 35.9%
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 66.8%
associate-/l*79.8%
associate-+l+79.8%
Simplified79.8%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
Simplified51.9%
Taylor expanded in y around 0 30.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 y))
assert(x < y);
double code(double x, double y) {
return 1.0 / 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 = 1.0d0 / y
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / y;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / y
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{y}
\end{array}
Initial program 66.8%
*-un-lft-identity66.8%
associate-*l*66.8%
times-frac70.9%
+-commutative70.9%
*-commutative70.9%
+-commutative70.9%
associate-+r+70.9%
+-commutative70.9%
associate-+l+70.9%
Applied egg-rr70.9%
*-commutative70.9%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 38.6%
Taylor expanded in y around 0 4.1%
(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 2024103
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))