
(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 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -1.0)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)
(if (<= t_0 0.10000000149011612)
(copysign
(+
x
(*
(fma
(pow x 2.0)
(fma (pow x 2.0) -0.044642857142857144 0.075)
-0.16666666666666666)
(pow 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 <= -1.0f) {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
} else if (t_0 <= 0.10000000149011612f) {
tmp = copysignf((x + (fmaf(powf(x, 2.0f), fmaf(powf(x, 2.0f), -0.044642857142857144f, 0.075f), -0.16666666666666666f) * powf(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(-1.0)) tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); elseif (t_0 <= Float32(0.10000000149011612)) tmp = copysign(Float32(x + Float32(fma((x ^ Float32(2.0)), fma((x ^ Float32(2.0)), Float32(-0.044642857142857144), Float32(0.075)), Float32(-0.16666666666666666)) * (x ^ Float32(3.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 -1:\\
\;\;\;\;\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(x + \mathsf{fma}\left({x}^{2}, \mathsf{fma}\left({x}^{2}, -0.044642857142857144, 0.075\right), -0.16666666666666666\right) \cdot {x}^{3}, 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) < -1Initial program 57.4%
+-commutative57.4%
hypot-1-def100.0%
Simplified100.0%
if -1 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001Initial program 22.1%
*-un-lft-identity22.1%
*-commutative22.1%
log-prod22.1%
*-un-lft-identity22.1%
*-un-lft-identity22.1%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.3%
+-commutative22.3%
hypot-1-def22.3%
metadata-eval22.3%
Applied egg-rr22.3%
+-rgt-identity22.3%
Simplified22.3%
Taylor expanded in x around 0 99.9%
distribute-rgt-in100.0%
*-lft-identity100.0%
*-commutative100.0%
associate-*l*100.0%
fma-neg100.0%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
metadata-eval100.0%
unpow2100.0%
unpow3100.0%
Simplified100.0%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -1.0)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)
(if (<= t_0 0.10000000149011612)
(copysign
(*
x
(+
1.0
(*
(pow x 2.0)
(-
(* (pow x 2.0) (+ 0.075 (* (pow x 2.0) -0.044642857142857144)))
0.16666666666666666))))
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 <= -1.0f) {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
} else if (t_0 <= 0.10000000149011612f) {
tmp = copysignf((x * (1.0f + (powf(x, 2.0f) * ((powf(x, 2.0f) * (0.075f + (powf(x, 2.0f) * -0.044642857142857144f))) - 0.16666666666666666f)))), 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(-1.0)) tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); elseif (t_0 <= Float32(0.10000000149011612)) tmp = copysign(Float32(x * Float32(Float32(1.0) + Float32((x ^ Float32(2.0)) * Float32(Float32((x ^ Float32(2.0)) * Float32(Float32(0.075) + Float32((x ^ Float32(2.0)) * Float32(-0.044642857142857144)))) - 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) t_0 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0)))))); tmp = single(0.0); if (t_0 <= single(-1.0)) tmp = sign(x) * abs(log((abs(x) + hypot(single(1.0), x)))); elseif (t_0 <= single(0.10000000149011612)) tmp = sign(x) * abs((x * (single(1.0) + ((x ^ single(2.0)) * (((x ^ single(2.0)) * (single(0.075) + ((x ^ single(2.0)) * single(-0.044642857142857144)))) - 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}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t\_0 \leq -1:\\
\;\;\;\;\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(x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + {x}^{2} \cdot -0.044642857142857144\right) - 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 (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -1Initial program 57.4%
+-commutative57.4%
hypot-1-def100.0%
Simplified100.0%
if -1 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001Initial program 22.1%
*-un-lft-identity22.1%
*-commutative22.1%
log-prod22.1%
*-un-lft-identity22.1%
*-un-lft-identity22.1%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.3%
+-commutative22.3%
hypot-1-def22.3%
metadata-eval22.3%
Applied egg-rr22.3%
+-rgt-identity22.3%
Simplified22.3%
Taylor expanded in x around 0 99.9%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -1.0)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)
(if (<= t_0 0.10000000149011612)
(copysign
(- x (* (pow x 3.0) (- 0.16666666666666666 (* (pow x 2.0) 0.075))))
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 <= -1.0f) {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
} else if (t_0 <= 0.10000000149011612f) {
tmp = copysignf((x - (powf(x, 3.0f) * (0.16666666666666666f - (powf(x, 2.0f) * 0.075f)))), 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(-1.0)) tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); elseif (t_0 <= Float32(0.10000000149011612)) tmp = copysign(Float32(x - Float32((x ^ Float32(3.0)) * Float32(Float32(0.16666666666666666) - Float32((x ^ Float32(2.0)) * Float32(0.075))))), 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(-1.0)) tmp = sign(x) * abs(log((abs(x) + hypot(single(1.0), x)))); elseif (t_0 <= single(0.10000000149011612)) tmp = sign(x) * abs((x - ((x ^ single(3.0)) * (single(0.16666666666666666) - ((x ^ single(2.0)) * single(0.075)))))); 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 -1:\\
\;\;\;\;\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(x - {x}^{3} \cdot \left(0.16666666666666666 - {x}^{2} \cdot 0.075\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) < -1Initial program 57.4%
+-commutative57.4%
hypot-1-def100.0%
Simplified100.0%
if -1 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001Initial program 22.1%
*-un-lft-identity22.1%
*-commutative22.1%
log-prod22.1%
*-un-lft-identity22.1%
*-un-lft-identity22.1%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.3%
+-commutative22.3%
hypot-1-def22.3%
metadata-eval22.3%
Applied egg-rr22.3%
+-rgt-identity22.3%
Simplified22.3%
Taylor expanded in x around 0 99.8%
distribute-rgt-in99.8%
*-lft-identity99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
fma-neg99.8%
metadata-eval99.8%
unpow299.8%
unpow399.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x)
:precision binary32
(if (<= x -1.0)
(copysign (log (/ (+ -0.5 (/ 0.125 (pow x 2.0))) x)) x)
(if (<= x 0.10000000149011612)
(copysign
(- x (* (pow x 3.0) (- 0.16666666666666666 (* (pow x 2.0) 0.075))))
x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -1.0f) {
tmp = copysignf(logf(((-0.5f + (0.125f / powf(x, 2.0f))) / x)), x);
} else if (x <= 0.10000000149011612f) {
tmp = copysignf((x - (powf(x, 3.0f) * (0.16666666666666666f - (powf(x, 2.0f) * 0.075f)))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-1.0)) tmp = copysign(log(Float32(Float32(Float32(-0.5) + Float32(Float32(0.125) / (x ^ Float32(2.0)))) / x)), x); elseif (x <= Float32(0.10000000149011612)) tmp = copysign(Float32(x - Float32((x ^ Float32(3.0)) * Float32(Float32(0.16666666666666666) - Float32((x ^ Float32(2.0)) * Float32(0.075))))), 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(-1.0)) tmp = sign(x) * abs(log(((single(-0.5) + (single(0.125) / (x ^ single(2.0)))) / x))); elseif (x <= single(0.10000000149011612)) tmp = sign(x) * abs((x - ((x ^ single(3.0)) * (single(0.16666666666666666) - ((x ^ single(2.0)) * single(0.075)))))); 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 -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5 + \frac{0.125}{{x}^{2}}}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x - {x}^{3} \cdot \left(0.16666666666666666 - {x}^{2} \cdot 0.075\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 < -1Initial program 57.4%
*-un-lft-identity57.4%
*-commutative57.4%
log-prod57.4%
*-un-lft-identity57.4%
*-un-lft-identity57.4%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt14.4%
+-commutative14.4%
hypot-1-def14.4%
metadata-eval14.4%
Applied egg-rr14.4%
+-rgt-identity14.4%
Simplified14.4%
Taylor expanded in x around -inf 97.7%
associate-*r/97.7%
mul-1-neg97.7%
neg-sub097.7%
associate--r-97.7%
metadata-eval97.7%
associate-*r/97.7%
metadata-eval97.7%
Simplified97.7%
if -1 < x < 0.100000001Initial program 22.1%
*-un-lft-identity22.1%
*-commutative22.1%
log-prod22.1%
*-un-lft-identity22.1%
*-un-lft-identity22.1%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.3%
+-commutative22.3%
hypot-1-def22.3%
metadata-eval22.3%
Applied egg-rr22.3%
+-rgt-identity22.3%
Simplified22.3%
Taylor expanded in x around 0 99.8%
distribute-rgt-in99.8%
*-lft-identity99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
fma-neg99.8%
metadata-eval99.8%
unpow299.8%
unpow399.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
if 0.100000001 < x Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Final simplification99.3%
(FPCore (x)
:precision binary32
(if (<= x -1.0)
(copysign (log (* x (+ -1.0 (/ (+ (fabs x) (/ -0.5 x)) x)))) x)
(if (<= x 0.10000000149011612)
(copysign
(- x (* (pow x 3.0) (- 0.16666666666666666 (* (pow x 2.0) 0.075))))
x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -1.0f) {
tmp = copysignf(logf((x * (-1.0f + ((fabsf(x) + (-0.5f / x)) / x)))), x);
} else if (x <= 0.10000000149011612f) {
tmp = copysignf((x - (powf(x, 3.0f) * (0.16666666666666666f - (powf(x, 2.0f) * 0.075f)))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-1.0)) tmp = copysign(log(Float32(x * Float32(Float32(-1.0) + Float32(Float32(abs(x) + Float32(Float32(-0.5) / x)) / x)))), x); elseif (x <= Float32(0.10000000149011612)) tmp = copysign(Float32(x - Float32((x ^ Float32(3.0)) * Float32(Float32(0.16666666666666666) - Float32((x ^ Float32(2.0)) * Float32(0.075))))), 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(-1.0)) tmp = sign(x) * abs(log((x * (single(-1.0) + ((abs(x) + (single(-0.5) / x)) / x))))); elseif (x <= single(0.10000000149011612)) tmp = sign(x) * abs((x - ((x ^ single(3.0)) * (single(0.16666666666666666) - ((x ^ single(2.0)) * single(0.075)))))); 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 -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(-1 + \frac{\left|x\right| + \frac{-0.5}{x}}{x}\right)\right), x\right)\\
\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x - {x}^{3} \cdot \left(0.16666666666666666 - {x}^{2} \cdot 0.075\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 < -1Initial program 57.4%
Taylor expanded in x around -inf 97.8%
mul-1-neg97.8%
distribute-rgt-neg-in97.8%
mul-1-neg97.8%
unsub-neg97.8%
sub-neg97.8%
associate-*r/97.8%
metadata-eval97.8%
distribute-neg-frac97.8%
metadata-eval97.8%
Simplified97.8%
if -1 < x < 0.100000001Initial program 22.1%
*-un-lft-identity22.1%
*-commutative22.1%
log-prod22.1%
*-un-lft-identity22.1%
*-un-lft-identity22.1%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.3%
+-commutative22.3%
hypot-1-def22.3%
metadata-eval22.3%
Applied egg-rr22.3%
+-rgt-identity22.3%
Simplified22.3%
Taylor expanded in x around 0 99.8%
distribute-rgt-in99.8%
*-lft-identity99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
fma-neg99.8%
metadata-eval99.8%
unpow299.8%
unpow399.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
if 0.100000001 < x Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Final simplification99.3%
(FPCore (x)
:precision binary32
(if (<= x -1.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 0.10000000149011612)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -1.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 0.10000000149011612f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-1.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(0.10000000149011612)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (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) tmp = single(0.0); if (x <= single(-1.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(0.10000000149011612)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (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}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, 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 < -1Initial program 57.4%
*-un-lft-identity57.4%
*-commutative57.4%
log-prod57.4%
*-un-lft-identity57.4%
*-un-lft-identity57.4%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt14.4%
+-commutative14.4%
hypot-1-def14.4%
metadata-eval14.4%
Applied egg-rr14.4%
+-rgt-identity14.4%
Simplified14.4%
Taylor expanded in x around -inf 96.1%
if -1 < x < 0.100000001Initial program 22.1%
*-un-lft-identity22.1%
*-commutative22.1%
log-prod22.1%
*-un-lft-identity22.1%
*-un-lft-identity22.1%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.3%
+-commutative22.3%
hypot-1-def22.3%
metadata-eval22.3%
Applied egg-rr22.3%
+-rgt-identity22.3%
Simplified22.3%
Taylor expanded in x around 0 99.2%
distribute-rgt-in99.2%
*-lft-identity99.2%
associate-*l*99.2%
unpow299.2%
unpow399.2%
Simplified99.2%
if 0.100000001 < x Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Final simplification98.5%
(FPCore (x)
:precision binary32
(if (<= x -1.0)
(copysign (log (/ (+ -0.5 (/ 0.125 (pow x 2.0))) x)) x)
(if (<= x 0.10000000149011612)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -1.0f) {
tmp = copysignf(logf(((-0.5f + (0.125f / powf(x, 2.0f))) / x)), x);
} else if (x <= 0.10000000149011612f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-1.0)) tmp = copysign(log(Float32(Float32(Float32(-0.5) + Float32(Float32(0.125) / (x ^ Float32(2.0)))) / x)), x); elseif (x <= Float32(0.10000000149011612)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (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) tmp = single(0.0); if (x <= single(-1.0)) tmp = sign(x) * abs(log(((single(-0.5) + (single(0.125) / (x ^ single(2.0)))) / x))); elseif (x <= single(0.10000000149011612)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (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}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5 + \frac{0.125}{{x}^{2}}}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, 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 < -1Initial program 57.4%
*-un-lft-identity57.4%
*-commutative57.4%
log-prod57.4%
*-un-lft-identity57.4%
*-un-lft-identity57.4%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt14.4%
+-commutative14.4%
hypot-1-def14.4%
metadata-eval14.4%
Applied egg-rr14.4%
+-rgt-identity14.4%
Simplified14.4%
Taylor expanded in x around -inf 97.7%
associate-*r/97.7%
mul-1-neg97.7%
neg-sub097.7%
associate--r-97.7%
metadata-eval97.7%
associate-*r/97.7%
metadata-eval97.7%
Simplified97.7%
if -1 < x < 0.100000001Initial program 22.1%
*-un-lft-identity22.1%
*-commutative22.1%
log-prod22.1%
*-un-lft-identity22.1%
*-un-lft-identity22.1%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.3%
+-commutative22.3%
hypot-1-def22.3%
metadata-eval22.3%
Applied egg-rr22.3%
+-rgt-identity22.3%
Simplified22.3%
Taylor expanded in x around 0 99.2%
distribute-rgt-in99.2%
*-lft-identity99.2%
associate-*l*99.2%
unpow299.2%
unpow399.2%
Simplified99.2%
if 0.100000001 < x Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Final simplification99.0%
(FPCore (x)
:precision binary32
(if (<= x -1.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 0.10000000149011612)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (* x 2.0)) x))))
float code(float x) {
float tmp;
if (x <= -1.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 0.10000000149011612f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((x * 2.0f)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-1.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(0.10000000149011612)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0)))), x); else tmp = copysign(log(Float32(x * Float32(2.0))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-1.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(0.10000000149011612)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (x ^ single(3.0))))); else tmp = sign(x) * abs(log((x * single(2.0)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\
\end{array}
\end{array}
if x < -1Initial program 57.4%
*-un-lft-identity57.4%
*-commutative57.4%
log-prod57.4%
*-un-lft-identity57.4%
*-un-lft-identity57.4%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt14.4%
+-commutative14.4%
hypot-1-def14.4%
metadata-eval14.4%
Applied egg-rr14.4%
+-rgt-identity14.4%
Simplified14.4%
Taylor expanded in x around -inf 96.1%
if -1 < x < 0.100000001Initial program 22.1%
*-un-lft-identity22.1%
*-commutative22.1%
log-prod22.1%
*-un-lft-identity22.1%
*-un-lft-identity22.1%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.3%
+-commutative22.3%
hypot-1-def22.3%
metadata-eval22.3%
Applied egg-rr22.3%
+-rgt-identity22.3%
Simplified22.3%
Taylor expanded in x around 0 99.2%
distribute-rgt-in99.2%
*-lft-identity99.2%
associate-*l*99.2%
unpow299.2%
unpow399.2%
Simplified99.2%
if 0.100000001 < x Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Taylor expanded in x around inf 96.3%
*-commutative96.3%
Simplified96.3%
Final simplification97.7%
(FPCore (x)
:precision binary32
(if (<= x -5.0)
(copysign 4.0 x)
(if (<= x 0.10000000149011612)
(copysign x x)
(copysign (log (* x 2.0)) x))))
float code(float x) {
float tmp;
if (x <= -5.0f) {
tmp = copysignf(4.0f, x);
} else if (x <= 0.10000000149011612f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((x * 2.0f)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-5.0)) tmp = copysign(Float32(4.0), x); elseif (x <= Float32(0.10000000149011612)) tmp = copysign(x, x); else tmp = copysign(log(Float32(x * Float32(2.0))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-5.0)) tmp = sign(x) * abs(single(4.0)); elseif (x <= single(0.10000000149011612)) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((x * single(2.0)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(4, x\right)\\
\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\
\end{array}
\end{array}
if x < -5Initial program 55.4%
Taylor expanded in x around 0 44.2%
log1p-define44.2%
Simplified44.2%
Applied egg-rr23.6%
if -5 < x < 0.100000001Initial program 23.8%
*-un-lft-identity23.8%
*-commutative23.8%
log-prod23.8%
*-un-lft-identity23.8%
*-un-lft-identity23.8%
add-sqr-sqrt9.7%
fabs-sqr9.7%
add-sqr-sqrt23.9%
+-commutative23.9%
hypot-1-def23.9%
metadata-eval23.9%
Applied egg-rr23.9%
+-rgt-identity23.9%
Simplified23.9%
Taylor expanded in x around 0 96.4%
if 0.100000001 < x Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Taylor expanded in x around inf 96.3%
*-commutative96.3%
Simplified96.3%
Final simplification77.9%
(FPCore (x)
:precision binary32
(if (<= x -1.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 0.10000000149011612)
(copysign x x)
(copysign (log (* x 2.0)) x))))
float code(float x) {
float tmp;
if (x <= -1.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 0.10000000149011612f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((x * 2.0f)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-1.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(0.10000000149011612)) tmp = copysign(x, x); else tmp = copysign(log(Float32(x * Float32(2.0))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-1.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(0.10000000149011612)) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((x * single(2.0)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\
\end{array}
\end{array}
if x < -1Initial program 57.4%
*-un-lft-identity57.4%
*-commutative57.4%
log-prod57.4%
*-un-lft-identity57.4%
*-un-lft-identity57.4%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt14.4%
+-commutative14.4%
hypot-1-def14.4%
metadata-eval14.4%
Applied egg-rr14.4%
+-rgt-identity14.4%
Simplified14.4%
Taylor expanded in x around -inf 96.1%
if -1 < x < 0.100000001Initial program 22.1%
*-un-lft-identity22.1%
*-commutative22.1%
log-prod22.1%
*-un-lft-identity22.1%
*-un-lft-identity22.1%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.3%
+-commutative22.3%
hypot-1-def22.3%
metadata-eval22.3%
Applied egg-rr22.3%
+-rgt-identity22.3%
Simplified22.3%
Taylor expanded in x around 0 97.9%
if 0.100000001 < x Initial program 56.5%
*-un-lft-identity56.5%
*-commutative56.5%
log-prod56.5%
*-un-lft-identity56.5%
*-un-lft-identity56.5%
add-sqr-sqrt56.5%
fabs-sqr56.5%
add-sqr-sqrt56.5%
+-commutative56.5%
hypot-1-def99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Taylor expanded in x around inf 96.3%
*-commutative96.3%
Simplified96.3%
Final simplification97.1%
(FPCore (x) :precision binary32 (if (<= x -1.0) (copysign 4.0 x) (copysign (log1p x) x)))
float code(float x) {
float tmp;
if (x <= -1.0f) {
tmp = copysignf(4.0f, x);
} else {
tmp = copysignf(log1pf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-1.0)) tmp = copysign(Float32(4.0), x); else tmp = copysign(log1p(x), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(4, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < -1Initial program 57.4%
Taylor expanded in x around 0 43.7%
log1p-define43.7%
Simplified43.7%
Applied egg-rr23.7%
if -1 < x Initial program 32.3%
Taylor expanded in x around 0 26.6%
log1p-define79.0%
rem-square-sqrt46.6%
fabs-sqr46.6%
rem-square-sqrt79.0%
Simplified79.0%
Final simplification64.3%
(FPCore (x) :precision binary32 (if (<= x -5.0) (copysign 4.0 x) (copysign x x)))
float code(float x) {
float tmp;
if (x <= -5.0f) {
tmp = copysignf(4.0f, x);
} else {
tmp = copysignf(x, x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-5.0)) tmp = copysign(Float32(4.0), x); else tmp = copysign(x, x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-5.0)) tmp = sign(x) * abs(single(4.0)); else tmp = sign(x) * abs(x); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(4, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\end{array}
\end{array}
if x < -5Initial program 55.4%
Taylor expanded in x around 0 44.2%
log1p-define44.2%
Simplified44.2%
Applied egg-rr23.6%
if -5 < x Initial program 33.4%
*-un-lft-identity33.4%
*-commutative33.4%
log-prod33.4%
*-un-lft-identity33.4%
*-un-lft-identity33.4%
add-sqr-sqrt23.4%
fabs-sqr23.4%
add-sqr-sqrt33.5%
+-commutative33.5%
hypot-1-def46.2%
metadata-eval46.2%
Applied egg-rr46.2%
+-rgt-identity46.2%
Simplified46.2%
Taylor expanded in x around 0 71.8%
Final simplification59.5%
(FPCore (x) :precision binary32 (copysign -1.0 x))
float code(float x) {
return copysignf(-1.0f, x);
}
function code(x) return copysign(Float32(-1.0), x) end
function tmp = code(x) tmp = sign(x) * abs(single(-1.0)); end
\begin{array}{l}
\\
\mathsf{copysign}\left(-1, x\right)
\end{array}
Initial program 39.0%
Taylor expanded in x around 0 31.1%
log1p-define69.6%
Simplified69.6%
Applied egg-rr15.8%
Final simplification15.8%
(FPCore (x) :precision binary32 (copysign 2.0 x))
float code(float x) {
return copysignf(2.0f, x);
}
function code(x) return copysign(Float32(2.0), x) end
function tmp = code(x) tmp = sign(x) * abs(single(2.0)); end
\begin{array}{l}
\\
\mathsf{copysign}\left(2, x\right)
\end{array}
Initial program 39.0%
Taylor expanded in x around 0 31.1%
log1p-define69.6%
Simplified69.6%
Applied egg-rr16.5%
Final simplification16.5%
(FPCore (x) :precision binary32 (copysign 3.0 x))
float code(float x) {
return copysignf(3.0f, x);
}
function code(x) return copysign(Float32(3.0), x) end
function tmp = code(x) tmp = sign(x) * abs(single(3.0)); end
\begin{array}{l}
\\
\mathsf{copysign}\left(3, x\right)
\end{array}
Initial program 39.0%
Taylor expanded in x around 0 31.1%
log1p-define69.6%
Simplified69.6%
Applied egg-rr16.6%
Final simplification16.6%
(FPCore (x) :precision binary32 (copysign 4.0 x))
float code(float x) {
return copysignf(4.0f, x);
}
function code(x) return copysign(Float32(4.0), x) end
function tmp = code(x) tmp = sign(x) * abs(single(4.0)); end
\begin{array}{l}
\\
\mathsf{copysign}\left(4, x\right)
\end{array}
Initial program 39.0%
Taylor expanded in x around 0 31.1%
log1p-define69.6%
Simplified69.6%
Applied egg-rr16.9%
Final simplification16.9%
(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 2024050
(FPCore (x)
:name "Rust f32::asinh"
:precision binary32
:alt
(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))