
(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
\begin{array}{l}
\\
\sinh^{-1} x
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 16 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
\begin{array}{l}
\\
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\end{array}
(FPCore (x)
:precision binary32
(let* ((t_0 (+ (fabs x) 1.0))
(t_1 (pow t_0 2.0))
(t_2 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_2 -5.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= t_2 0.10000000149011612)
(copysign
(+
(fma
-0.041666666666666664
(* (pow x 4.0) (+ (/ 3.0 t_0) (/ 3.0 t_1)))
(*
(+ (/ 30.0 (pow t_0 3.0)) (+ (/ 45.0 t_1) (/ 45.0 t_0)))
(* 0.001388888888888889 (pow x 6.0))))
(fma 0.5 (/ (pow x 2.0) t_0) (log1p (fabs x))))
x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
float t_0 = fabsf(x) + 1.0f;
float t_1 = powf(t_0, 2.0f);
float t_2 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float tmp;
if (t_2 <= -5.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (t_2 <= 0.10000000149011612f) {
tmp = copysignf((fmaf(-0.041666666666666664f, (powf(x, 4.0f) * ((3.0f / t_0) + (3.0f / t_1))), (((30.0f / powf(t_0, 3.0f)) + ((45.0f / t_1) + (45.0f / t_0))) * (0.001388888888888889f * powf(x, 6.0f)))) + fmaf(0.5f, (powf(x, 2.0f) / t_0), log1pf(fabsf(x)))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) t_0 = Float32(abs(x) + Float32(1.0)) t_1 = t_0 ^ Float32(2.0) t_2 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) tmp = Float32(0.0) if (t_2 <= Float32(-5.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (t_2 <= Float32(0.10000000149011612)) tmp = copysign(Float32(fma(Float32(-0.041666666666666664), Float32((x ^ Float32(4.0)) * Float32(Float32(Float32(3.0) / t_0) + Float32(Float32(3.0) / t_1))), Float32(Float32(Float32(Float32(30.0) / (t_0 ^ Float32(3.0))) + Float32(Float32(Float32(45.0) / t_1) + Float32(Float32(45.0) / t_0))) * Float32(Float32(0.001388888888888889) * (x ^ Float32(6.0))))) + fma(Float32(0.5), Float32((x ^ Float32(2.0)) / t_0), log1p(abs(x)))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|x\right| + 1\\
t_1 := {t_0}^{2}\\
t_2 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_2 \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;t_2 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{t_0} + \frac{3}{t_1}\right), \left(\frac{30}{{t_0}^{3}} + \left(\frac{45}{t_1} + \frac{45}{t_0}\right)\right) \cdot \left(0.001388888888888889 \cdot {x}^{6}\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{t_0}, \mathsf{log1p}\left(\left|x\right|\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -5Initial program 50.3%
Taylor expanded in x around -inf 98.5%
sub-neg98.5%
neg-mul-198.5%
unsub-neg98.5%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt99.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001Initial program 23.4%
Taylor expanded in x around 0 23.8%
+-commutative23.8%
associate-+r+23.8%
Simplified99.5%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 46.4%
*-un-lft-identity46.4%
*-commutative46.4%
log-prod46.4%
+-commutative46.4%
hypot-1-def99.8%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.8%
metadata-eval99.8%
Applied egg-rr99.8%
+-rgt-identity99.8%
Simplified99.8%
Final simplification99.6%
(FPCore (x)
:precision binary32
(let* ((t_0 (pow (+ x 1.0) 2.0))
(t_1 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_1 -5.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= t_1 0.10000000149011612)
(copysign
(+
(fma
-0.041666666666666664
(* (pow x 4.0) (+ (/ 3.0 (+ x 1.0)) (/ 3.0 t_0)))
(*
(* 0.001388888888888889 (pow x 6.0))
(+
(/ 30.0 (pow (+ x 1.0) 3.0))
(+ (/ 45.0 t_0) (/ 45.0 (+ x 1.0))))))
(fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x)))
x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
float t_0 = powf((x + 1.0f), 2.0f);
float t_1 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float tmp;
if (t_1 <= -5.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (t_1 <= 0.10000000149011612f) {
tmp = copysignf((fmaf(-0.041666666666666664f, (powf(x, 4.0f) * ((3.0f / (x + 1.0f)) + (3.0f / t_0))), ((0.001388888888888889f * powf(x, 6.0f)) * ((30.0f / powf((x + 1.0f), 3.0f)) + ((45.0f / t_0) + (45.0f / (x + 1.0f)))))) + fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) t_0 = Float32(x + Float32(1.0)) ^ Float32(2.0) t_1 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) tmp = Float32(0.0) if (t_1 <= Float32(-5.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (t_1 <= Float32(0.10000000149011612)) tmp = copysign(Float32(fma(Float32(-0.041666666666666664), Float32((x ^ Float32(4.0)) * Float32(Float32(Float32(3.0) / Float32(x + Float32(1.0))) + Float32(Float32(3.0) / t_0))), Float32(Float32(Float32(0.001388888888888889) * (x ^ Float32(6.0))) * Float32(Float32(Float32(30.0) / (Float32(x + Float32(1.0)) ^ Float32(3.0))) + Float32(Float32(Float32(45.0) / t_0) + Float32(Float32(45.0) / Float32(x + Float32(1.0))))))) + fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + 1\right)}^{2}\\
t_1 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_1 \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;t_1 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{x + 1} + \frac{3}{t_0}\right), \left(0.001388888888888889 \cdot {x}^{6}\right) \cdot \left(\frac{30}{{\left(x + 1\right)}^{3}} + \left(\frac{45}{t_0} + \frac{45}{x + 1}\right)\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -5Initial program 50.3%
Taylor expanded in x around -inf 98.5%
sub-neg98.5%
neg-mul-198.5%
unsub-neg98.5%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt99.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001Initial program 23.4%
Taylor expanded in x around 0 23.8%
Simplified99.4%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 46.4%
*-un-lft-identity46.4%
*-commutative46.4%
log-prod46.4%
+-commutative46.4%
hypot-1-def99.8%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.8%
metadata-eval99.8%
Applied egg-rr99.8%
+-rgt-identity99.8%
Simplified99.8%
Final simplification99.6%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
(t_1 (+ (fabs x) 1.0)))
(if (<= t_0 -0.10000000149011612)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)
(if (<= t_0 0.10000000149011612)
(copysign
(+
(fma 0.5 (/ (pow x 2.0) t_1) (log1p (fabs x)))
(*
(+ (/ 3.0 t_1) (/ 3.0 (pow t_1 2.0)))
(* -0.041666666666666664 (pow x 4.0))))
x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float t_1 = fabsf(x) + 1.0f;
float tmp;
if (t_0 <= -0.10000000149011612f) {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
} else if (t_0 <= 0.10000000149011612f) {
tmp = copysignf((fmaf(0.5f, (powf(x, 2.0f) / t_1), log1pf(fabsf(x))) + (((3.0f / t_1) + (3.0f / powf(t_1, 2.0f))) * (-0.041666666666666664f * powf(x, 4.0f)))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) t_1 = Float32(abs(x) + Float32(1.0)) tmp = Float32(0.0) if (t_0 <= Float32(-0.10000000149011612)) tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); elseif (t_0 <= Float32(0.10000000149011612)) tmp = copysign(Float32(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / t_1), log1p(abs(x))) + Float32(Float32(Float32(Float32(3.0) / t_1) + Float32(Float32(3.0) / (t_1 ^ Float32(2.0)))) * Float32(Float32(-0.041666666666666664) * (x ^ Float32(4.0))))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
t_1 := \left|x\right| + 1\\
\mathbf{if}\;t_0 \leq -0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{t_1}, \mathsf{log1p}\left(\left|x\right|\right)\right) + \left(\frac{3}{t_1} + \frac{3}{{t_1}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -0.100000001Initial program 53.0%
+-commutative53.0%
hypot-1-def98.4%
Simplified98.4%
if -0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001Initial program 21.0%
Taylor expanded in x around 0 21.8%
+-commutative21.8%
associate-+r+21.8%
+-commutative21.8%
fma-def21.8%
log1p-def99.9%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 46.4%
*-un-lft-identity46.4%
*-commutative46.4%
log-prod46.4%
+-commutative46.4%
hypot-1-def99.8%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.8%
metadata-eval99.8%
Applied egg-rr99.8%
+-rgt-identity99.8%
Simplified99.8%
Final simplification99.5%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.10000000149011612)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)
(if (<= t_0 0.10000000149011612)
(copysign
(+
(fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x))
(*
(+ (/ 3.0 (+ x 1.0)) (/ 3.0 (pow (+ x 1.0) 2.0)))
(* -0.041666666666666664 (pow x 4.0))))
x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float tmp;
if (t_0 <= -0.10000000149011612f) {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
} else if (t_0 <= 0.10000000149011612f) {
tmp = copysignf((fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x)) + (((3.0f / (x + 1.0f)) + (3.0f / powf((x + 1.0f), 2.0f))) * (-0.041666666666666664f * powf(x, 4.0f)))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) tmp = Float32(0.0) if (t_0 <= Float32(-0.10000000149011612)) tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); elseif (t_0 <= Float32(0.10000000149011612)) tmp = copysign(Float32(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x)) + Float32(Float32(Float32(Float32(3.0) / Float32(x + Float32(1.0))) + Float32(Float32(3.0) / (Float32(x + Float32(1.0)) ^ Float32(2.0)))) * Float32(Float32(-0.041666666666666664) * (x ^ Float32(4.0))))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_0 \leq -0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right) + \left(\frac{3}{x + 1} + \frac{3}{{\left(x + 1\right)}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -0.100000001Initial program 53.0%
+-commutative53.0%
hypot-1-def98.4%
Simplified98.4%
if -0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001Initial program 21.0%
Taylor expanded in x around 0 21.8%
+-commutative21.8%
associate-+r+21.8%
Simplified99.9%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 46.4%
*-un-lft-identity46.4%
*-commutative46.4%
log-prod46.4%
+-commutative46.4%
hypot-1-def99.8%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.8%
metadata-eval99.8%
Applied egg-rr99.8%
+-rgt-identity99.8%
Simplified99.8%
Final simplification99.5%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.019999999552965164)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)
(if (<= t_0 0.009999999776482582)
(copysign (fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x)) x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float tmp;
if (t_0 <= -0.019999999552965164f) {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
} else if (t_0 <= 0.009999999776482582f) {
tmp = copysignf(fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x)), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) tmp = Float32(0.0) if (t_0 <= Float32(-0.019999999552965164)) tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); elseif (t_0 <= Float32(0.009999999776482582)) tmp = copysign(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x)), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_0 \leq -0.019999999552965164:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.009999999776482582:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -0.0199999996Initial program 53.6%
+-commutative53.6%
hypot-1-def98.3%
Simplified98.3%
if -0.0199999996 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.00999999978Initial program 19.8%
Taylor expanded in x around 0 20.6%
+-commutative20.6%
fma-def20.6%
rem-square-sqrt10.9%
fabs-sqr10.9%
rem-square-sqrt20.5%
log1p-def99.5%
rem-square-sqrt46.8%
fabs-sqr46.8%
rem-square-sqrt99.9%
Simplified99.9%
if 0.00999999978 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 46.9%
*-un-lft-identity46.9%
*-commutative46.9%
log-prod46.9%
+-commutative46.9%
hypot-1-def99.7%
add-sqr-sqrt99.7%
fabs-sqr99.7%
add-sqr-sqrt99.7%
metadata-eval99.7%
Applied egg-rr99.7%
+-rgt-identity99.7%
Simplified99.7%
Final simplification99.4%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -5.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= t_0 0.10000000149011612)
(copysign
(*
0.3333333333333333
(+ (* -0.5 (pow x 3.0)) (+ (* 0.225 (pow x 5.0)) (* x 3.0))))
x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float tmp;
if (t_0 <= -5.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (t_0 <= 0.10000000149011612f) {
tmp = copysignf((0.3333333333333333f * ((-0.5f * powf(x, 3.0f)) + ((0.225f * powf(x, 5.0f)) + (x * 3.0f)))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) tmp = Float32(0.0) if (t_0 <= Float32(-5.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (t_0 <= Float32(0.10000000149011612)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(Float32(-0.5) * (x ^ Float32(3.0))) + Float32(Float32(Float32(0.225) * (x ^ Float32(5.0))) + Float32(x * Float32(3.0))))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
function tmp_2 = code(x) t_0 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0)))))); tmp = single(0.0); if (t_0 <= single(-5.0)) tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x)))); elseif (t_0 <= single(0.10000000149011612)) tmp = sign(x) * abs((single(0.3333333333333333) * ((single(-0.5) * (x ^ single(3.0))) + ((single(0.225) * (x ^ single(5.0))) + (x * single(3.0)))))); else tmp = sign(x) * abs(log((x + hypot(single(1.0), x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_0 \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(-0.5 \cdot {x}^{3} + \left(0.225 \cdot {x}^{5} + x \cdot 3\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -5Initial program 50.3%
Taylor expanded in x around -inf 98.5%
sub-neg98.5%
neg-mul-198.5%
unsub-neg98.5%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt99.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001Initial program 23.4%
add-cbrt-cube23.4%
pow1/323.4%
log-pow23.4%
pow323.4%
log-pow23.4%
+-commutative23.4%
hypot-1-def23.3%
add-sqr-sqrt10.6%
fabs-sqr10.6%
add-sqr-sqrt23.7%
Applied egg-rr23.7%
Taylor expanded in x around 0 98.5%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 46.4%
*-un-lft-identity46.4%
*-commutative46.4%
log-prod46.4%
+-commutative46.4%
hypot-1-def99.8%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.8%
metadata-eval99.8%
Applied egg-rr99.8%
+-rgt-identity99.8%
Simplified99.8%
Final simplification99.2%
(FPCore (x)
:precision binary32
(if (<= x -50.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= x 0.10000000149011612)
(copysign
(* 0.3333333333333333 (* 3.0 (+ x (* (pow x 3.0) -0.16666666666666666))))
x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (x <= 0.10000000149011612f) {
tmp = copysignf((0.3333333333333333f * (3.0f * (x + (powf(x, 3.0f) * -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (x <= Float32(0.10000000149011612)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(3.0) * Float32(x + Float32((x ^ Float32(3.0)) * Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-50.0)) tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x)))); elseif (x <= single(0.10000000149011612)) tmp = sign(x) * abs((single(0.3333333333333333) * (single(3.0) * (x + ((x ^ single(3.0)) * single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((x + hypot(single(1.0), x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if x < -50Initial program 50.3%
Taylor expanded in x around -inf 98.5%
sub-neg98.5%
neg-mul-198.5%
unsub-neg98.5%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt99.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -50 < x < 0.100000001Initial program 23.4%
add-cbrt-cube23.4%
pow1/323.4%
log-pow23.4%
pow323.4%
log-pow23.4%
+-commutative23.4%
hypot-1-def23.3%
add-sqr-sqrt10.6%
fabs-sqr10.6%
add-sqr-sqrt23.7%
Applied egg-rr23.7%
Taylor expanded in x around 0 97.9%
if 0.100000001 < x Initial program 46.4%
*-un-lft-identity46.4%
*-commutative46.4%
log-prod46.4%
+-commutative46.4%
hypot-1-def99.8%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.8%
metadata-eval99.8%
Applied egg-rr99.8%
+-rgt-identity99.8%
Simplified99.8%
Final simplification98.9%
(FPCore (x)
:precision binary32
(if (<= x -50.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= x 0.4000000059604645)
(copysign
(* 0.3333333333333333 (* 3.0 (+ x (* (pow x 3.0) -0.16666666666666666))))
x)
(copysign (log (+ (/ 0.5 x) (+ x x))) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (x <= 0.4000000059604645f) {
tmp = copysignf((0.3333333333333333f * (3.0f * (x + (powf(x, 3.0f) * -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf(((0.5f / x) + (x + x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (x <= Float32(0.4000000059604645)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(3.0) * Float32(x + Float32((x ^ Float32(3.0)) * Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(Float32(Float32(0.5) / x) + Float32(x + x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-50.0)) tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x)))); elseif (x <= single(0.4000000059604645)) tmp = sign(x) * abs((single(0.3333333333333333) * (single(3.0) * (x + ((x ^ single(3.0)) * single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log(((single(0.5) / x) + (x + x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\
\end{array}
\end{array}
if x < -50Initial program 50.3%
Taylor expanded in x around -inf 98.5%
sub-neg98.5%
neg-mul-198.5%
unsub-neg98.5%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt99.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -50 < x < 0.400000006Initial program 24.0%
add-cbrt-cube24.0%
pow1/324.0%
log-pow23.9%
pow323.9%
log-pow24.0%
+-commutative24.0%
hypot-1-def23.9%
add-sqr-sqrt11.3%
fabs-sqr11.3%
add-sqr-sqrt24.3%
Applied egg-rr24.3%
Taylor expanded in x around 0 97.6%
if 0.400000006 < x Initial program 45.7%
Taylor expanded in x around inf 99.4%
associate-+r+99.4%
+-commutative99.4%
associate-*r/99.4%
metadata-eval99.4%
rem-square-sqrt99.4%
fabs-sqr99.4%
rem-square-sqrt99.4%
Simplified99.4%
Final simplification98.6%
(FPCore (x)
:precision binary32
(if (<= x -50.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= x 0.4000000059604645)
(copysign (* 0.3333333333333333 (* x 3.0)) x)
(copysign (log (+ (/ 0.5 x) (+ x x))) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (x <= 0.4000000059604645f) {
tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
} else {
tmp = copysignf(logf(((0.5f / x) + (x + x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (x <= Float32(0.4000000059604645)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x); else tmp = copysign(log(Float32(Float32(Float32(0.5) / x) + Float32(x + x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-50.0)) tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x)))); elseif (x <= single(0.4000000059604645)) tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0)))); else tmp = sign(x) * abs(log(((single(0.5) / x) + (x + x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\
\end{array}
\end{array}
if x < -50Initial program 50.3%
Taylor expanded in x around -inf 98.5%
sub-neg98.5%
neg-mul-198.5%
unsub-neg98.5%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt99.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -50 < x < 0.400000006Initial program 24.0%
add-cbrt-cube24.0%
pow1/324.0%
log-pow23.9%
pow323.9%
log-pow24.0%
+-commutative24.0%
hypot-1-def23.9%
add-sqr-sqrt11.3%
fabs-sqr11.3%
add-sqr-sqrt24.3%
Applied egg-rr24.3%
Taylor expanded in x around 0 95.9%
if 0.400000006 < x Initial program 45.7%
Taylor expanded in x around inf 99.4%
associate-+r+99.4%
+-commutative99.4%
associate-*r/99.4%
metadata-eval99.4%
rem-square-sqrt99.4%
fabs-sqr99.4%
rem-square-sqrt99.4%
Simplified99.4%
Final simplification97.8%
(FPCore (x)
:precision binary32
(if (<= x -50.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= x 0.4000000059604645)
(copysign (* 0.3333333333333333 (* x 3.0)) x)
(copysign (log (+ x x)) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (x <= 0.4000000059604645f) {
tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
} else {
tmp = copysignf(logf((x + x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (x <= Float32(0.4000000059604645)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x); else tmp = copysign(log(Float32(x + x)), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-50.0)) tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x)))); elseif (x <= single(0.4000000059604645)) tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0)))); else tmp = sign(x) * abs(log((x + x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\end{array}
if x < -50Initial program 50.3%
Taylor expanded in x around -inf 98.5%
sub-neg98.5%
neg-mul-198.5%
unsub-neg98.5%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt99.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -50 < x < 0.400000006Initial program 24.0%
add-cbrt-cube24.0%
pow1/324.0%
log-pow23.9%
pow323.9%
log-pow24.0%
+-commutative24.0%
hypot-1-def23.9%
add-sqr-sqrt11.3%
fabs-sqr11.3%
add-sqr-sqrt24.3%
Applied egg-rr24.3%
Taylor expanded in x around 0 95.9%
if 0.400000006 < x Initial program 45.7%
Taylor expanded in x around inf 98.5%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt98.5%
Simplified98.5%
Final simplification97.5%
(FPCore (x)
:precision binary32
(if (<= x -0.5)
(copysign (- (log (/ -1.0 x))) x)
(if (<= x 0.4000000059604645)
(copysign (* 0.3333333333333333 (* x 3.0)) x)
(copysign (log (+ x x)) x))))
float code(float x) {
float tmp;
if (x <= -0.5f) {
tmp = copysignf(-logf((-1.0f / x)), x);
} else if (x <= 0.4000000059604645f) {
tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
} else {
tmp = copysignf(logf((x + x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-0.5)) tmp = copysign(Float32(-log(Float32(Float32(-1.0) / x))), x); elseif (x <= Float32(0.4000000059604645)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x); else tmp = copysign(log(Float32(x + x)), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-0.5)) tmp = sign(x) * abs(-log((single(-1.0) / x))); elseif (x <= single(0.4000000059604645)) tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0)))); else tmp = sign(x) * abs(log((x + x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.5:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\frac{-1}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\end{array}
if x < -0.5Initial program 51.1%
Taylor expanded in x around -inf 45.0%
mul-1-neg45.0%
Simplified45.0%
if -0.5 < x < 0.400000006Initial program 23.4%
add-cbrt-cube23.4%
pow1/323.4%
log-pow23.3%
pow323.3%
log-pow23.4%
+-commutative23.4%
hypot-1-def23.3%
add-sqr-sqrt11.4%
fabs-sqr11.4%
add-sqr-sqrt23.7%
Applied egg-rr23.7%
Taylor expanded in x around 0 96.3%
if 0.400000006 < x Initial program 45.7%
Taylor expanded in x around inf 98.5%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt98.5%
Simplified98.5%
Final simplification83.9%
(FPCore (x)
:precision binary32
(if (<= x -50.0)
(copysign (- -1.0 (log (- x))) x)
(if (<= x 0.4000000059604645)
(copysign (* 0.3333333333333333 (* x 3.0)) x)
(copysign (log (+ x x)) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf((-1.0f - logf(-x)), x);
} else if (x <= 0.4000000059604645f) {
tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
} else {
tmp = copysignf(logf((x + x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(Float32(Float32(-1.0) - log(Float32(-x))), x); elseif (x <= Float32(0.4000000059604645)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x); else tmp = copysign(log(Float32(x + x)), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-50.0)) tmp = sign(x) * abs((single(-1.0) - log(-x))); elseif (x <= single(0.4000000059604645)) tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0)))); else tmp = sign(x) * abs(log((x + x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(-1 - \log \left(-x\right), x\right)\\
\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\end{array}
if x < -50Initial program 50.3%
Taylor expanded in x around inf 6.1%
associate-+r+-0.0%
+-commutative-0.0%
associate-*r/-0.0%
metadata-eval-0.0%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt-0.0%
Simplified-0.0%
Applied egg-rr-0.0%
Simplified48.6%
if -50 < x < 0.400000006Initial program 24.0%
add-cbrt-cube24.0%
pow1/324.0%
log-pow23.9%
pow323.9%
log-pow24.0%
+-commutative24.0%
hypot-1-def23.9%
add-sqr-sqrt11.3%
fabs-sqr11.3%
add-sqr-sqrt24.3%
Applied egg-rr24.3%
Taylor expanded in x around 0 95.9%
if 0.400000006 < x Initial program 45.7%
Taylor expanded in x around inf 98.5%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt98.5%
Simplified98.5%
Final simplification84.8%
(FPCore (x) :precision binary32 (if (<= x 0.4000000059604645) (copysign (* 0.3333333333333333 (* x 3.0)) x) (copysign (log (+ x x)) x)))
float code(float x) {
float tmp;
if (x <= 0.4000000059604645f) {
tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
} else {
tmp = copysignf(logf((x + x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(0.4000000059604645)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x); else tmp = copysign(log(Float32(x + x)), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(0.4000000059604645)) tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0)))); else tmp = sign(x) * abs(log((x + x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\end{array}
if x < 0.400000006Initial program 33.0%
add-cbrt-cube28.5%
pow1/328.4%
log-pow28.3%
pow328.3%
log-pow32.8%
+-commutative32.8%
hypot-1-def49.0%
add-sqr-sqrt7.5%
fabs-sqr7.5%
add-sqr-sqrt19.0%
Applied egg-rr19.0%
Taylor expanded in x around 0 66.7%
if 0.400000006 < x Initial program 45.7%
Taylor expanded in x around inf 98.5%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt98.5%
Simplified98.5%
Final simplification75.3%
(FPCore (x) :precision binary32 (if (<= x 0.4000000059604645) (copysign (* 0.3333333333333333 (* x 3.0)) x) (copysign (log1p x) x)))
float code(float x) {
float tmp;
if (x <= 0.4000000059604645f) {
tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
} else {
tmp = copysignf(log1pf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(0.4000000059604645)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x); else tmp = copysign(log1p(x), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < 0.400000006Initial program 33.0%
add-cbrt-cube28.5%
pow1/328.4%
log-pow28.3%
pow328.3%
log-pow32.8%
+-commutative32.8%
hypot-1-def49.0%
add-sqr-sqrt7.5%
fabs-sqr7.5%
add-sqr-sqrt19.0%
Applied egg-rr19.0%
Taylor expanded in x around 0 66.7%
if 0.400000006 < x Initial program 45.7%
Taylor expanded in x around 0 44.5%
log1p-def44.5%
rem-square-sqrt44.5%
fabs-sqr44.5%
rem-square-sqrt44.5%
Simplified44.5%
Final simplification60.7%
(FPCore (x) :precision binary32 (copysign (* 0.3333333333333333 (* x 3.0)) x))
float code(float x) {
return copysignf((0.3333333333333333f * (x * 3.0f)), x);
}
function code(x) return copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x) end
function tmp = code(x) tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0)))); end
\begin{array}{l}
\\
\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)
\end{array}
Initial program 36.4%
add-cbrt-cube30.2%
pow1/330.1%
log-pow30.1%
pow330.0%
log-pow36.2%
+-commutative36.2%
hypot-1-def62.5%
add-sqr-sqrt32.1%
fabs-sqr32.1%
add-sqr-sqrt40.5%
Applied egg-rr40.5%
Taylor expanded in x around 0 51.7%
Final simplification51.7%
(FPCore (x) :precision binary32 (copysign (* 0.3333333333333333 (- x)) x))
float code(float x) {
return copysignf((0.3333333333333333f * -x), x);
}
function code(x) return copysign(Float32(Float32(0.3333333333333333) * Float32(-x)), x) end
function tmp = code(x) tmp = sign(x) * abs((single(0.3333333333333333) * -x)); end
\begin{array}{l}
\\
\mathsf{copysign}\left(0.3333333333333333 \cdot \left(-x\right), x\right)
\end{array}
Initial program 36.4%
add-cbrt-cube30.2%
pow1/330.1%
log-pow30.1%
pow330.0%
log-pow36.2%
+-commutative36.2%
hypot-1-def62.5%
add-sqr-sqrt32.1%
fabs-sqr32.1%
add-sqr-sqrt40.5%
Applied egg-rr40.5%
Taylor expanded in x around 0 51.7%
Simplified18.3%
Final simplification18.3%
(FPCore (x) :precision binary32 (let* ((t_0 (/ 1.0 (fabs x)))) (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 t_0) t_0)))) x)))
float code(float x) {
float t_0 = 1.0f / fabsf(x);
return copysignf(log1pf((fabsf(x) + (fabsf(x) / (hypotf(1.0f, t_0) + t_0)))), x);
}
function code(x) t_0 = Float32(Float32(1.0) / abs(x)) return copysign(log1p(Float32(abs(x) + Float32(abs(x) / Float32(hypot(Float32(1.0), t_0) + t_0)))), x) end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, t_0\right) + t_0}\right), x\right)
\end{array}
\end{array}
herbie shell --seed 2023292
(FPCore (x)
:name "Rust f32::asinh"
:precision binary32
:herbie-target
(copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))) x)
(copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))