\[1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \leq 0.999:\\
\;\;\;\;1 - \log \left(\frac{\left(1 - y\right) - \left(x - y\right)}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x + -1}{y}\right)\\
\end{array}
\]
(FPCore (x y) :precision binary64 (- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))
↓
(FPCore (x y)
:precision binary64
(if (<= (/ (- x y) (- 1.0 y)) 0.999)
(- 1.0 (log (/ (- (- 1.0 y) (- x y)) (- 1.0 y))))
(- 1.0 (log (/ (+ x -1.0) y)))))
double code(double x, double y) {
return 1.0 - log((1.0 - ((x - y) / (1.0 - y))));
}
↓
double code(double x, double y) {
double tmp;
if (((x - y) / (1.0 - y)) <= 0.999) {
tmp = 1.0 - log((((1.0 - y) - (x - y)) / (1.0 - y)));
} else {
tmp = 1.0 - log(((x + -1.0) / y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - log((1.0d0 - ((x - y) / (1.0d0 - y))))
end function
↓
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((x - y) / (1.0d0 - y)) <= 0.999d0) then
tmp = 1.0d0 - log((((1.0d0 - y) - (x - y)) / (1.0d0 - y)))
else
tmp = 1.0d0 - log(((x + (-1.0d0)) / y))
end if
code = tmp
end function
public static double code(double x, double y) {
return 1.0 - Math.log((1.0 - ((x - y) / (1.0 - y))));
}
↓
public static double code(double x, double y) {
double tmp;
if (((x - y) / (1.0 - y)) <= 0.999) {
tmp = 1.0 - Math.log((((1.0 - y) - (x - y)) / (1.0 - y)));
} else {
tmp = 1.0 - Math.log(((x + -1.0) / y));
}
return tmp;
}
def code(x, y):
return 1.0 - math.log((1.0 - ((x - y) / (1.0 - y))))
↓
def code(x, y):
tmp = 0
if ((x - y) / (1.0 - y)) <= 0.999:
tmp = 1.0 - math.log((((1.0 - y) - (x - y)) / (1.0 - y)))
else:
tmp = 1.0 - math.log(((x + -1.0) / y))
return tmp
function code(x, y)
return Float64(1.0 - log(Float64(1.0 - Float64(Float64(x - y) / Float64(1.0 - y)))))
end
↓
function code(x, y)
tmp = 0.0
if (Float64(Float64(x - y) / Float64(1.0 - y)) <= 0.999)
tmp = Float64(1.0 - log(Float64(Float64(Float64(1.0 - y) - Float64(x - y)) / Float64(1.0 - y))));
else
tmp = Float64(1.0 - log(Float64(Float64(x + -1.0) / y)));
end
return tmp
end
function tmp = code(x, y)
tmp = 1.0 - log((1.0 - ((x - y) / (1.0 - y))));
end
↓
function tmp_2 = code(x, y)
tmp = 0.0;
if (((x - y) / (1.0 - y)) <= 0.999)
tmp = 1.0 - log((((1.0 - y) - (x - y)) / (1.0 - y)));
else
tmp = 1.0 - log(((x + -1.0) / y));
end
tmp_2 = tmp;
end
code[x_, y_] := N[(1.0 - N[Log[N[(1.0 - N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_] := If[LessEqual[N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], 0.999], N[(1.0 - N[Log[N[(N[(N[(1.0 - y), $MachinePrecision] - N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
↓
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \leq 0.999:\\
\;\;\;\;1 - \log \left(\frac{\left(1 - y\right) - \left(x - y\right)}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x + -1}{y}\right)\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.1 |
|---|
| Cost | 7492 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \leq 0.999:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x + -1}{y}\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 1.1 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
t_0 := 1 - \log \left(\frac{x + -1}{y}\right)\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.9 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
t_0 := 1 - \log \left(\frac{x + -1}{y}\right)\\
\mathbf{if}\;y \leq -320:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 20000000000000:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y - 1}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 7.2 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+17}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x}{y}\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 6.7 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -12.6:\\
\;\;\;\;1 - \log \left(\frac{1}{1 - y}\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x}{y}\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 13.2 |
|---|
| Cost | 6852 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+17}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 23.9 |
|---|
| Cost | 6656 |
|---|
\[1 - \mathsf{log1p}\left(-x\right)
\]
| Alternative 8 |
|---|
| Error | 36.1 |
|---|
| Cost | 192 |
|---|
\[1 + x
\]
| Alternative 9 |
|---|
| Error | 36.2 |
|---|
| Cost | 64 |
|---|
\[1
\]