
(FPCore (x) :precision binary32 (atanh x))
float code(float x) {
return atanhf(x);
}
function code(x) return atanh(x) end
function tmp = code(x) tmp = atanh(x); end
\begin{array}{l}
\\
\tanh^{-1} x
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 1 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary32 (* 0.5 (log1p (/ (* 2.0 x) (- 1.0 x)))))
float code(float x) {
return 0.5f * log1pf(((2.0f * x) / (1.0f - x)));
}
function code(x) return Float32(Float32(0.5) * log1p(Float32(Float32(Float32(2.0) * x) / Float32(Float32(1.0) - x)))) end
\begin{array}{l}
\\
0.5 \cdot \mathsf{log1p}\left(\frac{2 \cdot x}{1 - x}\right)
\end{array}
(FPCore (x) :precision binary32 (* 1.0 x))
float code(float x) {
return 1.0f * x;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 1.0e0 * x
end function
function code(x) return Float32(Float32(1.0) * x) end
function tmp = code(x) tmp = single(1.0) * x; end
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 86.2%
Applied rewrites28.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f3293.0
Applied rewrites93.0%
Taylor expanded in x around 0
Applied rewrites96.6%
herbie shell --seed 2024329
(FPCore (x)
:name "Rust f32::atanh"
:precision binary32
(* 0.5 (log1p (/ (* 2.0 x) (- 1.0 x)))))