
(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))
(t_1 (+ (fabs x) 1.0)))
(if (<= t_0 -0.5)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)
(if (<= t_0 0.05000000074505806)
(copysign
(+
(log1p (fabs x))
(fma
-0.041666666666666664
(* (pow x 4.0) (+ (/ 3.0 t_1) (/ 3.0 (pow t_1 2.0))))
(* 0.5 (/ (pow x 2.0) t_1))))
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.5f) {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
} else if (t_0 <= 0.05000000074505806f) {
tmp = copysignf((log1pf(fabsf(x)) + fmaf(-0.041666666666666664f, (powf(x, 4.0f) * ((3.0f / t_1) + (3.0f / powf(t_1, 2.0f)))), (0.5f * (powf(x, 2.0f) / t_1)))), 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.5)) tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); elseif (t_0 <= Float32(0.05000000074505806)) tmp = copysign(Float32(log1p(abs(x)) + fma(Float32(-0.041666666666666664), Float32((x ^ Float32(4.0)) * Float32(Float32(Float32(3.0) / t_1) + Float32(Float32(3.0) / (t_1 ^ Float32(2.0))))), Float32(Float32(0.5) * Float32((x ^ Float32(2.0)) / t_1)))), 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.5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right|\right) + \mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{t_1} + \frac{3}{{t_1}^{2}}\right), 0.5 \cdot \frac{{x}^{2}}{t_1}\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.5Initial program 58.7%
+-commutative58.7%
hypot-1-def100.0%
Simplified100.0%
if -0.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.0500000007Initial program 18.4%
Taylor expanded in x around 0 19.4%
log1p-def99.9%
fma-def99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
if 0.0500000007 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 52.5%
*-un-lft-identity52.5%
*-commutative52.5%
log-prod52.5%
+-commutative52.5%
hypot-1-def98.6%
add-sqr-sqrt98.6%
fabs-sqr98.6%
add-sqr-sqrt98.6%
metadata-eval98.6%
Applied egg-rr98.6%
+-rgt-identity98.6%
Simplified98.6%
Final simplification99.5%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.03999999910593033)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)
(if (<= t_0 0.019999999552965164)
(copysign
(+ (log1p (fabs x)) (* 0.5 (/ (pow x 2.0) (+ (fabs x) 1.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.03999999910593033f) {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
} else if (t_0 <= 0.019999999552965164f) {
tmp = copysignf((log1pf(fabsf(x)) + (0.5f * (powf(x, 2.0f) / (fabsf(x) + 1.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.03999999910593033)) tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); elseif (t_0 <= Float32(0.019999999552965164)) tmp = copysign(Float32(log1p(abs(x)) + Float32(Float32(0.5) * Float32((x ^ Float32(2.0)) / Float32(abs(x) + Float32(1.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.03999999910593033:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.019999999552965164:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right|\right) + 0.5 \cdot \frac{{x}^{2}}{\left|x\right| + 1}, 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 59.2%
+-commutative59.2%
hypot-1-def99.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 17.1%
Taylor expanded in x around 0 18.1%
log1p-def99.7%
Simplified99.7%
if 0.0199999996 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 52.9%
*-un-lft-identity52.9%
*-commutative52.9%
log-prod52.9%
+-commutative52.9%
hypot-1-def98.4%
add-sqr-sqrt98.4%
fabs-sqr98.4%
add-sqr-sqrt98.4%
metadata-eval98.4%
Applied egg-rr98.4%
+-rgt-identity98.4%
Simplified98.4%
Final simplification99.3%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.009999999776482582)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)
(if (<= t_0 0.019999999552965164)
(copysign (+ (log1p (fabs x)) (* 0.5 (* x (/ x (+ x 1.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.009999999776482582f) {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
} else if (t_0 <= 0.019999999552965164f) {
tmp = copysignf((log1pf(fabsf(x)) + (0.5f * (x * (x / (x + 1.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.009999999776482582)) tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); elseif (t_0 <= Float32(0.019999999552965164)) tmp = copysign(Float32(log1p(abs(x)) + Float32(Float32(0.5) * Float32(x * Float32(x / Float32(x + Float32(1.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.009999999776482582:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0.019999999552965164:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right|\right) + 0.5 \cdot \left(x \cdot \frac{x}{x + 1}\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.00999999978Initial program 59.9%
+-commutative59.9%
hypot-1-def99.5%
Simplified99.5%
if -0.00999999978 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.0199999996Initial program 15.8%
Taylor expanded in x around 0 16.7%
log1p-def99.8%
Simplified99.8%
unpow299.8%
*-un-lft-identity99.8%
times-frac99.8%
add-sqr-sqrt53.1%
fabs-sqr53.1%
add-sqr-sqrt99.8%
+-commutative99.8%
Applied egg-rr99.8%
if 0.0199999996 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 52.9%
*-un-lft-identity52.9%
*-commutative52.9%
log-prod52.9%
+-commutative52.9%
hypot-1-def98.4%
add-sqr-sqrt98.4%
fabs-sqr98.4%
add-sqr-sqrt98.4%
metadata-eval98.4%
Applied egg-rr98.4%
+-rgt-identity98.4%
Simplified98.4%
Final simplification99.3%
(FPCore (x)
:precision binary32
(if (<= x -0.009999999776482582)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= x 0.019999999552965164)
(copysign (+ (log1p (fabs x)) (* 0.5 (* x (/ x (+ x 1.0))))) x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -0.009999999776482582f) {
tmp = copysignf(logf((1.0f / (hypotf(1.0f, x) - x))), x);
} else if (x <= 0.019999999552965164f) {
tmp = copysignf((log1pf(fabsf(x)) + (0.5f * (x * (x / (x + 1.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.009999999776482582)) tmp = copysign(log(Float32(Float32(1.0) / Float32(hypot(Float32(1.0), x) - x))), x); elseif (x <= Float32(0.019999999552965164)) tmp = copysign(Float32(log1p(abs(x)) + Float32(Float32(0.5) * Float32(x * Float32(x / Float32(x + Float32(1.0)))))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.009999999776482582:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.019999999552965164:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right|\right) + 0.5 \cdot \left(x \cdot \frac{x}{x + 1}\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 < -0.00999999978Initial program 59.9%
add-cbrt-cube42.8%
pow1/342.4%
log-pow42.3%
pow342.4%
log-pow59.4%
+-commutative59.4%
hypot-1-def98.4%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt20.1%
Applied egg-rr20.1%
flip-+19.1%
unpow219.1%
div-sub17.1%
hypot-udef17.2%
metadata-eval17.2%
unpow217.2%
hypot-udef17.0%
metadata-eval17.0%
unpow217.0%
add-sqr-sqrt17.3%
+-commutative17.3%
Applied egg-rr17.3%
div-sub20.1%
associate--r+56.5%
+-inverses98.3%
metadata-eval98.3%
metadata-eval98.3%
metadata-eval98.3%
metadata-eval98.3%
+-inverses56.5%
associate--r+20.1%
associate-/r*20.1%
neg-mul-120.1%
neg-mul-120.1%
associate--r+56.5%
+-inverses98.3%
metadata-eval98.3%
metadata-eval98.3%
neg-sub098.3%
associate--r-98.3%
neg-sub098.3%
+-commutative98.3%
sub-neg98.3%
Simplified98.3%
associate-*r*99.3%
metadata-eval99.3%
*-un-lft-identity99.3%
Applied egg-rr99.3%
if -0.00999999978 < x < 0.0199999996Initial program 15.8%
Taylor expanded in x around 0 16.7%
log1p-def99.8%
Simplified99.8%
unpow299.8%
*-un-lft-identity99.8%
times-frac99.8%
add-sqr-sqrt53.1%
fabs-sqr53.1%
add-sqr-sqrt99.8%
+-commutative99.8%
Applied egg-rr99.8%
if 0.0199999996 < x Initial program 52.9%
*-un-lft-identity52.9%
*-commutative52.9%
log-prod52.9%
+-commutative52.9%
hypot-1-def98.4%
add-sqr-sqrt98.4%
fabs-sqr98.4%
add-sqr-sqrt98.4%
metadata-eval98.4%
Applied egg-rr98.4%
+-rgt-identity98.4%
Simplified98.4%
Final simplification99.2%
(FPCore (x)
:precision binary32
(if (<= x -1.0)
(copysign
(* 0.3333333333333333 (* 3.0 (log (/ 1.0 (- (* x -2.0) (/ 0.5 x))))))
x)
(if (<= x 0.05000000074505806)
(copysign
(* 0.3333333333333333 (* 3.0 (+ x (* (pow x 3.0) -0.16666666666666666))))
x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -1.0f) {
tmp = copysignf((0.3333333333333333f * (3.0f * logf((1.0f / ((x * -2.0f) - (0.5f / x)))))), x);
} else if (x <= 0.05000000074505806f) {
tmp = copysignf((0.3333333333333333f * (3.0f * (x + (powf(x, 3.0f) * -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-1.0)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(3.0) * log(Float32(Float32(1.0) / Float32(Float32(x * Float32(-2.0)) - Float32(Float32(0.5) / x)))))), x); elseif (x <= Float32(0.05000000074505806)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(3.0) * Float32(x + Float32((x ^ Float32(3.0)) * Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-1.0)) tmp = sign(x) * abs((single(0.3333333333333333) * (single(3.0) * log((single(1.0) / ((x * single(-2.0)) - (single(0.5) / x))))))); elseif (x <= single(0.05000000074505806)) tmp = sign(x) * abs((single(0.3333333333333333) * (single(3.0) * (x + ((x ^ single(3.0)) * single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((x + hypot(single(1.0), x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\frac{1}{x \cdot -2 - \frac{0.5}{x}}\right)\right), x\right)\\
\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if x < -1Initial program 58.1%
add-cbrt-cube40.0%
pow1/339.5%
log-pow39.3%
pow339.4%
log-pow57.5%
+-commutative57.5%
hypot-1-def98.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.9%
Applied egg-rr15.9%
flip-+14.9%
unpow214.9%
div-sub12.8%
hypot-udef12.9%
metadata-eval12.9%
unpow212.9%
hypot-udef12.7%
metadata-eval12.7%
unpow212.7%
add-sqr-sqrt13.1%
+-commutative13.1%
Applied egg-rr13.1%
div-sub16.0%
associate--r+54.6%
+-inverses98.9%
metadata-eval98.9%
metadata-eval98.9%
metadata-eval98.9%
metadata-eval98.9%
+-inverses54.6%
associate--r+16.0%
associate-/r*16.0%
neg-mul-116.0%
neg-mul-116.0%
associate--r+54.6%
+-inverses98.9%
metadata-eval98.9%
metadata-eval98.9%
neg-sub098.9%
associate--r-98.9%
neg-sub098.9%
+-commutative98.9%
sub-neg98.9%
Simplified98.9%
Taylor expanded in x around -inf 97.4%
*-commutative97.4%
associate-*r/97.4%
metadata-eval97.4%
Simplified97.4%
if -1 < x < 0.0500000007Initial program 19.1%
add-cbrt-cube19.1%
pow1/319.1%
log-pow19.2%
pow319.3%
log-pow19.1%
+-commutative19.1%
hypot-1-def19.1%
add-sqr-sqrt9.6%
fabs-sqr9.6%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
Taylor expanded in x around 0 98.3%
*-commutative98.3%
Simplified98.3%
if 0.0500000007 < x Initial program 52.5%
*-un-lft-identity52.5%
*-commutative52.5%
log-prod52.5%
+-commutative52.5%
hypot-1-def98.6%
add-sqr-sqrt98.6%
fabs-sqr98.6%
add-sqr-sqrt98.6%
metadata-eval98.6%
Applied egg-rr98.6%
+-rgt-identity98.6%
Simplified98.6%
Final simplification98.2%
(FPCore (x)
:precision binary32
(if (<= x -0.009999999776482582)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= x 0.0005000000237487257)
(copysign x x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -0.009999999776482582f) {
tmp = copysignf(logf((1.0f / (hypotf(1.0f, x) - x))), x);
} else if (x <= 0.0005000000237487257f) {
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.009999999776482582)) tmp = copysign(log(Float32(Float32(1.0) / Float32(hypot(Float32(1.0), x) - x))), x); elseif (x <= Float32(0.0005000000237487257)) 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.009999999776482582)) tmp = sign(x) * abs(log((single(1.0) / (hypot(single(1.0), x) - x)))); elseif (x <= single(0.0005000000237487257)) 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.009999999776482582:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.0005000000237487257:\\
\;\;\;\;\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.00999999978Initial program 59.9%
add-cbrt-cube42.8%
pow1/342.4%
log-pow42.3%
pow342.4%
log-pow59.4%
+-commutative59.4%
hypot-1-def98.4%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt20.1%
Applied egg-rr20.1%
flip-+19.1%
unpow219.1%
div-sub17.1%
hypot-udef17.2%
metadata-eval17.2%
unpow217.2%
hypot-udef17.0%
metadata-eval17.0%
unpow217.0%
add-sqr-sqrt17.3%
+-commutative17.3%
Applied egg-rr17.3%
div-sub20.1%
associate--r+56.5%
+-inverses98.3%
metadata-eval98.3%
metadata-eval98.3%
metadata-eval98.3%
metadata-eval98.3%
+-inverses56.5%
associate--r+20.1%
associate-/r*20.1%
neg-mul-120.1%
neg-mul-120.1%
associate--r+56.5%
+-inverses98.3%
metadata-eval98.3%
metadata-eval98.3%
neg-sub098.3%
associate--r-98.3%
neg-sub098.3%
+-commutative98.3%
sub-neg98.3%
Simplified98.3%
associate-*r*99.3%
metadata-eval99.3%
*-un-lft-identity99.3%
Applied egg-rr99.3%
if -0.00999999978 < x < 5.00000024e-4Initial program 14.4%
add-cbrt-cube14.4%
pow1/314.4%
log-pow14.4%
pow314.4%
log-pow14.4%
+-commutative14.4%
hypot-1-def14.4%
add-sqr-sqrt7.7%
fabs-sqr7.7%
add-sqr-sqrt14.7%
Applied egg-rr14.7%
Taylor expanded in x around 0 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 100.0%
if 5.00000024e-4 < x Initial program 53.7%
*-un-lft-identity53.7%
*-commutative53.7%
log-prod53.7%
+-commutative53.7%
hypot-1-def98.1%
add-sqr-sqrt98.1%
fabs-sqr98.1%
add-sqr-sqrt98.1%
metadata-eval98.1%
Applied egg-rr98.1%
+-rgt-identity98.1%
Simplified98.1%
Final simplification99.2%
(FPCore (x)
:precision binary32
(if (<= x -1.0)
(copysign
(* 0.3333333333333333 (* 3.0 (log (/ 1.0 (- (* x -2.0) (/ 0.5 x))))))
x)
(if (<= x 2.0)
(copysign
(* 0.3333333333333333 (* 3.0 (+ x (* (pow x 3.0) -0.16666666666666666))))
x)
(copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -1.0f) {
tmp = copysignf((0.3333333333333333f * (3.0f * logf((1.0f / ((x * -2.0f) - (0.5f / x)))))), x);
} else if (x <= 2.0f) {
tmp = copysignf((0.3333333333333333f * (3.0f * (x + (powf(x, 3.0f) * -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((0.5f / x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-1.0)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(3.0) * log(Float32(Float32(1.0) / Float32(Float32(x * Float32(-2.0)) - Float32(Float32(0.5) / x)))))), x); elseif (x <= Float32(2.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(0.5) / x)), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-1.0)) tmp = sign(x) * abs((single(0.3333333333333333) * (single(3.0) * log((single(1.0) / ((x * single(-2.0)) - (single(0.5) / x))))))); elseif (x <= single(2.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((single(0.5) / x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\frac{1}{x \cdot -2 - \frac{0.5}{x}}\right)\right), x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -1Initial program 58.1%
add-cbrt-cube40.0%
pow1/339.5%
log-pow39.3%
pow339.4%
log-pow57.5%
+-commutative57.5%
hypot-1-def98.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.9%
Applied egg-rr15.9%
flip-+14.9%
unpow214.9%
div-sub12.8%
hypot-udef12.9%
metadata-eval12.9%
unpow212.9%
hypot-udef12.7%
metadata-eval12.7%
unpow212.7%
add-sqr-sqrt13.1%
+-commutative13.1%
Applied egg-rr13.1%
div-sub16.0%
associate--r+54.6%
+-inverses98.9%
metadata-eval98.9%
metadata-eval98.9%
metadata-eval98.9%
metadata-eval98.9%
+-inverses54.6%
associate--r+16.0%
associate-/r*16.0%
neg-mul-116.0%
neg-mul-116.0%
associate--r+54.6%
+-inverses98.9%
metadata-eval98.9%
metadata-eval98.9%
neg-sub098.9%
associate--r-98.9%
neg-sub098.9%
+-commutative98.9%
sub-neg98.9%
Simplified98.9%
Taylor expanded in x around -inf 97.4%
*-commutative97.4%
associate-*r/97.4%
metadata-eval97.4%
Simplified97.4%
if -1 < x < 2Initial program 23.2%
add-cbrt-cube23.2%
pow1/323.2%
log-pow23.3%
pow323.3%
log-pow23.2%
+-commutative23.2%
hypot-1-def23.2%
add-sqr-sqrt14.1%
fabs-sqr14.1%
add-sqr-sqrt23.5%
Applied egg-rr23.5%
Taylor expanded in x around 0 95.9%
*-commutative95.9%
Simplified95.9%
if 2 < x Initial program 48.7%
add-cbrt-cube37.2%
pow1/336.9%
log-pow37.0%
pow337.0%
log-pow48.3%
+-commutative48.3%
hypot-1-def97.9%
add-sqr-sqrt97.9%
fabs-sqr97.9%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 97.7%
Taylor expanded in x around 0 98.4%
mul-1-neg98.4%
log-rec98.5%
log-prod99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification97.2%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (* 0.3333333333333333 (* 3.0 (log (/ -0.5 x)))) x)
(if (<= x 2.0)
(copysign
(* 0.3333333333333333 (* 3.0 (+ x (* (pow x 3.0) -0.16666666666666666))))
x)
(copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf((0.3333333333333333f * (3.0f * logf((-0.5f / x)))), x);
} else if (x <= 2.0f) {
tmp = copysignf((0.3333333333333333f * (3.0f * (x + (powf(x, 3.0f) * -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((0.5f / x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(3.0) * log(Float32(Float32(-0.5) / x)))), x); elseif (x <= Float32(2.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(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((single(0.3333333333333333) * (single(3.0) * log((single(-0.5) / x))))); elseif (x <= single(2.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((single(0.5) / x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\frac{-0.5}{x}\right)\right), x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 57.5%
add-cbrt-cube39.1%
pow1/338.6%
log-pow38.4%
pow338.5%
log-pow56.9%
+-commutative56.9%
hypot-1-def98.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt14.7%
Applied egg-rr14.7%
Taylor expanded in x around -inf 96.0%
if -2 < x < 2Initial program 23.9%
add-cbrt-cube23.9%
pow1/323.9%
log-pow23.9%
pow324.0%
log-pow23.8%
+-commutative23.8%
hypot-1-def23.8%
add-sqr-sqrt14.0%
fabs-sqr14.0%
add-sqr-sqrt24.1%
Applied egg-rr24.1%
Taylor expanded in x around 0 95.4%
*-commutative95.4%
Simplified95.4%
if 2 < x Initial program 48.7%
add-cbrt-cube37.2%
pow1/336.9%
log-pow37.0%
pow337.0%
log-pow48.3%
+-commutative48.3%
hypot-1-def97.9%
add-sqr-sqrt97.9%
fabs-sqr97.9%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 97.7%
Taylor expanded in x around 0 98.4%
mul-1-neg98.4%
log-rec98.5%
log-prod99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification96.6%
(FPCore (x) :precision binary32 (if (<= x -2.0) (copysign (* 0.3333333333333333 (* 3.0 (log (/ -0.5 x)))) x) (if (<= x 2.0) (copysign x x) (copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf((0.3333333333333333f * (3.0f * logf((-0.5f / x)))), x);
} else if (x <= 2.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(-2.0)) tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(3.0) * log(Float32(Float32(-0.5) / x)))), x); elseif (x <= Float32(2.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(-2.0)) tmp = sign(x) * abs((single(0.3333333333333333) * (single(3.0) * log((single(-0.5) / x))))); elseif (x <= single(2.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 -2:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\frac{-0.5}{x}\right)\right), x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\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 < -2Initial program 57.5%
add-cbrt-cube39.1%
pow1/338.6%
log-pow38.4%
pow338.5%
log-pow56.9%
+-commutative56.9%
hypot-1-def98.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt14.7%
Applied egg-rr14.7%
Taylor expanded in x around -inf 96.0%
if -2 < x < 2Initial program 23.9%
add-cbrt-cube23.9%
pow1/323.9%
log-pow23.9%
pow324.0%
log-pow23.8%
+-commutative23.8%
hypot-1-def23.8%
add-sqr-sqrt14.0%
fabs-sqr14.0%
add-sqr-sqrt24.1%
Applied egg-rr24.1%
Taylor expanded in x around 0 93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in x around 0 94.4%
if 2 < x Initial program 48.7%
add-cbrt-cube37.2%
pow1/336.9%
log-pow37.0%
pow337.0%
log-pow48.3%
+-commutative48.3%
hypot-1-def97.9%
add-sqr-sqrt97.9%
fabs-sqr97.9%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 97.7%
Taylor expanded in x around 0 98.4%
mul-1-neg98.4%
log-rec98.5%
log-prod99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification96.2%
(FPCore (x) :precision binary32 (if (<= x -2.0) (copysign (- (log (/ -1.0 x))) x) (if (<= x 2.0) (copysign x x) (copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(-logf((-1.0f / x)), x);
} else if (x <= 2.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(-2.0)) tmp = copysign(Float32(-log(Float32(Float32(-1.0) / x))), x); elseif (x <= Float32(2.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(-2.0)) tmp = sign(x) * abs(-log((single(-1.0) / x))); elseif (x <= single(2.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 -2:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\frac{-1}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\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 < -2Initial program 57.5%
Taylor expanded in x around -inf 43.7%
mul-1-neg43.7%
Simplified43.7%
if -2 < x < 2Initial program 23.9%
add-cbrt-cube23.9%
pow1/323.9%
log-pow23.9%
pow324.0%
log-pow23.8%
+-commutative23.8%
hypot-1-def23.8%
add-sqr-sqrt14.0%
fabs-sqr14.0%
add-sqr-sqrt24.1%
Applied egg-rr24.1%
Taylor expanded in x around 0 93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in x around 0 94.4%
if 2 < x Initial program 48.7%
add-cbrt-cube37.2%
pow1/336.9%
log-pow37.0%
pow337.0%
log-pow48.3%
+-commutative48.3%
hypot-1-def97.9%
add-sqr-sqrt97.9%
fabs-sqr97.9%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 97.7%
Taylor expanded in x around 0 98.4%
mul-1-neg98.4%
log-rec98.5%
log-prod99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification82.7%
(FPCore (x) :precision binary32 (if (<= x -2.0) (copysign (log (- x)) x) (if (<= x 2.0) (copysign x x) (copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 2.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(-2.0)) tmp = copysign(log(Float32(-x)), x); elseif (x <= Float32(2.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(-2.0)) tmp = sign(x) * abs(log(-x)); elseif (x <= single(2.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 -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\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 < -2Initial program 57.5%
Taylor expanded in x around -inf 43.7%
mul-1-neg43.7%
Simplified43.7%
frac-2neg43.7%
metadata-eval43.7%
log-div43.7%
metadata-eval43.7%
Applied egg-rr43.7%
neg-sub043.7%
Simplified43.7%
if -2 < x < 2Initial program 23.9%
add-cbrt-cube23.9%
pow1/323.9%
log-pow23.9%
pow324.0%
log-pow23.8%
+-commutative23.8%
hypot-1-def23.8%
add-sqr-sqrt14.0%
fabs-sqr14.0%
add-sqr-sqrt24.1%
Applied egg-rr24.1%
Taylor expanded in x around 0 93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in x around 0 94.4%
if 2 < x Initial program 48.7%
add-cbrt-cube37.2%
pow1/336.9%
log-pow37.0%
pow337.0%
log-pow48.3%
+-commutative48.3%
hypot-1-def97.9%
add-sqr-sqrt97.9%
fabs-sqr97.9%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 97.7%
Taylor expanded in x around 0 98.4%
mul-1-neg98.4%
log-rec98.5%
log-prod99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification82.7%
(FPCore (x) :precision binary32 (if (<= x 2.0) (copysign x x) (copysign (log (* x 2.0)) x)))
float code(float x) {
float tmp;
if (x <= 2.0f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((x * 2.0f)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(2.0)) 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(2.0)) 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 2:\\
\;\;\;\;\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 < 2Initial program 36.0%
add-cbrt-cube29.3%
pow1/329.2%
log-pow29.1%
pow329.2%
log-pow35.8%
+-commutative35.8%
hypot-1-def50.9%
add-sqr-sqrt8.9%
fabs-sqr8.9%
add-sqr-sqrt20.7%
Applied egg-rr20.7%
Taylor expanded in x around 0 64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in x around 0 64.6%
if 2 < x Initial program 48.7%
add-cbrt-cube37.2%
pow1/336.9%
log-pow37.0%
pow337.0%
log-pow48.3%
+-commutative48.3%
hypot-1-def97.9%
add-sqr-sqrt97.9%
fabs-sqr97.9%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 98.4%
+-commutative98.4%
log-prod97.9%
Simplified97.9%
Final simplification74.1%
(FPCore (x) :precision binary32 (if (<= x 2.0) (copysign x x) (copysign (log (/ 0.5 x)) x)))
float code(float x) {
float tmp;
if (x <= 2.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(2.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(2.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 2:\\
\;\;\;\;\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 < 2Initial program 36.0%
add-cbrt-cube29.3%
pow1/329.2%
log-pow29.1%
pow329.2%
log-pow35.8%
+-commutative35.8%
hypot-1-def50.9%
add-sqr-sqrt8.9%
fabs-sqr8.9%
add-sqr-sqrt20.7%
Applied egg-rr20.7%
Taylor expanded in x around 0 64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in x around 0 64.6%
if 2 < x Initial program 48.7%
add-cbrt-cube37.2%
pow1/336.9%
log-pow37.0%
pow337.0%
log-pow48.3%
+-commutative48.3%
hypot-1-def97.9%
add-sqr-sqrt97.9%
fabs-sqr97.9%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 97.7%
Taylor expanded in x around 0 98.4%
mul-1-neg98.4%
log-rec98.5%
log-prod99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification74.5%
(FPCore (x) :precision binary32 (if (<= x 2.0) (copysign x x) (copysign (log x) x)))
float code(float x) {
float tmp;
if (x <= 2.0f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(2.0)) tmp = copysign(x, x); else tmp = copysign(log(x), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(2.0)) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log(x)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log x, x\right)\\
\end{array}
\end{array}
if x < 2Initial program 36.0%
add-cbrt-cube29.3%
pow1/329.2%
log-pow29.1%
pow329.2%
log-pow35.8%
+-commutative35.8%
hypot-1-def50.9%
add-sqr-sqrt8.9%
fabs-sqr8.9%
add-sqr-sqrt20.7%
Applied egg-rr20.7%
Taylor expanded in x around 0 64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in x around 0 64.6%
if 2 < x Initial program 48.7%
Taylor expanded in x around inf 44.6%
mul-1-neg44.6%
log-rec44.6%
remove-double-neg44.6%
Simplified44.6%
Final simplification58.9%
(FPCore (x) :precision binary32 (if (<= x 2.0) (copysign x x) (copysign (log1p x) x)))
float code(float x) {
float tmp;
if (x <= 2.0f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(log1pf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(2.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 2:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < 2Initial program 36.0%
add-cbrt-cube29.3%
pow1/329.2%
log-pow29.1%
pow329.2%
log-pow35.8%
+-commutative35.8%
hypot-1-def50.9%
add-sqr-sqrt8.9%
fabs-sqr8.9%
add-sqr-sqrt20.7%
Applied egg-rr20.7%
Taylor expanded in x around 0 64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in x around 0 64.6%
if 2 < x Initial program 48.7%
Taylor expanded in x around 0 10.0%
log1p-def10.0%
Simplified10.0%
Taylor expanded in x around 0 44.6%
log1p-def44.6%
rem-square-sqrt44.6%
fabs-sqr44.6%
rem-square-sqrt44.6%
Simplified44.6%
Final simplification58.9%
(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.6%
add-cbrt-cube31.6%
pow1/331.4%
log-pow31.4%
pow331.4%
log-pow39.3%
+-commutative39.3%
hypot-1-def64.3%
add-sqr-sqrt34.3%
fabs-sqr34.3%
add-sqr-sqrt42.7%
Applied egg-rr42.7%
Taylor expanded in x around 0 48.8%
*-commutative48.8%
Simplified48.8%
Taylor expanded in x around 0 49.3%
Final simplification49.3%
(FPCore (x) :precision binary32 (let* ((t_0 (/ 1.0 (fabs x)))) (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 t_0) t_0)))) x)))
float code(float x) {
float t_0 = 1.0f / fabsf(x);
return copysignf(log1pf((fabsf(x) + (fabsf(x) / (hypotf(1.0f, t_0) + t_0)))), x);
}
function code(x) t_0 = Float32(Float32(1.0) / abs(x)) return copysign(log1p(Float32(abs(x) + Float32(abs(x) / Float32(hypot(Float32(1.0), t_0) + t_0)))), x) end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, t_0\right) + t_0}\right), x\right)
\end{array}
\end{array}
herbie shell --seed 2024024
(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))