\[1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\]
↓
\[\begin{array}{l}
t_0 := \log \left(x - 1\right)\\
t_1 := \log y - -1\\
\mathbf{if}\;y \leq -630000:\\
\;\;\;\;\left(\left(1 + \frac{\frac{x - 1}{1 - x}}{y}\right) - \mathsf{log1p}\left(-x\right)\right) - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+31}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{elif}\;t_1 \ne 0:\\
\;\;\;\;t_1 \cdot \left(1 - \frac{t_0}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(t_0 - \log y\right)\\
\end{array}
\]
(FPCore (x y) :precision binary64 (- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))
↓
(FPCore (x y)
:precision binary64
(let* ((t_0 (log (- x 1.0))) (t_1 (- (log y) -1.0)))
(if (<= y -630000.0)
(-
(- (+ 1.0 (/ (/ (- x 1.0) (- 1.0 x)) y)) (log1p (- x)))
(log (/ -1.0 y)))
(if (<= y 2.7e+31)
(- 1.0 (log1p (/ (- x y) (+ y -1.0))))
(if (!= t_1 0.0)
(* t_1 (- 1.0 (/ t_0 t_1)))
(- 1.0 (- t_0 (log 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 t_0 = log((x - 1.0));
double t_1 = log(y) - -1.0;
double tmp;
if (y <= -630000.0) {
tmp = ((1.0 + (((x - 1.0) / (1.0 - x)) / y)) - log1p(-x)) - log((-1.0 / y));
} else if (y <= 2.7e+31) {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
} else if (t_1 != 0.0) {
tmp = t_1 * (1.0 - (t_0 / t_1));
} else {
tmp = 1.0 - (t_0 - log(y));
}
return tmp;
}
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 t_0 = Math.log((x - 1.0));
double t_1 = Math.log(y) - -1.0;
double tmp;
if (y <= -630000.0) {
tmp = ((1.0 + (((x - 1.0) / (1.0 - x)) / y)) - Math.log1p(-x)) - Math.log((-1.0 / y));
} else if (y <= 2.7e+31) {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
} else if (t_1 != 0.0) {
tmp = t_1 * (1.0 - (t_0 / t_1));
} else {
tmp = 1.0 - (t_0 - Math.log(y));
}
return tmp;
}
def code(x, y):
return 1.0 - math.log((1.0 - ((x - y) / (1.0 - y))))
↓
def code(x, y):
t_0 = math.log((x - 1.0))
t_1 = math.log(y) - -1.0
tmp = 0
if y <= -630000.0:
tmp = ((1.0 + (((x - 1.0) / (1.0 - x)) / y)) - math.log1p(-x)) - math.log((-1.0 / y))
elif y <= 2.7e+31:
tmp = 1.0 - math.log1p(((x - y) / (y + -1.0)))
elif t_1 != 0.0:
tmp = t_1 * (1.0 - (t_0 / t_1))
else:
tmp = 1.0 - (t_0 - math.log(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)
t_0 = log(Float64(x - 1.0))
t_1 = Float64(log(y) - -1.0)
tmp = 0.0
if (y <= -630000.0)
tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(x - 1.0) / Float64(1.0 - x)) / y)) - log1p(Float64(-x))) - log(Float64(-1.0 / y)));
elseif (y <= 2.7e+31)
tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0))));
elseif (t_1 != 0.0)
tmp = Float64(t_1 * Float64(1.0 - Float64(t_0 / t_1)));
else
tmp = Float64(1.0 - Float64(t_0 - log(y)));
end
return 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_] := Block[{t$95$0 = N[Log[N[(x - 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[y, -630000.0], N[(N[(N[(1.0 + N[(N[(N[(x - 1.0), $MachinePrecision] / N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.7e+31], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Unequal[t$95$1, 0.0], N[(t$95$1 * N[(1.0 - N[(t$95$0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(t$95$0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
↓
\begin{array}{l}
t_0 := \log \left(x - 1\right)\\
t_1 := \log y - -1\\
\mathbf{if}\;y \leq -630000:\\
\;\;\;\;\left(\left(1 + \frac{\frac{x - 1}{1 - x}}{y}\right) - \mathsf{log1p}\left(-x\right)\right) - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+31}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{elif}\;t_1 \ne 0:\\
\;\;\;\;t_1 \cdot \left(1 - \frac{t_0}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(t_0 - \log y\right)\\
\end{array}