
(FPCore (x) :precision binary32 (asinh x))
float code(float x) {
return asinhf(x);
}
function code(x) return asinh(x) end
function tmp = code(x) tmp = asinh(x); end
\sinh^{-1} x
Herbie found 2 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary32 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
float code(float x) {
return copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
}
function code(x) return copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) end
function tmp = code(x) tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0)))))); end
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
(FPCore (x) :precision binary32 (copysign (asinh (fabs x)) x))
float code(float x) {
return copysignf(asinhf(fabsf(x)), x);
}
function code(x) return copysign(asinh(abs(x)), x) end
function tmp = code(x) tmp = sign(x) * abs(asinh(abs(x))); end
\mathsf{copysign}\left(\sinh^{-1} \left(\left|x\right|\right), x\right)
Initial program 38.1%
lift-log.f32N/A
lift-+.f32N/A
lift-sqrt.f32N/A
lift-+.f32N/A
lift-*.f32N/A
sqr-abs-revN/A
lift-fabs.f32N/A
lift-fabs.f32N/A
asinh-def-revN/A
lower-asinh.f3299.5%
Applied rewrites99.5%
(FPCore (x) :precision binary32 (copysign (* -1.0 x) x))
float code(float x) {
return copysignf((-1.0f * x), x);
}
function code(x) return copysign(Float32(Float32(-1.0) * x), x) end
function tmp = code(x) tmp = sign(x) * abs((single(-1.0) * x)); end
\mathsf{copysign}\left(-1 \cdot x, x\right)
Initial program 38.1%
Taylor expanded in x around -inf
lower-*.f3229.5%
Applied rewrites29.5%
lift-*.f32N/A
mul-1-negN/A
lower-neg.f3229.5%
Applied rewrites29.5%
lift-+.f32N/A
+-commutativeN/A
add-flipN/A
lower--.f32N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f32N/A
lift-neg.f32N/A
sqr-neg-revN/A
rem-sqrt-square-revN/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
lift-fabs.f32N/A
Applied rewrites29.5%
Taylor expanded in x around 0
lower-*.f3254.8%
Applied rewrites54.8%
herbie shell --seed 2025258
(FPCore (x)
:name "Rust f32::asinh"
:precision binary32
(copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))