(FPCore (x y z) :precision binary64 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
(FPCore (x y z) :precision binary64 (if (<= y 2.9865184356591876e-19) (+ x (/ 1.0 y)) (+ x (/ (/ -1.0 (exp z)) (- y)))))
double code(double x, double y, double z) {
return x + (exp((y * log((y / (z + y))))) / y);
}
double code(double x, double y, double z) {
double tmp;
if (y <= 2.9865184356591876e-19) {
tmp = x + (1.0 / y);
} else {
tmp = x + ((-1.0 / exp(z)) / -y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (exp((y * log((y / (z + y))))) / y)
end function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.9865184356591876d-19) then
tmp = x + (1.0d0 / y)
else
tmp = x + (((-1.0d0) / exp(z)) / -y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
return x + (Math.exp((y * Math.log((y / (z + y))))) / y);
}
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.9865184356591876e-19) {
tmp = x + (1.0 / y);
} else {
tmp = x + ((-1.0 / Math.exp(z)) / -y);
}
return tmp;
}
def code(x, y, z): return x + (math.exp((y * math.log((y / (z + y))))) / y)
def code(x, y, z): tmp = 0 if y <= 2.9865184356591876e-19: tmp = x + (1.0 / y) else: tmp = x + ((-1.0 / math.exp(z)) / -y) return tmp
function code(x, y, z) return Float64(x + Float64(exp(Float64(y * log(Float64(y / Float64(z + y))))) / y)) end
function code(x, y, z) tmp = 0.0 if (y <= 2.9865184356591876e-19) tmp = Float64(x + Float64(1.0 / y)); else tmp = Float64(x + Float64(Float64(-1.0 / exp(z)) / Float64(-y))); end return tmp end
function tmp = code(x, y, z) tmp = x + (exp((y * log((y / (z + y))))) / y); end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.9865184356591876e-19) tmp = x + (1.0 / y); else tmp = x + ((-1.0 / exp(z)) / -y); end tmp_2 = tmp; end
code[x_, y_, z_] := N[(x + N[(N[Exp[N[(y * N[Log[N[(y / N[(z + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := If[LessEqual[y, 2.9865184356591876e-19], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-1.0 / N[Exp[z], $MachinePrecision]), $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision]]
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\begin{array}{l}
\mathbf{if}\;y \leq 2.9865184356591876 \cdot 10^{-19}:\\
\;\;\;\;x + \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{-1}{e^{z}}}{-y}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 5.8 |
|---|---|
| Target | 1.1 |
| Herbie | 0.9 |
if y < 2.9865184356591876e-19Initial program 7.5
Simplified7.5
Taylor expanded in y around 0 1.0
if 2.9865184356591876e-19 < y Initial program 1.8
Simplified1.8
Taylor expanded in y around inf 0.6
Applied frac-2neg_binary640.6
Simplified0.6
Final simplification0.9
herbie shell --seed 2022129
(FPCore (x y z)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
:precision binary64
:herbie-target
(if (< (/ y (+ z y)) 7.11541576e-315) (+ x (/ (exp (/ -1.0 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y)))
(+ x (/ (exp (* y (log (/ y (+ z y))))) y)))