
(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 15 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))
(t_1 (pow (+ x 1.0) 2.0)))
(if (<= t_0 -0.4000000059604645)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.20000000298023224)
(copysign
(+
(fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x))
(fma
-0.041666666666666664
(* (pow x 4.0) (+ (/ 3.0 (+ x 1.0)) (/ 3.0 t_1)))
(*
(pow x 6.0)
(*
(+
(/ 30.0 (pow (+ x 1.0) 3.0))
(+ (/ 45.0 t_1) (/ 45.0 (+ x 1.0))))
0.001388888888888889))))
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 = powf((x + 1.0f), 2.0f);
float tmp;
if (t_0 <= -0.4000000059604645f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (t_0 <= 0.20000000298023224f) {
tmp = copysignf((fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x)) + fmaf(-0.041666666666666664f, (powf(x, 4.0f) * ((3.0f / (x + 1.0f)) + (3.0f / t_1))), (powf(x, 6.0f) * (((30.0f / powf((x + 1.0f), 3.0f)) + ((45.0f / t_1) + (45.0f / (x + 1.0f)))) * 0.001388888888888889f)))), 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(x + Float32(1.0)) ^ Float32(2.0) tmp = Float32(0.0) if (t_0 <= Float32(-0.4000000059604645)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.20000000298023224)) tmp = copysign(Float32(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x)) + fma(Float32(-0.041666666666666664), Float32((x ^ Float32(4.0)) * Float32(Float32(Float32(3.0) / Float32(x + Float32(1.0))) + Float32(Float32(3.0) / t_1))), Float32((x ^ Float32(6.0)) * Float32(Float32(Float32(Float32(30.0) / (Float32(x + Float32(1.0)) ^ Float32(3.0))) + Float32(Float32(Float32(45.0) / t_1) + Float32(Float32(45.0) / Float32(x + Float32(1.0))))) * Float32(0.001388888888888889))))), 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 + 1\right)}^{2}\\
\mathbf{if}\;t_0 \leq -0.4000000059604645:\\
\;\;\;\;\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(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right) + \mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{x + 1} + \frac{3}{t_1}\right), {x}^{6} \cdot \left(\left(\frac{30}{{\left(x + 1\right)}^{3}} + \left(\frac{45}{t_1} + \frac{45}{x + 1}\right)\right) \cdot 0.001388888888888889\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.400000006Initial program 49.1%
+-commutative49.1%
hypot-1-def99.9%
Simplified99.9%
flip-+9.9%
frac-2neg9.9%
log-div9.9%
Applied egg-rr14.4%
sub-neg14.4%
sub-neg14.4%
fma-udef14.4%
unpow214.4%
associate--r+45.6%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
neg-sub099.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
if -0.400000006 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.200000003Initial program 22.7%
+-commutative22.7%
hypot-1-def22.8%
Simplified22.8%
Taylor expanded in x around 0 23.4%
Simplified99.9%
if 0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 64.9%
+-commutative64.9%
hypot-1-def100.0%
Simplified100.0%
*-un-lft-identity100.0%
*-commutative100.0%
log-prod100.0%
*-un-lft-identity100.0%
*-un-lft-identity100.0%
add-sqr-sqrt99.7%
fabs-sqr99.7%
add-sqr-sqrt100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-rgt-identity100.0%
Simplified100.0%
Final simplification99.9%
(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.4000000059604645)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.05000000074505806)
(copysign
(+
(log1p (fabs x))
(fma
0.5
(/ (pow x 2.0) t_1)
(*
-0.041666666666666664
(* (pow x 4.0) (+ (/ 3.0 t_1) (/ 3.0 (pow t_1 2.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.4000000059604645f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (t_0 <= 0.05000000074505806f) {
tmp = copysignf((log1pf(fabsf(x)) + fmaf(0.5f, (powf(x, 2.0f) / t_1), (-0.041666666666666664f * (powf(x, 4.0f) * ((3.0f / t_1) + (3.0f / powf(t_1, 2.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.4000000059604645)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.05000000074505806)) tmp = copysign(Float32(log1p(abs(x)) + fma(Float32(0.5), Float32((x ^ Float32(2.0)) / t_1), Float32(Float32(-0.041666666666666664) * Float32((x ^ Float32(4.0)) * Float32(Float32(Float32(3.0) / t_1) + Float32(Float32(3.0) / (t_1 ^ Float32(2.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.4000000059604645:\\
\;\;\;\;\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(\mathsf{log1p}\left(\left|x\right|\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{t_1}, -0.041666666666666664 \cdot \left({x}^{4} \cdot \left(\frac{3}{t_1} + \frac{3}{{t_1}^{2}}\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) < -0.400000006Initial program 49.1%
+-commutative49.1%
hypot-1-def99.9%
Simplified99.9%
flip-+9.9%
frac-2neg9.9%
log-div9.9%
Applied egg-rr14.4%
sub-neg14.4%
sub-neg14.4%
fma-udef14.4%
unpow214.4%
associate--r+45.6%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
neg-sub099.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
if -0.400000006 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.0500000007Initial program 22.2%
+-commutative22.2%
hypot-1-def22.2%
Simplified22.2%
Taylor expanded in x around 0 22.9%
log1p-def100.0%
+-commutative100.0%
fma-def100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if 0.0500000007 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 65.3%
+-commutative65.3%
hypot-1-def99.9%
Simplified99.9%
*-un-lft-identity99.9%
*-commutative99.9%
log-prod99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt99.6%
fabs-sqr99.6%
add-sqr-sqrt99.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 -0.4000000059604645)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.05000000074505806)
(copysign
(+
(fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x))
(*
(pow x 4.0)
(*
-0.041666666666666664
(+ (/ 3.0 (+ x 1.0)) (/ 3.0 (pow (+ x 1.0) 2.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.4000000059604645f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (t_0 <= 0.05000000074505806f) {
tmp = copysignf((fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x)) + (powf(x, 4.0f) * (-0.041666666666666664f * ((3.0f / (x + 1.0f)) + (3.0f / powf((x + 1.0f), 2.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.4000000059604645)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.05000000074505806)) tmp = copysign(Float32(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x)) + Float32((x ^ Float32(4.0)) * Float32(Float32(-0.041666666666666664) * Float32(Float32(Float32(3.0) / Float32(x + Float32(1.0))) + Float32(Float32(3.0) / (Float32(x + Float32(1.0)) ^ Float32(2.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.4000000059604645:\\
\;\;\;\;\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(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right) + {x}^{4} \cdot \left(-0.041666666666666664 \cdot \left(\frac{3}{x + 1} + \frac{3}{{\left(x + 1\right)}^{2}}\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.400000006Initial program 49.1%
+-commutative49.1%
hypot-1-def99.9%
Simplified99.9%
flip-+9.9%
frac-2neg9.9%
log-div9.9%
Applied egg-rr14.4%
sub-neg14.4%
sub-neg14.4%
fma-udef14.4%
unpow214.4%
associate--r+45.6%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
neg-sub099.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
if -0.400000006 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.0500000007Initial program 22.2%
+-commutative22.2%
hypot-1-def22.2%
Simplified22.2%
Taylor expanded in x around 0 22.9%
+-commutative22.9%
associate-+r+22.9%
Simplified99.9%
if 0.0500000007 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 65.3%
+-commutative65.3%
hypot-1-def99.9%
Simplified99.9%
*-un-lft-identity99.9%
*-commutative99.9%
log-prod99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt99.6%
fabs-sqr99.6%
add-sqr-sqrt99.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 -0.03999999910593033)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.019999999552965164)
(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.03999999910593033f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (t_0 <= 0.019999999552965164f) {
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.03999999910593033)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.019999999552965164)) 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.03999999910593033:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.019999999552965164:\\
\;\;\;\;\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.0399999991Initial program 49.8%
+-commutative49.8%
hypot-1-def99.8%
Simplified99.8%
flip-+11.3%
frac-2neg11.3%
log-div11.3%
Applied egg-rr15.7%
sub-neg15.7%
sub-neg15.7%
fma-udef15.7%
unpow215.7%
associate--r+46.4%
+-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
neg-sub099.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
if -0.0399999991 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.0199999996Initial program 21.2%
+-commutative21.2%
hypot-1-def21.2%
Simplified21.2%
Taylor expanded in x around 0 21.9%
+-commutative21.9%
fma-def21.9%
rem-square-sqrt11.2%
fabs-sqr11.2%
rem-square-sqrt22.0%
log1p-def99.6%
rem-square-sqrt43.9%
fabs-sqr43.9%
rem-square-sqrt99.8%
Simplified99.8%
if 0.0199999996 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 65.6%
+-commutative65.6%
hypot-1-def99.6%
Simplified99.6%
*-un-lft-identity99.6%
*-commutative99.6%
log-prod99.6%
*-un-lft-identity99.6%
*-un-lft-identity99.6%
add-sqr-sqrt99.4%
fabs-sqr99.4%
add-sqr-sqrt99.6%
metadata-eval99.6%
Applied egg-rr99.6%
+-rgt-identity99.6%
Simplified99.6%
Final simplification99.7%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.03999999910593033)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.0010000000474974513)
(copysign x x)
(copysign (log (+ (fabs 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.03999999910593033f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (t_0 <= 0.0010000000474974513f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((fabsf(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.03999999910593033)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.0010000000474974513)) tmp = copysign(x, x); else tmp = copysign(log(Float32(abs(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.03999999910593033)) tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x))); elseif (t_0 <= single(0.0010000000474974513)) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((abs(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.03999999910593033:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.0010000000474974513:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \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.0399999991Initial program 49.8%
+-commutative49.8%
hypot-1-def99.8%
Simplified99.8%
flip-+11.3%
frac-2neg11.3%
log-div11.3%
Applied egg-rr15.7%
sub-neg15.7%
sub-neg15.7%
fma-udef15.7%
unpow215.7%
associate--r+46.4%
+-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
neg-sub099.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
if -0.0399999991 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.00100000005Initial program 19.8%
+-commutative19.8%
hypot-1-def19.8%
Simplified19.8%
Taylor expanded in x around 0 19.3%
log1p-def96.4%
rem-square-sqrt41.0%
fabs-sqr41.0%
rem-square-sqrt96.4%
Simplified96.4%
Taylor expanded in x around 0 99.8%
if 0.00100000005 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 66.4%
+-commutative66.4%
hypot-1-def99.0%
Simplified99.0%
Final simplification99.6%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= x 0.05000000074505806)
(copysign (* 0.3333333333333333 (+ (* -0.5 (pow x 3.0)) (* x 3.0))) x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (x <= 0.05000000074505806f) {
tmp = copysignf((0.3333333333333333f * ((-0.5f * powf(x, 3.0f)) + (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(-2.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (x <= Float32(0.05000000074505806)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(Float32(-0.5) * (x ^ Float32(3.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) tmp = single(0.0); if (x <= single(-2.0)) tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x)))); elseif (x <= single(0.05000000074505806)) tmp = sign(x) * abs((single(0.3333333333333333) * ((single(-0.5) * (x ^ single(3.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}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(-0.5 \cdot {x}^{3} + x \cdot 3\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 < -2Initial program 47.3%
+-commutative47.3%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.3%
sub-neg99.3%
mul-1-neg99.3%
unsub-neg99.3%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt98.1%
associate-*r/98.1%
metadata-eval98.1%
distribute-neg-frac98.1%
metadata-eval98.1%
Simplified98.1%
if -2 < x < 0.0500000007Initial program 23.3%
+-commutative23.3%
hypot-1-def23.4%
Simplified23.4%
add-cbrt-cube23.3%
pow1/323.4%
log-pow23.4%
pow323.3%
log-pow23.3%
*-un-lft-identity23.3%
*-un-lft-identity23.3%
add-sqr-sqrt11.3%
fabs-sqr11.3%
add-sqr-sqrt23.5%
Applied egg-rr23.5%
Taylor expanded in x around 0 98.3%
if 0.0500000007 < x Initial program 65.3%
+-commutative65.3%
hypot-1-def99.9%
Simplified99.9%
*-un-lft-identity99.9%
*-commutative99.9%
log-prod99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt99.6%
fabs-sqr99.6%
add-sqr-sqrt99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-rgt-identity99.9%
Simplified99.9%
Final simplification98.6%
(FPCore (x)
:precision binary32
(if (<= x -0.03999999910593033)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= x 0.0010000000474974513)
(copysign x x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -0.03999999910593033f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (x <= 0.0010000000474974513f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-0.03999999910593033)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (x <= Float32(0.0010000000474974513)) tmp = copysign(x, 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.03999999910593033)) tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x))); elseif (x <= single(0.0010000000474974513)) tmp = sign(x) * abs(x); 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.03999999910593033:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;x \leq 0.0010000000474974513:\\
\;\;\;\;\mathsf{copysign}\left(x, 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.0399999991Initial program 49.8%
+-commutative49.8%
hypot-1-def99.8%
Simplified99.8%
flip-+11.3%
frac-2neg11.3%
log-div11.3%
Applied egg-rr15.7%
sub-neg15.7%
sub-neg15.7%
fma-udef15.7%
unpow215.7%
associate--r+46.4%
+-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
neg-sub099.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
if -0.0399999991 < x < 0.00100000005Initial program 19.8%
+-commutative19.8%
hypot-1-def19.8%
Simplified19.8%
Taylor expanded in x around 0 19.3%
log1p-def96.4%
rem-square-sqrt41.0%
fabs-sqr41.0%
rem-square-sqrt96.4%
Simplified96.4%
Taylor expanded in x around 0 99.8%
if 0.00100000005 < x Initial program 66.4%
+-commutative66.4%
hypot-1-def99.0%
Simplified99.0%
*-un-lft-identity99.0%
*-commutative99.0%
log-prod99.0%
*-un-lft-identity99.0%
*-un-lft-identity99.0%
add-sqr-sqrt98.8%
fabs-sqr98.8%
add-sqr-sqrt99.0%
metadata-eval99.0%
Applied egg-rr99.0%
+-rgt-identity99.0%
Simplified99.0%
Final simplification99.6%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= x 1.0)
(copysign
(* 0.3333333333333333 (* 3.0 (+ x (* (pow x 3.0) -0.16666666666666666))))
x)
(copysign (log (+ (+ x x) (/ 0.5 x))) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (x <= 1.0f) {
tmp = copysignf((0.3333333333333333f * (3.0f * (x + (powf(x, 3.0f) * -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf(((x + x) + (0.5f / x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (x <= Float32(1.0)) 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(x + x) + Float32(Float32(0.5) / x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-2.0)) tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x)))); elseif (x <= single(1.0)) 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 + x) + (single(0.5) / x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\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(\left(x + x\right) + \frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 47.3%
+-commutative47.3%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.3%
sub-neg99.3%
mul-1-neg99.3%
unsub-neg99.3%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt98.1%
associate-*r/98.1%
metadata-eval98.1%
distribute-neg-frac98.1%
metadata-eval98.1%
Simplified98.1%
if -2 < x < 1Initial program 24.9%
+-commutative24.9%
hypot-1-def25.0%
Simplified25.0%
add-cbrt-cube24.9%
pow1/325.0%
log-pow25.0%
pow324.9%
log-pow25.0%
*-un-lft-identity25.0%
*-un-lft-identity25.0%
add-sqr-sqrt13.2%
fabs-sqr13.2%
add-sqr-sqrt25.1%
Applied egg-rr25.1%
Taylor expanded in x around 0 97.3%
*-commutative97.3%
Simplified97.3%
if 1 < x Initial program 63.8%
+-commutative63.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 99.6%
rem-square-sqrt99.4%
fabs-sqr99.4%
rem-square-sqrt99.6%
associate-+r+99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification98.0%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (+ (- x x) (/ -0.5 x))) x)
(if (<= x 1.0)
(copysign (* 0.3333333333333333 (+ (* -0.5 (pow x 3.0)) (* x 3.0))) x)
(copysign (log (+ (+ x x) (/ 0.5 x))) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (x <= 1.0f) {
tmp = copysignf((0.3333333333333333f * ((-0.5f * powf(x, 3.0f)) + (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(-2.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(Float32(-0.5) * (x ^ Float32(3.0))) + Float32(x * Float32(3.0)))), x); else tmp = copysign(log(Float32(Float32(x + x) + Float32(Float32(0.5) / x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-2.0)) tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x)))); elseif (x <= single(1.0)) tmp = sign(x) * abs((single(0.3333333333333333) * ((single(-0.5) * (x ^ single(3.0))) + (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 -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(-0.5 \cdot {x}^{3} + x \cdot 3\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x + x\right) + \frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 47.3%
+-commutative47.3%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.3%
sub-neg99.3%
mul-1-neg99.3%
unsub-neg99.3%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt98.1%
associate-*r/98.1%
metadata-eval98.1%
distribute-neg-frac98.1%
metadata-eval98.1%
Simplified98.1%
if -2 < x < 1Initial program 24.9%
+-commutative24.9%
hypot-1-def25.0%
Simplified25.0%
add-cbrt-cube24.9%
pow1/325.0%
log-pow25.0%
pow324.9%
log-pow25.0%
*-un-lft-identity25.0%
*-un-lft-identity25.0%
add-sqr-sqrt13.2%
fabs-sqr13.2%
add-sqr-sqrt25.1%
Applied egg-rr25.1%
Taylor expanded in x around 0 97.3%
if 1 < x Initial program 63.8%
+-commutative63.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 99.6%
rem-square-sqrt99.4%
fabs-sqr99.4%
rem-square-sqrt99.6%
associate-+r+99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification98.0%
(FPCore (x) :precision binary32 (if (<= x -20.0) (copysign (log (- x)) x) (if (<= x 1.0) (copysign x x) (copysign (log (+ (+ x x) (/ 0.5 x))) x))))
float code(float x) {
float tmp;
if (x <= -20.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 1.0f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf(((x + x) + (0.5f / x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-20.0)) tmp = copysign(log(Float32(-x)), x); elseif (x <= Float32(1.0)) tmp = copysign(x, x); else tmp = copysign(log(Float32(Float32(x + x) + Float32(Float32(0.5) / x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-20.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) + (single(0.5) / x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -20:\\
\;\;\;\;\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(\left(x + x\right) + \frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -20Initial program 46.3%
+-commutative46.3%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.9%
mul-1-neg44.9%
Simplified44.9%
if -20 < x < 1Initial program 25.4%
+-commutative25.4%
hypot-1-def25.5%
Simplified25.5%
Taylor expanded in x around 0 21.0%
log1p-def92.0%
rem-square-sqrt39.9%
fabs-sqr39.9%
rem-square-sqrt91.7%
Simplified91.7%
Taylor expanded in x around 0 96.2%
if 1 < x Initial program 63.8%
+-commutative63.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 99.6%
rem-square-sqrt99.4%
fabs-sqr99.4%
rem-square-sqrt99.6%
associate-+r+99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification86.2%
(FPCore (x) :precision binary32 (if (<= x -2.0) (copysign (log (+ (- x x) (/ -0.5 x))) x) (if (<= x 1.0) (copysign x x) (copysign (log (+ (+ x x) (/ 0.5 x))) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
} else if (x <= 1.0f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf(((x + x) + (0.5f / x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x); elseif (x <= Float32(1.0)) tmp = copysign(x, x); else tmp = copysign(log(Float32(Float32(x + x) + Float32(Float32(0.5) / x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-2.0)) tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x)))); elseif (x <= single(1.0)) tmp = sign(x) * abs(x); 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 -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \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(\left(x + x\right) + \frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 47.3%
+-commutative47.3%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.3%
sub-neg99.3%
mul-1-neg99.3%
unsub-neg99.3%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt98.1%
associate-*r/98.1%
metadata-eval98.1%
distribute-neg-frac98.1%
metadata-eval98.1%
Simplified98.1%
if -2 < x < 1Initial program 24.9%
+-commutative24.9%
hypot-1-def25.0%
Simplified25.0%
Taylor expanded in x around 0 20.9%
log1p-def92.4%
rem-square-sqrt40.2%
fabs-sqr40.2%
rem-square-sqrt92.3%
Simplified92.3%
Taylor expanded in x around 0 96.7%
if 1 < x Initial program 63.8%
+-commutative63.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 99.6%
rem-square-sqrt99.4%
fabs-sqr99.4%
rem-square-sqrt99.6%
associate-+r+99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification97.7%
(FPCore (x) :precision binary32 (if (<= x -20.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 <= -20.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(-20.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(-20.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 -20:\\
\;\;\;\;\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 < -20Initial program 46.3%
+-commutative46.3%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.9%
mul-1-neg44.9%
Simplified44.9%
if -20 < x < 1Initial program 25.4%
+-commutative25.4%
hypot-1-def25.5%
Simplified25.5%
Taylor expanded in x around 0 21.0%
log1p-def92.0%
rem-square-sqrt39.9%
fabs-sqr39.9%
rem-square-sqrt91.7%
Simplified91.7%
Taylor expanded in x around 0 96.2%
if 1 < x Initial program 63.8%
+-commutative63.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 96.4%
rem-square-sqrt96.2%
fabs-sqr96.2%
rem-square-sqrt96.4%
Simplified96.4%
Final simplification85.4%
(FPCore (x) :precision binary32 (if (<= x -2.0) (copysign (log (- x)) x) (copysign (log1p x) x)))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(-x), x);
} else {
tmp = copysignf(log1pf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.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 -2:\\
\;\;\;\;\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 < -2Initial program 47.3%
+-commutative47.3%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.7%
mul-1-neg44.7%
Simplified44.7%
if -2 < x Initial program 36.9%
+-commutative36.9%
hypot-1-def48.1%
Simplified48.1%
Taylor expanded in x around 0 27.6%
log1p-def77.1%
rem-square-sqrt41.0%
fabs-sqr41.0%
rem-square-sqrt77.0%
Simplified77.0%
Final simplification70.1%
(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 31.3%
+-commutative31.3%
hypot-1-def46.2%
Simplified46.2%
Taylor expanded in x around 0 27.7%
log1p-def78.9%
rem-square-sqrt28.8%
fabs-sqr28.8%
rem-square-sqrt66.2%
Simplified66.2%
Taylor expanded in x around 0 72.3%
if 1 < x Initial program 63.8%
+-commutative63.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 42.7%
log1p-def42.7%
rem-square-sqrt42.7%
fabs-sqr42.7%
rem-square-sqrt42.7%
Simplified42.7%
Final simplification65.1%
(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 39.1%
+-commutative39.1%
hypot-1-def59.3%
Simplified59.3%
Taylor expanded in x around 0 31.3%
log1p-def70.1%
rem-square-sqrt32.2%
fabs-sqr32.2%
rem-square-sqrt60.5%
Simplified60.5%
Taylor expanded in x around 0 57.9%
Final simplification57.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 2023319
(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))