
(FPCore (x y) :precision binary64 (/ (exp (* x (log (/ x (+ x y))))) x))
double code(double x, double y) {
return exp((x * log((x / (x + y))))) / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = exp((x * log((x / (x + y))))) / x
end function
public static double code(double x, double y) {
return Math.exp((x * Math.log((x / (x + y))))) / x;
}
def code(x, y): return math.exp((x * math.log((x / (x + y))))) / x
function code(x, y) return Float64(exp(Float64(x * log(Float64(x / Float64(x + y))))) / x) end
function tmp = code(x, y) tmp = exp((x * log((x / (x + y))))) / x; end
code[x_, y_] := N[(N[Exp[N[(x * N[Log[N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (exp (* x (log (/ x (+ x y))))) x))
double code(double x, double y) {
return exp((x * log((x / (x + y))))) / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = exp((x * log((x / (x + y))))) / x
end function
public static double code(double x, double y) {
return Math.exp((x * Math.log((x / (x + y))))) / x;
}
def code(x, y): return math.exp((x * math.log((x / (x + y))))) / x
function code(x, y) return Float64(exp(Float64(x * log(Float64(x / Float64(x + y))))) / x) end
function tmp = code(x, y) tmp = exp((x * log((x / (x + y))))) / x; end
code[x_, y_] := N[(N[Exp[N[(x * N[Log[N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\end{array}
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (exp (- y)) x))) (if (<= x -0.86) t_0 (if (<= x 0.043) (/ 1.0 x) t_0))))
double code(double x, double y) {
double t_0 = exp(-y) / x;
double tmp;
if (x <= -0.86) {
tmp = t_0;
} else if (x <= 0.043) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
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 = exp(-y) / x
if (x <= (-0.86d0)) then
tmp = t_0
else if (x <= 0.043d0) then
tmp = 1.0d0 / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.exp(-y) / x;
double tmp;
if (x <= -0.86) {
tmp = t_0;
} else if (x <= 0.043) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = math.exp(-y) / x tmp = 0 if x <= -0.86: tmp = t_0 elif x <= 0.043: tmp = 1.0 / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(exp(Float64(-y)) / x) tmp = 0.0 if (x <= -0.86) tmp = t_0; elseif (x <= 0.043) tmp = Float64(1.0 / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = exp(-y) / x; tmp = 0.0; if (x <= -0.86) tmp = t_0; elseif (x <= 0.043) tmp = 1.0 / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Exp[(-y)], $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -0.86], t$95$0, If[LessEqual[x, 0.043], N[(1.0 / x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{e^{-y}}{x}\\
\mathbf{if}\;x \leq -0.86:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.043:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -0.859999999999999987 or 0.042999999999999997 < x Initial program 81.9%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
if -0.859999999999999987 < x < 0.042999999999999997Initial program 85.2%
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (/ (+ x (* y (- (* y (* 0.5 (+ 1.0 x))) x))) x) x)))
(if (<= x -1.0)
t_0
(if (<= x 0.041)
(/ 1.0 x)
(if (<= x 1.4e+133) (/ (/ 1.0 (* (+ 1.0 y) (+ 1.0 (* y y)))) x) t_0)))))
double code(double x, double y) {
double t_0 = ((x + (y * ((y * (0.5 * (1.0 + x))) - x))) / x) / x;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 0.041) {
tmp = 1.0 / x;
} else if (x <= 1.4e+133) {
tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x;
} else {
tmp = t_0;
}
return tmp;
}
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 * (0.5d0 * (1.0d0 + x))) - x))) / x) / x
if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= 0.041d0) then
tmp = 1.0d0 / x
else if (x <= 1.4d+133) then
tmp = (1.0d0 / ((1.0d0 + y) * (1.0d0 + (y * y)))) / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((x + (y * ((y * (0.5 * (1.0 + x))) - x))) / x) / x;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 0.041) {
tmp = 1.0 / x;
} else if (x <= 1.4e+133) {
tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = ((x + (y * ((y * (0.5 * (1.0 + x))) - x))) / x) / x tmp = 0 if x <= -1.0: tmp = t_0 elif x <= 0.041: tmp = 1.0 / x elif x <= 1.4e+133: tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(Float64(x + Float64(y * Float64(Float64(y * Float64(0.5 * Float64(1.0 + x))) - x))) / x) / x) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= 0.041) tmp = Float64(1.0 / x); elseif (x <= 1.4e+133) tmp = Float64(Float64(1.0 / Float64(Float64(1.0 + y) * Float64(1.0 + Float64(y * y)))) / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = ((x + (y * ((y * (0.5 * (1.0 + x))) - x))) / x) / x; tmp = 0.0; if (x <= -1.0) tmp = t_0; elseif (x <= 0.041) tmp = 1.0 / x; elseif (x <= 1.4e+133) tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x + N[(y * N[(N[(y * N[(0.5 * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 0.041], N[(1.0 / x), $MachinePrecision], If[LessEqual[x, 1.4e+133], N[(N[(1.0 / N[(N[(1.0 + y), $MachinePrecision] * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{x + y \cdot \left(y \cdot \left(0.5 \cdot \left(1 + x\right)\right) - x\right)}{x}}{x}\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.041:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{1}{\left(1 + y\right) \cdot \left(1 + y \cdot y\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 1.40000000000000008e133 < x Initial program 81.1%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
if -1 < x < 0.0410000000000000017Initial program 85.2%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 0.0410000000000000017 < x < 1.40000000000000008e133Initial program 84.4%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y)
:precision binary64
(let* ((t_0
(/
(+ 1.0 (* y (+ -1.0 (* y (+ 0.5 (* y -0.16666666666666666))))))
x)))
(if (<= x -0.75)
t_0
(if (<= x 8.6e-5)
(/ 1.0 x)
(if (<= x 1.4e+133) (/ (/ 1.0 (* (+ 1.0 y) (+ 1.0 (* y y)))) x) t_0)))))
double code(double x, double y) {
double t_0 = (1.0 + (y * (-1.0 + (y * (0.5 + (y * -0.16666666666666666)))))) / x;
double tmp;
if (x <= -0.75) {
tmp = t_0;
} else if (x <= 8.6e-5) {
tmp = 1.0 / x;
} else if (x <= 1.4e+133) {
tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x;
} else {
tmp = t_0;
}
return tmp;
}
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 = (1.0d0 + (y * ((-1.0d0) + (y * (0.5d0 + (y * (-0.16666666666666666d0))))))) / x
if (x <= (-0.75d0)) then
tmp = t_0
else if (x <= 8.6d-5) then
tmp = 1.0d0 / x
else if (x <= 1.4d+133) then
tmp = (1.0d0 / ((1.0d0 + y) * (1.0d0 + (y * y)))) / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (1.0 + (y * (-1.0 + (y * (0.5 + (y * -0.16666666666666666)))))) / x;
double tmp;
if (x <= -0.75) {
tmp = t_0;
} else if (x <= 8.6e-5) {
tmp = 1.0 / x;
} else if (x <= 1.4e+133) {
tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (1.0 + (y * (-1.0 + (y * (0.5 + (y * -0.16666666666666666)))))) / x tmp = 0 if x <= -0.75: tmp = t_0 elif x <= 8.6e-5: tmp = 1.0 / x elif x <= 1.4e+133: tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(1.0 + Float64(y * Float64(-1.0 + Float64(y * Float64(0.5 + Float64(y * -0.16666666666666666)))))) / x) tmp = 0.0 if (x <= -0.75) tmp = t_0; elseif (x <= 8.6e-5) tmp = Float64(1.0 / x); elseif (x <= 1.4e+133) tmp = Float64(Float64(1.0 / Float64(Float64(1.0 + y) * Float64(1.0 + Float64(y * y)))) / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 + (y * (-1.0 + (y * (0.5 + (y * -0.16666666666666666)))))) / x; tmp = 0.0; if (x <= -0.75) tmp = t_0; elseif (x <= 8.6e-5) tmp = 1.0 / x; elseif (x <= 1.4e+133) tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 + N[(y * N[(-1.0 + N[(y * N[(0.5 + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -0.75], t$95$0, If[LessEqual[x, 8.6e-5], N[(1.0 / x), $MachinePrecision], If[LessEqual[x, 1.4e+133], N[(N[(1.0 / N[(N[(1.0 + y), $MachinePrecision] * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 + y \cdot \left(-1 + y \cdot \left(0.5 + y \cdot -0.16666666666666666\right)\right)}{x}\\
\mathbf{if}\;x \leq -0.75:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{1}{\left(1 + y\right) \cdot \left(1 + y \cdot y\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -0.75 or 1.40000000000000008e133 < x Initial program 81.1%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around 0 0
Simplified0
if -0.75 < x < 8.6000000000000003e-5Initial program 85.2%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 8.6000000000000003e-5 < x < 1.40000000000000008e133Initial program 84.4%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y)
:precision binary64
(if (<= x -0.29)
(+ (/ (- 1.0 y) x) (* y (* (/ y x) (* y -0.16666666666666666))))
(if (<= x 0.043)
(/ 1.0 x)
(if (<= x 1.35e+133)
(/ (/ 1.0 (* (+ 1.0 y) (+ 1.0 (* y y)))) x)
(/ (/ (* x (- 1.0 y)) x) x)))))
double code(double x, double y) {
double tmp;
if (x <= -0.29) {
tmp = ((1.0 - y) / x) + (y * ((y / x) * (y * -0.16666666666666666)));
} else if (x <= 0.043) {
tmp = 1.0 / x;
} else if (x <= 1.35e+133) {
tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x;
} else {
tmp = ((x * (1.0 - y)) / x) / x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.29d0)) then
tmp = ((1.0d0 - y) / x) + (y * ((y / x) * (y * (-0.16666666666666666d0))))
else if (x <= 0.043d0) then
tmp = 1.0d0 / x
else if (x <= 1.35d+133) then
tmp = (1.0d0 / ((1.0d0 + y) * (1.0d0 + (y * y)))) / x
else
tmp = ((x * (1.0d0 - y)) / x) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.29) {
tmp = ((1.0 - y) / x) + (y * ((y / x) * (y * -0.16666666666666666)));
} else if (x <= 0.043) {
tmp = 1.0 / x;
} else if (x <= 1.35e+133) {
tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x;
} else {
tmp = ((x * (1.0 - y)) / x) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.29: tmp = ((1.0 - y) / x) + (y * ((y / x) * (y * -0.16666666666666666))) elif x <= 0.043: tmp = 1.0 / x elif x <= 1.35e+133: tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x else: tmp = ((x * (1.0 - y)) / x) / x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.29) tmp = Float64(Float64(Float64(1.0 - y) / x) + Float64(y * Float64(Float64(y / x) * Float64(y * -0.16666666666666666)))); elseif (x <= 0.043) tmp = Float64(1.0 / x); elseif (x <= 1.35e+133) tmp = Float64(Float64(1.0 / Float64(Float64(1.0 + y) * Float64(1.0 + Float64(y * y)))) / x); else tmp = Float64(Float64(Float64(x * Float64(1.0 - y)) / x) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.29) tmp = ((1.0 - y) / x) + (y * ((y / x) * (y * -0.16666666666666666))); elseif (x <= 0.043) tmp = 1.0 / x; elseif (x <= 1.35e+133) tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x; else tmp = ((x * (1.0 - y)) / x) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.29], N[(N[(N[(1.0 - y), $MachinePrecision] / x), $MachinePrecision] + N[(y * N[(N[(y / x), $MachinePrecision] * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.043], N[(1.0 / x), $MachinePrecision], If[LessEqual[x, 1.35e+133], N[(N[(1.0 / N[(N[(1.0 + y), $MachinePrecision] * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.29:\\
\;\;\;\;\frac{1 - y}{x} + y \cdot \left(\frac{y}{x} \cdot \left(y \cdot -0.16666666666666666\right)\right)\\
\mathbf{elif}\;x \leq 0.043:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{1}{\left(1 + y\right) \cdot \left(1 + y \cdot y\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 - y\right)}{x}}{x}\\
\end{array}
\end{array}
if x < -0.28999999999999998Initial program 81.4%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -0.28999999999999998 < x < 0.042999999999999997Initial program 85.2%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 0.042999999999999997 < x < 1.3500000000000001e133Initial program 84.4%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Taylor expanded in y around 0 0
Simplified0
if 1.3500000000000001e133 < x Initial program 80.6%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Applied egg-rr0
(FPCore (x y)
:precision binary64
(if (<= x -0.72)
(/ (+ 1.0 (* y (+ -1.0 (* y 0.5)))) x)
(if (<= x 1.75e-7)
(/ 1.0 x)
(if (<= x 1.3e+133)
(/ (/ 1.0 (* (+ 1.0 y) (+ 1.0 (* y y)))) x)
(/ (/ (* x (- 1.0 y)) x) x)))))
double code(double x, double y) {
double tmp;
if (x <= -0.72) {
tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x;
} else if (x <= 1.75e-7) {
tmp = 1.0 / x;
} else if (x <= 1.3e+133) {
tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x;
} else {
tmp = ((x * (1.0 - y)) / x) / x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.72d0)) then
tmp = (1.0d0 + (y * ((-1.0d0) + (y * 0.5d0)))) / x
else if (x <= 1.75d-7) then
tmp = 1.0d0 / x
else if (x <= 1.3d+133) then
tmp = (1.0d0 / ((1.0d0 + y) * (1.0d0 + (y * y)))) / x
else
tmp = ((x * (1.0d0 - y)) / x) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.72) {
tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x;
} else if (x <= 1.75e-7) {
tmp = 1.0 / x;
} else if (x <= 1.3e+133) {
tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x;
} else {
tmp = ((x * (1.0 - y)) / x) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.72: tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x elif x <= 1.75e-7: tmp = 1.0 / x elif x <= 1.3e+133: tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x else: tmp = ((x * (1.0 - y)) / x) / x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.72) tmp = Float64(Float64(1.0 + Float64(y * Float64(-1.0 + Float64(y * 0.5)))) / x); elseif (x <= 1.75e-7) tmp = Float64(1.0 / x); elseif (x <= 1.3e+133) tmp = Float64(Float64(1.0 / Float64(Float64(1.0 + y) * Float64(1.0 + Float64(y * y)))) / x); else tmp = Float64(Float64(Float64(x * Float64(1.0 - y)) / x) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.72) tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x; elseif (x <= 1.75e-7) tmp = 1.0 / x; elseif (x <= 1.3e+133) tmp = (1.0 / ((1.0 + y) * (1.0 + (y * y)))) / x; else tmp = ((x * (1.0 - y)) / x) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.72], N[(N[(1.0 + N[(y * N[(-1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 1.75e-7], N[(1.0 / x), $MachinePrecision], If[LessEqual[x, 1.3e+133], N[(N[(1.0 / N[(N[(1.0 + y), $MachinePrecision] * N[(1.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.72:\\
\;\;\;\;\frac{1 + y \cdot \left(-1 + y \cdot 0.5\right)}{x}\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-7}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{1}{\left(1 + y\right) \cdot \left(1 + y \cdot y\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 - y\right)}{x}}{x}\\
\end{array}
\end{array}
if x < -0.71999999999999997Initial program 81.4%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around 0 0
Simplified0
if -0.71999999999999997 < x < 1.74999999999999992e-7Initial program 85.2%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 1.74999999999999992e-7 < x < 1.2999999999999999e133Initial program 84.4%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Taylor expanded in y around 0 0
Simplified0
if 1.2999999999999999e133 < x Initial program 80.6%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Applied egg-rr0
(FPCore (x y)
:precision binary64
(if (<= x -0.034)
(/ (+ 1.0 (* y (+ -1.0 (* y 0.5)))) x)
(if (<= x 0.036)
(/ 1.0 x)
(if (<= x 1.08e+133)
(/ (/ 1.0 (+ 1.0 (* y (+ 1.0 y)))) x)
(/ (/ (* x (- 1.0 y)) x) x)))))
double code(double x, double y) {
double tmp;
if (x <= -0.034) {
tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x;
} else if (x <= 0.036) {
tmp = 1.0 / x;
} else if (x <= 1.08e+133) {
tmp = (1.0 / (1.0 + (y * (1.0 + y)))) / x;
} else {
tmp = ((x * (1.0 - y)) / x) / x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.034d0)) then
tmp = (1.0d0 + (y * ((-1.0d0) + (y * 0.5d0)))) / x
else if (x <= 0.036d0) then
tmp = 1.0d0 / x
else if (x <= 1.08d+133) then
tmp = (1.0d0 / (1.0d0 + (y * (1.0d0 + y)))) / x
else
tmp = ((x * (1.0d0 - y)) / x) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.034) {
tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x;
} else if (x <= 0.036) {
tmp = 1.0 / x;
} else if (x <= 1.08e+133) {
tmp = (1.0 / (1.0 + (y * (1.0 + y)))) / x;
} else {
tmp = ((x * (1.0 - y)) / x) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.034: tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x elif x <= 0.036: tmp = 1.0 / x elif x <= 1.08e+133: tmp = (1.0 / (1.0 + (y * (1.0 + y)))) / x else: tmp = ((x * (1.0 - y)) / x) / x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.034) tmp = Float64(Float64(1.0 + Float64(y * Float64(-1.0 + Float64(y * 0.5)))) / x); elseif (x <= 0.036) tmp = Float64(1.0 / x); elseif (x <= 1.08e+133) tmp = Float64(Float64(1.0 / Float64(1.0 + Float64(y * Float64(1.0 + y)))) / x); else tmp = Float64(Float64(Float64(x * Float64(1.0 - y)) / x) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.034) tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x; elseif (x <= 0.036) tmp = 1.0 / x; elseif (x <= 1.08e+133) tmp = (1.0 / (1.0 + (y * (1.0 + y)))) / x; else tmp = ((x * (1.0 - y)) / x) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.034], N[(N[(1.0 + N[(y * N[(-1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.036], N[(1.0 / x), $MachinePrecision], If[LessEqual[x, 1.08e+133], N[(N[(1.0 / N[(1.0 + N[(y * N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.034:\\
\;\;\;\;\frac{1 + y \cdot \left(-1 + y \cdot 0.5\right)}{x}\\
\mathbf{elif}\;x \leq 0.036:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{1}{1 + y \cdot \left(1 + y\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 - y\right)}{x}}{x}\\
\end{array}
\end{array}
if x < -0.034000000000000002Initial program 81.4%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around 0 0
Simplified0
if -0.034000000000000002 < x < 0.0359999999999999973Initial program 85.2%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 0.0359999999999999973 < x < 1.08e133Initial program 84.4%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Taylor expanded in y around 0 0
Simplified0
if 1.08e133 < x Initial program 80.6%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Applied egg-rr0
(FPCore (x y) :precision binary64 (if (<= y -8.5e+192) (/ (* 0.5 (* y y)) x) (if (<= y 4.5) (/ 1.0 x) (if (<= y 8e+178) (/ x (* x x)) (/ 1.0 x)))))
double code(double x, double y) {
double tmp;
if (y <= -8.5e+192) {
tmp = (0.5 * (y * y)) / x;
} else if (y <= 4.5) {
tmp = 1.0 / x;
} else if (y <= 8e+178) {
tmp = x / (x * x);
} else {
tmp = 1.0 / x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-8.5d+192)) then
tmp = (0.5d0 * (y * y)) / x
else if (y <= 4.5d0) then
tmp = 1.0d0 / x
else if (y <= 8d+178) then
tmp = x / (x * x)
else
tmp = 1.0d0 / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -8.5e+192) {
tmp = (0.5 * (y * y)) / x;
} else if (y <= 4.5) {
tmp = 1.0 / x;
} else if (y <= 8e+178) {
tmp = x / (x * x);
} else {
tmp = 1.0 / x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -8.5e+192: tmp = (0.5 * (y * y)) / x elif y <= 4.5: tmp = 1.0 / x elif y <= 8e+178: tmp = x / (x * x) else: tmp = 1.0 / x return tmp
function code(x, y) tmp = 0.0 if (y <= -8.5e+192) tmp = Float64(Float64(0.5 * Float64(y * y)) / x); elseif (y <= 4.5) tmp = Float64(1.0 / x); elseif (y <= 8e+178) tmp = Float64(x / Float64(x * x)); else tmp = Float64(1.0 / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -8.5e+192) tmp = (0.5 * (y * y)) / x; elseif (y <= 4.5) tmp = 1.0 / x; elseif (y <= 8e+178) tmp = x / (x * x); else tmp = 1.0 / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -8.5e+192], N[(N[(0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 4.5], N[(1.0 / x), $MachinePrecision], If[LessEqual[y, 8e+178], N[(x / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+192}:\\
\;\;\;\;\frac{0.5 \cdot \left(y \cdot y\right)}{x}\\
\mathbf{elif}\;y \leq 4.5:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+178}:\\
\;\;\;\;\frac{x}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x}\\
\end{array}
\end{array}
if y < -8.49999999999999965e192Initial program 72.8%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -8.49999999999999965e192 < y < 4.5 or 8.0000000000000004e178 < y Initial program 87.9%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 4.5 < y < 8.0000000000000004e178Initial program 45.5%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y) :precision binary64 (if (<= x -0.9) (/ (+ 1.0 (* y (+ -1.0 (* y 0.5)))) x) (if (<= x 3e+77) (/ 1.0 x) (/ (/ (* x (- 1.0 y)) x) x))))
double code(double x, double y) {
double tmp;
if (x <= -0.9) {
tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x;
} else if (x <= 3e+77) {
tmp = 1.0 / x;
} else {
tmp = ((x * (1.0 - y)) / x) / x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.9d0)) then
tmp = (1.0d0 + (y * ((-1.0d0) + (y * 0.5d0)))) / x
else if (x <= 3d+77) then
tmp = 1.0d0 / x
else
tmp = ((x * (1.0d0 - y)) / x) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.9) {
tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x;
} else if (x <= 3e+77) {
tmp = 1.0 / x;
} else {
tmp = ((x * (1.0 - y)) / x) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.9: tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x elif x <= 3e+77: tmp = 1.0 / x else: tmp = ((x * (1.0 - y)) / x) / x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.9) tmp = Float64(Float64(1.0 + Float64(y * Float64(-1.0 + Float64(y * 0.5)))) / x); elseif (x <= 3e+77) tmp = Float64(1.0 / x); else tmp = Float64(Float64(Float64(x * Float64(1.0 - y)) / x) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.9) tmp = (1.0 + (y * (-1.0 + (y * 0.5)))) / x; elseif (x <= 3e+77) tmp = 1.0 / x; else tmp = ((x * (1.0 - y)) / x) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.9], N[(N[(1.0 + N[(y * N[(-1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 3e+77], N[(1.0 / x), $MachinePrecision], N[(N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.9:\\
\;\;\;\;\frac{1 + y \cdot \left(-1 + y \cdot 0.5\right)}{x}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+77}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 - y\right)}{x}}{x}\\
\end{array}
\end{array}
if x < -0.900000000000000022Initial program 81.4%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around 0 0
Simplified0
if -0.900000000000000022 < x < 2.9999999999999998e77Initial program 85.5%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 2.9999999999999998e77 < x Initial program 80.8%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Applied egg-rr0
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (/ (* x (- 1.0 y)) x) x))) (if (<= x -0.18) t_0 (if (<= x 2.3e+80) (/ 1.0 x) t_0))))
double code(double x, double y) {
double t_0 = ((x * (1.0 - y)) / x) / x;
double tmp;
if (x <= -0.18) {
tmp = t_0;
} else if (x <= 2.3e+80) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
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 * (1.0d0 - y)) / x) / x
if (x <= (-0.18d0)) then
tmp = t_0
else if (x <= 2.3d+80) then
tmp = 1.0d0 / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((x * (1.0 - y)) / x) / x;
double tmp;
if (x <= -0.18) {
tmp = t_0;
} else if (x <= 2.3e+80) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = ((x * (1.0 - y)) / x) / x tmp = 0 if x <= -0.18: tmp = t_0 elif x <= 2.3e+80: tmp = 1.0 / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(Float64(x * Float64(1.0 - y)) / x) / x) tmp = 0.0 if (x <= -0.18) tmp = t_0; elseif (x <= 2.3e+80) tmp = Float64(1.0 / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = ((x * (1.0 - y)) / x) / x; tmp = 0.0; if (x <= -0.18) tmp = t_0; elseif (x <= 2.3e+80) tmp = 1.0 / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -0.18], t$95$0, If[LessEqual[x, 2.3e+80], N[(1.0 / x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{x \cdot \left(1 - y\right)}{x}}{x}\\
\mathbf{if}\;x \leq -0.18:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+80}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -0.17999999999999999 or 2.30000000000000004e80 < x Initial program 81.2%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Applied egg-rr0
Applied egg-rr0
if -0.17999999999999999 < x < 2.30000000000000004e80Initial program 85.5%
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y) :precision binary64 (/ 1.0 x))
double code(double x, double y) {
return 1.0 / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / x
end function
public static double code(double x, double y) {
return 1.0 / x;
}
def code(x, y): return 1.0 / x
function code(x, y) return Float64(1.0 / x) end
function tmp = code(x, y) tmp = 1.0 / x; end
code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x}
\end{array}
Initial program 83.2%
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (exp (/ -1.0 y)) x)) (t_1 (/ (pow (/ x (+ y x)) x) x)))
(if (< y -3.7311844206647956e+94)
t_0
(if (< y 2.817959242728288e+37)
t_1
(if (< y 2.347387415166998e+178) (log (exp t_1)) t_0)))))
double code(double x, double y) {
double t_0 = exp((-1.0 / y)) / x;
double t_1 = pow((x / (y + x)), x) / x;
double tmp;
if (y < -3.7311844206647956e+94) {
tmp = t_0;
} else if (y < 2.817959242728288e+37) {
tmp = t_1;
} else if (y < 2.347387415166998e+178) {
tmp = log(exp(t_1));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(((-1.0d0) / y)) / x
t_1 = ((x / (y + x)) ** x) / x
if (y < (-3.7311844206647956d+94)) then
tmp = t_0
else if (y < 2.817959242728288d+37) then
tmp = t_1
else if (y < 2.347387415166998d+178) then
tmp = log(exp(t_1))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.exp((-1.0 / y)) / x;
double t_1 = Math.pow((x / (y + x)), x) / x;
double tmp;
if (y < -3.7311844206647956e+94) {
tmp = t_0;
} else if (y < 2.817959242728288e+37) {
tmp = t_1;
} else if (y < 2.347387415166998e+178) {
tmp = Math.log(Math.exp(t_1));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = math.exp((-1.0 / y)) / x t_1 = math.pow((x / (y + x)), x) / x tmp = 0 if y < -3.7311844206647956e+94: tmp = t_0 elif y < 2.817959242728288e+37: tmp = t_1 elif y < 2.347387415166998e+178: tmp = math.log(math.exp(t_1)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(exp(Float64(-1.0 / y)) / x) t_1 = Float64((Float64(x / Float64(y + x)) ^ x) / x) tmp = 0.0 if (y < -3.7311844206647956e+94) tmp = t_0; elseif (y < 2.817959242728288e+37) tmp = t_1; elseif (y < 2.347387415166998e+178) tmp = log(exp(t_1)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = exp((-1.0 / y)) / x; t_1 = ((x / (y + x)) ^ x) / x; tmp = 0.0; if (y < -3.7311844206647956e+94) tmp = t_0; elseif (y < 2.817959242728288e+37) tmp = t_1; elseif (y < 2.347387415166998e+178) tmp = log(exp(t_1)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Exp[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision], x], $MachinePrecision] / x), $MachinePrecision]}, If[Less[y, -3.7311844206647956e+94], t$95$0, If[Less[y, 2.817959242728288e+37], t$95$1, If[Less[y, 2.347387415166998e+178], N[Log[N[Exp[t$95$1], $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{e^{\frac{-1}{y}}}{x}\\
t_1 := \frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\
\mathbf{if}\;y < -3.7311844206647956 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y < 2.817959242728288 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y < 2.347387415166998 \cdot 10^{+178}:\\
\;\;\;\;\log \left(e^{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024110
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, F"
:precision binary64
:alt
(if (< y -3.7311844206647956e+94) (/ (exp (/ -1.0 y)) x) (if (< y 2.817959242728288e+37) (/ (pow (/ x (+ y x)) x) x) (if (< y 2.347387415166998e+178) (log (exp (/ (pow (/ x (+ y x)) x) x))) (/ (exp (/ -1.0 y)) x))))
(/ (exp (* x (log (/ x (+ x y))))) x))