| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6976 |
\[0.5 \cdot \mathsf{log1p}\left(\frac{2 \cdot x}{1 - x}\right)
\]
(FPCore (x) :precision binary64 (* 0.5 (log1p (/ (* 2.0 x) (- 1.0 x)))))
(FPCore (x) :precision binary64 (* 0.5 (+ (* 2.0 x) (* 0.6666666666666666 (pow x 3.0)))))
double code(double x) {
return 0.5 * log1p(((2.0 * x) / (1.0 - x)));
}
double code(double x) {
return 0.5 * ((2.0 * x) + (0.6666666666666666 * pow(x, 3.0)));
}
public static double code(double x) {
return 0.5 * Math.log1p(((2.0 * x) / (1.0 - x)));
}
public static double code(double x) {
return 0.5 * ((2.0 * x) + (0.6666666666666666 * Math.pow(x, 3.0)));
}
def code(x): return 0.5 * math.log1p(((2.0 * x) / (1.0 - x)))
def code(x): return 0.5 * ((2.0 * x) + (0.6666666666666666 * math.pow(x, 3.0)))
function code(x) return Float64(0.5 * log1p(Float64(Float64(2.0 * x) / Float64(1.0 - x)))) end
function code(x) return Float64(0.5 * Float64(Float64(2.0 * x) + Float64(0.6666666666666666 * (x ^ 3.0)))) end
code[x_] := N[(0.5 * N[Log[1 + N[(N[(2.0 * x), $MachinePrecision] / N[(1.0 - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(0.5 * N[(N[(2.0 * x), $MachinePrecision] + N[(0.6666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.5 \cdot \mathsf{log1p}\left(\frac{2 \cdot x}{1 - x}\right)
0.5 \cdot \left(2 \cdot x + 0.6666666666666666 \cdot {x}^{3}\right)
Results
Initial program 100.0%
Taylor expanded in x around 0 100.0%
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6976 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 320 |
herbie shell --seed 2023157
(FPCore (x)
:name "Rust f64::atanh"
:precision binary64
(* 0.5 (log1p (/ (* 2.0 x) (- 1.0 x)))))