
(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 14 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 -0.20000000298023224)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.20000000298023224)
(copysign
(+
(* -0.16666666666666666 (pow x 3.0))
(+ (* 0.075 (pow x 5.0)) (+ x (* -0.044642857142857144 (pow x 7.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.20000000298023224f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (t_0 <= 0.20000000298023224f) {
tmp = copysignf(((-0.16666666666666666f * powf(x, 3.0f)) + ((0.075f * powf(x, 5.0f)) + (x + (-0.044642857142857144f * powf(x, 7.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.20000000298023224)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.20000000298023224)) tmp = copysign(Float32(Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0))) + Float32(Float32(Float32(0.075) * (x ^ Float32(5.0))) + Float32(x + Float32(Float32(-0.044642857142857144) * (x ^ Float32(7.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(-0.20000000298023224)) tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x))); elseif (t_0 <= single(0.20000000298023224)) tmp = sign(x) * abs(((single(-0.16666666666666666) * (x ^ single(3.0))) + ((single(0.075) * (x ^ single(5.0))) + (x + (single(-0.044642857142857144) * (x ^ single(7.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 -0.20000000298023224:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.20000000298023224:\\
\;\;\;\;\mathsf{copysign}\left(-0.16666666666666666 \cdot {x}^{3} + \left(0.075 \cdot {x}^{5} + \left(x + -0.044642857142857144 \cdot {x}^{7}\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.200000003Initial program 55.6%
+-commutative55.6%
hypot-1-def99.9%
Simplified99.9%
flip-+9.5%
div-sub9.1%
pow29.1%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt9.1%
pow29.1%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt3.5%
hypot-udef3.5%
hypot-udef3.5%
add-sqr-sqrt3.5%
metadata-eval3.5%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt12.1%
Applied egg-rr12.1%
unpow212.1%
div-sub14.7%
unpow214.7%
unpow214.7%
unpow214.7%
+-commutative14.7%
associate--r+52.5%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
associate-/r*99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
log-div99.9%
sub-neg99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-lft-identity99.9%
Simplified99.9%
if -0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.200000003Initial program 25.6%
+-commutative25.6%
hypot-1-def25.7%
Simplified25.7%
flip-+25.5%
div-sub25.6%
pow225.6%
add-sqr-sqrt12.2%
fabs-sqr12.2%
add-sqr-sqrt25.6%
pow225.6%
add-sqr-sqrt12.2%
fabs-sqr12.2%
add-sqr-sqrt24.4%
hypot-udef24.4%
hypot-udef24.4%
add-sqr-sqrt24.4%
metadata-eval24.4%
add-sqr-sqrt12.2%
fabs-sqr12.2%
add-sqr-sqrt25.5%
Applied egg-rr25.5%
unpow225.5%
div-sub25.8%
unpow225.8%
unpow225.8%
unpow225.8%
+-commutative25.8%
associate--r+26.0%
+-inverses26.0%
metadata-eval26.0%
metadata-eval26.0%
associate-/r*26.0%
neg-mul-126.0%
sub-neg26.0%
+-commutative26.0%
distribute-neg-in26.0%
remove-double-neg26.0%
sub-neg26.0%
Simplified26.0%
Taylor expanded in x around 0 100.0%
if 0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 50.9%
+-commutative50.9%
hypot-1-def99.8%
Simplified99.8%
*-un-lft-identity99.8%
log-prod99.8%
metadata-eval99.8%
*-un-lft-identity99.8%
*-un-lft-identity99.8%
add-sqr-sqrt99.8%
fabs-sqr99.8%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
+-lft-identity99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.20000000298023224)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.05000000074505806)
(copysign
(+ (* -0.16666666666666666 (pow x 3.0)) (+ x (* 0.075 (pow x 5.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.20000000298023224f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (t_0 <= 0.05000000074505806f) {
tmp = copysignf(((-0.16666666666666666f * powf(x, 3.0f)) + (x + (0.075f * powf(x, 5.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.20000000298023224)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.05000000074505806)) tmp = copysign(Float32(Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0))) + Float32(x + Float32(Float32(0.075) * (x ^ Float32(5.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(-0.20000000298023224)) tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x))); elseif (t_0 <= single(0.05000000074505806)) tmp = sign(x) * abs(((single(-0.16666666666666666) * (x ^ single(3.0))) + (x + (single(0.075) * (x ^ single(5.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 -0.20000000298023224:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(-0.16666666666666666 \cdot {x}^{3} + \left(x + 0.075 \cdot {x}^{5}\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.200000003Initial program 55.6%
+-commutative55.6%
hypot-1-def99.9%
Simplified99.9%
flip-+9.5%
div-sub9.1%
pow29.1%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt9.1%
pow29.1%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt3.5%
hypot-udef3.5%
hypot-udef3.5%
add-sqr-sqrt3.5%
metadata-eval3.5%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt12.1%
Applied egg-rr12.1%
unpow212.1%
div-sub14.7%
unpow214.7%
unpow214.7%
unpow214.7%
+-commutative14.7%
associate--r+52.5%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
associate-/r*99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
log-div99.9%
sub-neg99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-lft-identity99.9%
Simplified99.9%
if -0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.0500000007Initial program 24.6%
+-commutative24.6%
hypot-1-def24.6%
Simplified24.6%
flip-+24.6%
div-sub24.5%
pow224.5%
add-sqr-sqrt10.9%
fabs-sqr10.9%
add-sqr-sqrt24.5%
pow224.5%
add-sqr-sqrt10.9%
fabs-sqr10.9%
add-sqr-sqrt23.3%
hypot-udef23.4%
hypot-udef23.4%
add-sqr-sqrt23.4%
metadata-eval23.4%
add-sqr-sqrt11.0%
fabs-sqr11.0%
add-sqr-sqrt24.5%
Applied egg-rr24.5%
unpow224.5%
div-sub24.9%
unpow224.9%
unpow224.9%
unpow224.9%
+-commutative24.9%
associate--r+24.9%
+-inverses24.9%
metadata-eval24.9%
metadata-eval24.9%
associate-/r*24.9%
neg-mul-124.9%
sub-neg24.9%
+-commutative24.9%
distribute-neg-in24.9%
remove-double-neg24.9%
sub-neg24.9%
Simplified24.9%
Taylor expanded in x around 0 100.0%
if 0.0500000007 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 52.1%
+-commutative52.1%
hypot-1-def99.7%
Simplified99.7%
*-un-lft-identity99.7%
log-prod99.7%
metadata-eval99.7%
*-un-lft-identity99.7%
*-un-lft-identity99.7%
add-sqr-sqrt99.7%
fabs-sqr99.7%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
+-lft-identity99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (x)
:precision binary32
(if (<= x -5.0)
(copysign (- (log (+ (* x -2.0) (* 0.5 (/ -1.0 x))))) x)
(if (<= x 0.05000000074505806)
(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 <= -5.0f) {
tmp = copysignf(-logf(((x * -2.0f) + (0.5f * (-1.0f / x)))), x);
} else if (x <= 0.05000000074505806f) {
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(-5.0)) tmp = copysign(Float32(-log(Float32(Float32(x * Float32(-2.0)) + Float32(Float32(0.5) * Float32(Float32(-1.0) / x))))), x); elseif (x <= Float32(0.05000000074505806)) 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(-5.0)) tmp = sign(x) * abs(-log(((x * single(-2.0)) + (single(0.5) * (single(-1.0) / x))))); elseif (x <= single(0.05000000074505806)) 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 -5:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2 + 0.5 \cdot \frac{-1}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\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 < -5Initial program 54.9%
+-commutative54.9%
hypot-1-def100.0%
Simplified100.0%
flip-+8.0%
div-sub7.6%
pow27.6%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt7.6%
pow27.6%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt2.8%
hypot-udef2.8%
hypot-udef2.8%
add-sqr-sqrt2.8%
metadata-eval2.8%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt10.5%
Applied egg-rr10.5%
unpow210.5%
div-sub13.3%
unpow213.3%
unpow213.3%
unpow213.3%
+-commutative13.3%
associate--r+51.8%
+-inverses100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
log-div100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.7%
if -5 < x < 0.0500000007Initial program 25.1%
+-commutative25.1%
hypot-1-def25.2%
Simplified25.2%
flip-+25.1%
div-sub25.0%
pow225.0%
add-sqr-sqrt10.9%
fabs-sqr10.9%
add-sqr-sqrt25.0%
pow225.0%
add-sqr-sqrt10.9%
fabs-sqr10.9%
add-sqr-sqrt23.5%
hypot-udef23.5%
hypot-udef23.5%
add-sqr-sqrt23.5%
metadata-eval23.5%
add-sqr-sqrt10.9%
fabs-sqr10.9%
add-sqr-sqrt25.1%
Applied egg-rr25.1%
unpow225.1%
div-sub25.4%
unpow225.4%
unpow225.4%
unpow225.4%
+-commutative25.4%
associate--r+25.4%
+-inverses25.4%
metadata-eval25.4%
metadata-eval25.4%
associate-/r*25.4%
neg-mul-125.4%
sub-neg25.4%
+-commutative25.4%
distribute-neg-in25.4%
remove-double-neg25.4%
sub-neg25.4%
Simplified25.4%
Taylor expanded in x around 0 99.5%
if 0.0500000007 < x Initial program 52.1%
+-commutative52.1%
hypot-1-def99.7%
Simplified99.7%
*-un-lft-identity99.7%
log-prod99.7%
metadata-eval99.7%
*-un-lft-identity99.7%
*-un-lft-identity99.7%
add-sqr-sqrt99.7%
fabs-sqr99.7%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
+-lft-identity99.7%
Simplified99.7%
Final simplification99.6%
(FPCore (x)
:precision binary32
(if (<= x -0.10000000149011612)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= x 0.05000000074505806)
(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 <= -0.10000000149011612f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (x <= 0.05000000074505806f) {
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(-0.10000000149011612)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (x <= Float32(0.05000000074505806)) 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(-0.10000000149011612)) tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x))); elseif (x <= single(0.05000000074505806)) 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 -0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\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 < -0.100000001Initial program 56.2%
+-commutative56.2%
hypot-1-def99.8%
Simplified99.8%
flip-+10.9%
div-sub10.5%
pow210.5%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt10.5%
pow210.5%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt4.1%
hypot-udef4.1%
hypot-udef4.1%
add-sqr-sqrt4.1%
metadata-eval4.1%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt13.4%
Applied egg-rr13.4%
unpow213.4%
div-sub16.1%
unpow216.1%
unpow216.1%
unpow216.1%
+-commutative16.1%
associate--r+53.3%
+-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-/r*99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
log-div99.8%
sub-neg99.8%
metadata-eval99.8%
Applied egg-rr99.8%
+-lft-identity99.8%
Simplified99.8%
if -0.100000001 < x < 0.0500000007Initial program 24.1%
+-commutative24.1%
hypot-1-def24.1%
Simplified24.1%
flip-+24.0%
div-sub24.0%
pow224.0%
add-sqr-sqrt11.0%
fabs-sqr11.0%
add-sqr-sqrt24.0%
pow224.0%
add-sqr-sqrt11.0%
fabs-sqr11.0%
add-sqr-sqrt23.2%
hypot-udef23.2%
hypot-udef23.3%
add-sqr-sqrt23.2%
metadata-eval23.2%
add-sqr-sqrt11.1%
fabs-sqr11.1%
add-sqr-sqrt24.1%
Applied egg-rr24.1%
unpow224.1%
div-sub24.3%
unpow224.3%
unpow224.3%
unpow224.3%
+-commutative24.3%
associate--r+24.4%
+-inverses24.4%
metadata-eval24.4%
metadata-eval24.4%
associate-/r*24.4%
neg-mul-124.4%
sub-neg24.4%
+-commutative24.4%
distribute-neg-in24.4%
remove-double-neg24.4%
sub-neg24.4%
Simplified24.4%
Taylor expanded in x around 0 100.0%
if 0.0500000007 < x Initial program 52.1%
+-commutative52.1%
hypot-1-def99.7%
Simplified99.7%
*-un-lft-identity99.7%
log-prod99.7%
metadata-eval99.7%
*-un-lft-identity99.7%
*-un-lft-identity99.7%
add-sqr-sqrt99.7%
fabs-sqr99.7%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
+-lft-identity99.7%
Simplified99.7%
Final simplification99.8%
(FPCore (x)
:precision binary32
(if (<= x -0.10000000149011612)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= x 0.05000000074505806)
(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 <= -0.10000000149011612f) {
tmp = copysignf(logf((1.0f / (hypotf(1.0f, x) - x))), x);
} else if (x <= 0.05000000074505806f) {
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(-0.10000000149011612)) tmp = copysign(log(Float32(Float32(1.0) / Float32(hypot(Float32(1.0), x) - x))), x); elseif (x <= Float32(0.05000000074505806)) 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(-0.10000000149011612)) tmp = sign(x) * abs(log((single(1.0) / (hypot(single(1.0), x) - x)))); elseif (x <= single(0.05000000074505806)) 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 -0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\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 < -0.100000001Initial program 56.2%
+-commutative56.2%
hypot-1-def99.8%
Simplified99.8%
flip-+10.9%
div-sub10.5%
pow210.5%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt10.5%
pow210.5%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt4.1%
hypot-udef4.1%
hypot-udef4.1%
add-sqr-sqrt4.1%
metadata-eval4.1%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt13.4%
Applied egg-rr13.4%
unpow213.4%
div-sub16.1%
unpow216.1%
unpow216.1%
unpow216.1%
+-commutative16.1%
associate--r+53.3%
+-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-/r*99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
if -0.100000001 < x < 0.0500000007Initial program 24.1%
+-commutative24.1%
hypot-1-def24.1%
Simplified24.1%
flip-+24.0%
div-sub24.0%
pow224.0%
add-sqr-sqrt11.0%
fabs-sqr11.0%
add-sqr-sqrt24.0%
pow224.0%
add-sqr-sqrt11.0%
fabs-sqr11.0%
add-sqr-sqrt23.2%
hypot-udef23.2%
hypot-udef23.3%
add-sqr-sqrt23.2%
metadata-eval23.2%
add-sqr-sqrt11.1%
fabs-sqr11.1%
add-sqr-sqrt24.1%
Applied egg-rr24.1%
unpow224.1%
div-sub24.3%
unpow224.3%
unpow224.3%
unpow224.3%
+-commutative24.3%
associate--r+24.4%
+-inverses24.4%
metadata-eval24.4%
metadata-eval24.4%
associate-/r*24.4%
neg-mul-124.4%
sub-neg24.4%
+-commutative24.4%
distribute-neg-in24.4%
remove-double-neg24.4%
sub-neg24.4%
Simplified24.4%
Taylor expanded in x around 0 100.0%
if 0.0500000007 < x Initial program 52.1%
+-commutative52.1%
hypot-1-def99.7%
Simplified99.7%
*-un-lft-identity99.7%
log-prod99.7%
metadata-eval99.7%
*-un-lft-identity99.7%
*-un-lft-identity99.7%
add-sqr-sqrt99.7%
fabs-sqr99.7%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
+-lft-identity99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (x)
:precision binary32
(if (<= x -5.0)
(copysign (- (log (+ (* x -2.0) (* 0.5 (/ -1.0 x))))) x)
(if (<= x 1.0)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (+ x (+ x (/ 0.5 x)))) x))))
float code(float x) {
float tmp;
if (x <= -5.0f) {
tmp = copysignf(-logf(((x * -2.0f) + (0.5f * (-1.0f / x)))), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((x + (x + (0.5f / x)))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-5.0)) tmp = copysign(Float32(-log(Float32(Float32(x * Float32(-2.0)) + Float32(Float32(0.5) * Float32(Float32(-1.0) / x))))), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0)))), x); else tmp = copysign(log(Float32(x + Float32(x + Float32(Float32(0.5) / x)))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-5.0)) tmp = sign(x) * abs(-log(((x * single(-2.0)) + (single(0.5) * (single(-1.0) / x))))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (x ^ single(3.0))))); else tmp = sign(x) * abs(log((x + (x + (single(0.5) / x))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2 + 0.5 \cdot \frac{-1}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \left(x + \frac{0.5}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -5Initial program 54.9%
+-commutative54.9%
hypot-1-def100.0%
Simplified100.0%
flip-+8.0%
div-sub7.6%
pow27.6%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt7.6%
pow27.6%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt2.8%
hypot-udef2.8%
hypot-udef2.8%
add-sqr-sqrt2.8%
metadata-eval2.8%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt10.5%
Applied egg-rr10.5%
unpow210.5%
div-sub13.3%
unpow213.3%
unpow213.3%
unpow213.3%
+-commutative13.3%
associate--r+51.8%
+-inverses100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
log-div100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.7%
if -5 < x < 1Initial program 27.6%
+-commutative27.6%
hypot-1-def27.7%
Simplified27.7%
flip-+27.6%
div-sub27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt26.1%
hypot-udef26.0%
hypot-udef26.0%
add-sqr-sqrt26.0%
metadata-eval26.0%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
Applied egg-rr27.6%
unpow227.6%
div-sub27.8%
unpow227.8%
unpow227.8%
unpow227.8%
+-commutative27.8%
associate--r+28.0%
+-inverses28.0%
metadata-eval28.0%
metadata-eval28.0%
associate-/r*28.0%
neg-mul-128.0%
sub-neg28.0%
+-commutative28.0%
distribute-neg-in28.0%
remove-double-neg28.0%
sub-neg28.0%
Simplified28.0%
Taylor expanded in x around 0 98.1%
if 1 < x Initial program 48.7%
+-commutative48.7%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 98.1%
associate-+r+98.1%
+-commutative98.1%
+-commutative98.1%
unpow198.1%
sqr-pow98.1%
fabs-sqr98.1%
sqr-pow98.1%
unpow198.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
Final simplification98.5%
(FPCore (x)
:precision binary32
(if (<= x -5.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 1.0)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (+ x (+ x (/ 0.5 x)))) x))))
float code(float x) {
float tmp;
if (x <= -5.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((x + (x + (0.5f / x)))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-5.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0)))), x); else tmp = copysign(log(Float32(x + Float32(x + Float32(Float32(0.5) / x)))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-5.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (x ^ single(3.0))))); else tmp = sign(x) * abs(log((x + (x + (single(0.5) / x))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \left(x + \frac{0.5}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -5Initial program 54.9%
+-commutative54.9%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.7%
associate--l+99.7%
unpow199.7%
sqr-pow-0.0%
fabs-sqr-0.0%
sqr-pow12.8%
unpow112.8%
associate-+r-97.6%
mul-1-neg97.6%
sub-neg97.6%
+-inverses97.6%
neg-sub097.6%
associate-*r/97.6%
metadata-eval97.6%
distribute-neg-frac97.6%
metadata-eval97.6%
Simplified97.6%
if -5 < x < 1Initial program 27.6%
+-commutative27.6%
hypot-1-def27.7%
Simplified27.7%
flip-+27.6%
div-sub27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt26.1%
hypot-udef26.0%
hypot-udef26.0%
add-sqr-sqrt26.0%
metadata-eval26.0%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
Applied egg-rr27.6%
unpow227.6%
div-sub27.8%
unpow227.8%
unpow227.8%
unpow227.8%
+-commutative27.8%
associate--r+28.0%
+-inverses28.0%
metadata-eval28.0%
metadata-eval28.0%
associate-/r*28.0%
neg-mul-128.0%
sub-neg28.0%
+-commutative28.0%
distribute-neg-in28.0%
remove-double-neg28.0%
sub-neg28.0%
Simplified28.0%
Taylor expanded in x around 0 98.1%
if 1 < x Initial program 48.7%
+-commutative48.7%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 98.1%
associate-+r+98.1%
+-commutative98.1%
+-commutative98.1%
unpow198.1%
sqr-pow98.1%
fabs-sqr98.1%
sqr-pow98.1%
unpow198.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
Final simplification98.0%
(FPCore (x)
:precision binary32
(if (<= x -5.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 1.0)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -5.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((0.5f / x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-5.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0)))), x); else tmp = copysign(log(Float32(Float32(0.5) / x)), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-5.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (x ^ single(3.0))))); else tmp = sign(x) * abs(log((single(0.5) / x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -5Initial program 54.9%
+-commutative54.9%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.7%
associate--l+99.7%
unpow199.7%
sqr-pow-0.0%
fabs-sqr-0.0%
sqr-pow12.8%
unpow112.8%
associate-+r-97.6%
mul-1-neg97.6%
sub-neg97.6%
+-inverses97.6%
neg-sub097.6%
associate-*r/97.6%
metadata-eval97.6%
distribute-neg-frac97.6%
metadata-eval97.6%
Simplified97.6%
if -5 < x < 1Initial program 27.6%
+-commutative27.6%
hypot-1-def27.7%
Simplified27.7%
flip-+27.6%
div-sub27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt26.1%
hypot-udef26.0%
hypot-udef26.0%
add-sqr-sqrt26.0%
metadata-eval26.0%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
Applied egg-rr27.6%
unpow227.6%
div-sub27.8%
unpow227.8%
unpow227.8%
unpow227.8%
+-commutative27.8%
associate--r+28.0%
+-inverses28.0%
metadata-eval28.0%
metadata-eval28.0%
associate-/r*28.0%
neg-mul-128.0%
sub-neg28.0%
+-commutative28.0%
distribute-neg-in28.0%
remove-double-neg28.0%
sub-neg28.0%
Simplified28.0%
Taylor expanded in x around 0 98.1%
if 1 < x Initial program 48.7%
+-commutative48.7%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 98.1%
associate-+r+98.1%
+-commutative98.1%
+-commutative98.1%
unpow198.1%
sqr-pow98.1%
fabs-sqr98.1%
sqr-pow98.1%
unpow198.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in x around 0 96.2%
Final simplification97.6%
(FPCore (x) :precision binary32 (if (<= x -5.0) (copysign (log (- x)) x) (if (<= x 1.0) (copysign x x) (copysign (log (+ x x)) x))))
float code(float x) {
float tmp;
if (x <= -5.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 1.0f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((x + x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-5.0)) tmp = copysign(log(Float32(-x)), x); elseif (x <= Float32(1.0)) tmp = copysign(x, 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(-5.0)) tmp = sign(x) * abs(log(-x)); elseif (x <= single(1.0)) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((x + x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\end{array}
if x < -5Initial program 54.9%
+-commutative54.9%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.0%
mul-1-neg44.0%
Simplified44.0%
if -5 < x < 1Initial program 27.6%
+-commutative27.6%
hypot-1-def27.7%
Simplified27.7%
flip-+27.6%
div-sub27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt26.1%
hypot-udef26.0%
hypot-udef26.0%
add-sqr-sqrt26.0%
metadata-eval26.0%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
Applied egg-rr27.6%
unpow227.6%
div-sub27.8%
unpow227.8%
unpow227.8%
unpow227.8%
+-commutative27.8%
associate--r+28.0%
+-inverses28.0%
metadata-eval28.0%
metadata-eval28.0%
associate-/r*28.0%
neg-mul-128.0%
sub-neg28.0%
+-commutative28.0%
distribute-neg-in28.0%
remove-double-neg28.0%
sub-neg28.0%
Simplified28.0%
Taylor expanded in x around 0 95.5%
if 1 < x Initial program 48.7%
+-commutative48.7%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 96.2%
unpow196.2%
sqr-pow96.2%
fabs-sqr96.2%
sqr-pow96.2%
unpow196.2%
Simplified96.2%
Final simplification84.4%
(FPCore (x) :precision binary32 (if (<= x -5.0) (copysign (log (/ -0.5 x)) x) (if (<= x 1.0) (copysign x x) (copysign (log (+ x x)) x))))
float code(float x) {
float tmp;
if (x <= -5.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((x + x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-5.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(x, 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(-5.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((x + x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\end{array}
if x < -5Initial program 54.9%
+-commutative54.9%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.7%
associate--l+99.7%
unpow199.7%
sqr-pow-0.0%
fabs-sqr-0.0%
sqr-pow12.8%
unpow112.8%
associate-+r-97.6%
mul-1-neg97.6%
sub-neg97.6%
+-inverses97.6%
neg-sub097.6%
associate-*r/97.6%
metadata-eval97.6%
distribute-neg-frac97.6%
metadata-eval97.6%
Simplified97.6%
if -5 < x < 1Initial program 27.6%
+-commutative27.6%
hypot-1-def27.7%
Simplified27.7%
flip-+27.6%
div-sub27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt26.1%
hypot-udef26.0%
hypot-udef26.0%
add-sqr-sqrt26.0%
metadata-eval26.0%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
Applied egg-rr27.6%
unpow227.6%
div-sub27.8%
unpow227.8%
unpow227.8%
unpow227.8%
+-commutative27.8%
associate--r+28.0%
+-inverses28.0%
metadata-eval28.0%
metadata-eval28.0%
associate-/r*28.0%
neg-mul-128.0%
sub-neg28.0%
+-commutative28.0%
distribute-neg-in28.0%
remove-double-neg28.0%
sub-neg28.0%
Simplified28.0%
Taylor expanded in x around 0 95.5%
if 1 < x Initial program 48.7%
+-commutative48.7%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 96.2%
unpow196.2%
sqr-pow96.2%
fabs-sqr96.2%
sqr-pow96.2%
unpow196.2%
Simplified96.2%
Final simplification96.1%
(FPCore (x) :precision binary32 (if (<= x -5.0) (copysign (log (/ -0.5 x)) x) (if (<= x 1.0) (copysign x x) (copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -5.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((0.5f / x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-5.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(x, x); else tmp = copysign(log(Float32(Float32(0.5) / x)), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-5.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((single(0.5) / x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -5Initial program 54.9%
+-commutative54.9%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.7%
associate--l+99.7%
unpow199.7%
sqr-pow-0.0%
fabs-sqr-0.0%
sqr-pow12.8%
unpow112.8%
associate-+r-97.6%
mul-1-neg97.6%
sub-neg97.6%
+-inverses97.6%
neg-sub097.6%
associate-*r/97.6%
metadata-eval97.6%
distribute-neg-frac97.6%
metadata-eval97.6%
Simplified97.6%
if -5 < x < 1Initial program 27.6%
+-commutative27.6%
hypot-1-def27.7%
Simplified27.7%
flip-+27.6%
div-sub27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
pow227.6%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt26.1%
hypot-udef26.0%
hypot-udef26.0%
add-sqr-sqrt26.0%
metadata-eval26.0%
add-sqr-sqrt13.9%
fabs-sqr13.9%
add-sqr-sqrt27.6%
Applied egg-rr27.6%
unpow227.6%
div-sub27.8%
unpow227.8%
unpow227.8%
unpow227.8%
+-commutative27.8%
associate--r+28.0%
+-inverses28.0%
metadata-eval28.0%
metadata-eval28.0%
associate-/r*28.0%
neg-mul-128.0%
sub-neg28.0%
+-commutative28.0%
distribute-neg-in28.0%
remove-double-neg28.0%
sub-neg28.0%
Simplified28.0%
Taylor expanded in x around 0 95.5%
if 1 < x Initial program 48.7%
+-commutative48.7%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 98.1%
associate-+r+98.1%
+-commutative98.1%
+-commutative98.1%
unpow198.1%
sqr-pow98.1%
fabs-sqr98.1%
sqr-pow98.1%
unpow198.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in x around 0 96.2%
Final simplification96.1%
(FPCore (x) :precision binary32 (if (<= x -5.0) (copysign (log (- x)) x) (copysign (log1p x) x)))
float code(float x) {
float tmp;
if (x <= -5.0f) {
tmp = copysignf(logf(-x), x);
} else {
tmp = copysignf(log1pf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-5.0)) tmp = copysign(log(Float32(-x)), x); else tmp = copysign(log1p(x), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < -5Initial program 54.9%
+-commutative54.9%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.0%
mul-1-neg44.0%
Simplified44.0%
if -5 < x Initial program 34.2%
+-commutative34.2%
hypot-1-def50.1%
Simplified50.1%
Taylor expanded in x around 0 28.8%
log1p-def75.7%
unpow175.7%
sqr-pow45.3%
fabs-sqr45.3%
sqr-pow75.7%
unpow175.7%
Simplified75.7%
Final simplification68.7%
(FPCore (x) :precision binary32 (if (<= x 1.0) (copysign x x) (copysign (log1p x) x)))
float code(float x) {
float tmp;
if (x <= 1.0f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(log1pf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(1.0)) tmp = copysign(x, 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(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < 1Initial program 35.5%
+-commutative35.5%
hypot-1-def48.6%
Simplified48.6%
flip-+21.9%
div-sub21.8%
pow221.8%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt21.8%
pow221.8%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt19.4%
hypot-udef19.3%
hypot-udef19.3%
add-sqr-sqrt19.3%
metadata-eval19.3%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt22.7%
Applied egg-rr22.7%
unpow222.7%
div-sub23.6%
unpow223.6%
unpow223.6%
unpow223.6%
+-commutative23.6%
associate--r+34.8%
+-inverses48.8%
metadata-eval48.8%
metadata-eval48.8%
associate-/r*48.8%
neg-mul-148.8%
sub-neg48.8%
+-commutative48.8%
distribute-neg-in48.8%
remove-double-neg48.8%
sub-neg48.8%
Simplified48.8%
Taylor expanded in x around 0 71.3%
if 1 < x Initial program 48.7%
+-commutative48.7%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around 0 44.0%
log1p-def44.0%
unpow144.0%
sqr-pow44.0%
fabs-sqr44.0%
sqr-pow44.0%
unpow144.0%
Simplified44.0%
Final simplification64.7%
(FPCore (x) :precision binary32 (copysign x x))
float code(float x) {
return copysignf(x, x);
}
function code(x) return copysign(x, x) end
function tmp = code(x) tmp = sign(x) * abs(x); end
\begin{array}{l}
\\
\mathsf{copysign}\left(x, x\right)
\end{array}
Initial program 38.7%
+-commutative38.7%
hypot-1-def61.0%
Simplified61.0%
flip-+19.2%
div-sub19.1%
pow219.1%
add-sqr-sqrt10.0%
fabs-sqr10.0%
add-sqr-sqrt19.1%
pow219.1%
add-sqr-sqrt9.5%
fabs-sqr9.5%
add-sqr-sqrt17.3%
hypot-udef17.2%
hypot-udef17.2%
add-sqr-sqrt17.2%
metadata-eval17.2%
add-sqr-sqrt9.9%
fabs-sqr9.9%
add-sqr-sqrt19.7%
Applied egg-rr19.7%
unpow219.7%
div-sub20.5%
unpow220.5%
unpow220.5%
unpow220.5%
+-commutative20.5%
associate--r+28.9%
+-inverses39.5%
metadata-eval39.5%
metadata-eval39.5%
associate-/r*39.5%
neg-mul-139.5%
sub-neg39.5%
+-commutative39.5%
distribute-neg-in40.8%
remove-double-neg40.8%
sub-neg40.8%
Simplified40.8%
Taylor expanded in x around 0 56.9%
Final simplification56.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 2023171
(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))