
(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))
(t_1 (copysign (- (log (- (hypot 1.0 x) x))) x))
(t_2 (log (+ x (hypot 1.0 x)))))
(if (<= t_0 -0.20000000298023224)
t_1
(if (<= t_0 0.05000000074505806)
(copysign
(fma
(pow x 2.0)
(+
(*
(pow x 2.0)
(+ (/ -0.125 (+ x 1.0)) (/ -0.125 (pow (+ x 1.0) 2.0))))
(/ 0.5 (+ x 1.0)))
(log1p x))
x)
(if (<= t_0 0.30000001192092896)
(copysign (exp (* (* 3.0 (log t_2)) 0.3333333333333333)) x)
(if (<= t_0 0.5)
t_1
(if (<= t_0 8.0)
(copysign t_2 x)
(copysign (log (* x (+ 1.0 (/ x x)))) x))))))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float t_1 = copysignf(-logf((hypotf(1.0f, x) - x)), x);
float t_2 = logf((x + hypotf(1.0f, x)));
float tmp;
if (t_0 <= -0.20000000298023224f) {
tmp = t_1;
} else if (t_0 <= 0.05000000074505806f) {
tmp = copysignf(fmaf(powf(x, 2.0f), ((powf(x, 2.0f) * ((-0.125f / (x + 1.0f)) + (-0.125f / powf((x + 1.0f), 2.0f)))) + (0.5f / (x + 1.0f))), log1pf(x)), x);
} else if (t_0 <= 0.30000001192092896f) {
tmp = copysignf(expf(((3.0f * logf(t_2)) * 0.3333333333333333f)), x);
} else if (t_0 <= 0.5f) {
tmp = t_1;
} else if (t_0 <= 8.0f) {
tmp = copysignf(t_2, x);
} else {
tmp = copysignf(logf((x * (1.0f + (x / 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 = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x) t_2 = log(Float32(x + hypot(Float32(1.0), x))) tmp = Float32(0.0) if (t_0 <= Float32(-0.20000000298023224)) tmp = t_1; elseif (t_0 <= Float32(0.05000000074505806)) tmp = copysign(fma((x ^ Float32(2.0)), Float32(Float32((x ^ Float32(2.0)) * Float32(Float32(Float32(-0.125) / Float32(x + Float32(1.0))) + Float32(Float32(-0.125) / (Float32(x + Float32(1.0)) ^ Float32(2.0))))) + Float32(Float32(0.5) / Float32(x + Float32(1.0)))), log1p(x)), x); elseif (t_0 <= Float32(0.30000001192092896)) tmp = copysign(exp(Float32(Float32(Float32(3.0) * log(t_2)) * Float32(0.3333333333333333))), x); elseif (t_0 <= Float32(0.5)) tmp = t_1; elseif (t_0 <= Float32(8.0)) tmp = copysign(t_2, x); else tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / 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 := \mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
t_2 := \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\\
\mathbf{if}\;t\_0 \leq -0.20000000298023224:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left({x}^{2}, {x}^{2} \cdot \left(\frac{-0.125}{x + 1} + \frac{-0.125}{{\left(x + 1\right)}^{2}}\right) + \frac{0.5}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0.30000001192092896:\\
\;\;\;\;\mathsf{copysign}\left(e^{\left(3 \cdot \log t\_2\right) \cdot 0.3333333333333333}, x\right)\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 8:\\
\;\;\;\;\mathsf{copysign}\left(t\_2, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.200000003 or 0.300000012 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.5Initial program 55.7%
+-commutative55.7%
hypot-1-def99.9%
Simplified99.9%
flip-+7.4%
clear-num7.4%
log-div7.5%
metadata-eval7.5%
add-sqr-sqrt1.3%
fabs-sqr1.3%
add-sqr-sqrt9.1%
pow29.1%
add-sqr-sqrt1.4%
fabs-sqr1.4%
add-sqr-sqrt9.1%
hypot-1-def9.1%
hypot-1-def9.1%
add-sqr-sqrt9.4%
+-commutative9.4%
Applied egg-rr9.4%
neg-sub09.4%
div-sub9.4%
fma-undefine9.4%
unpow29.4%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
*-rgt-identity9.4%
associate-/l*9.4%
metadata-eval9.4%
*-commutative9.4%
fma-undefine9.4%
unpow29.4%
associate--r+52.7%
+-inverses100.0%
metadata-eval100.0%
*-rgt-identity100.0%
associate-/l*100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
Simplified100.0%
if -0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.0500000007Initial program 16.4%
+-commutative16.4%
hypot-1-def16.4%
Simplified16.4%
Taylor expanded in x around 0 17.6%
+-commutative17.6%
fma-define17.6%
Simplified100.0%
if 0.0500000007 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.300000012Initial program 93.8%
+-commutative93.8%
hypot-1-def93.8%
Simplified93.8%
add-cbrt-cube93.8%
pow1/395.0%
pow-to-exp96.9%
pow396.9%
log-pow96.9%
add-sqr-sqrt96.9%
fabs-sqr96.9%
add-sqr-sqrt96.9%
Applied egg-rr96.9%
if 0.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 8Initial program 100.0%
+-commutative100.0%
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-sqrt100.0%
fabs-sqr100.0%
add-sqr-sqrt100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-rgt-identity100.0%
Simplified100.0%
if 8 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) Initial program 45.1%
+-commutative45.1%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 100.0%
rem-square-sqrt100.0%
fabs-sqr100.0%
rem-square-sqrt100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
(t_1 (log (+ x (hypot 1.0 x))))
(t_2 (copysign (- (log (- (hypot 1.0 x) x))) x)))
(if (<= t_0 -0.20000000298023224)
t_2
(if (<= t_0 0.004999999888241291)
(copysign (fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x)) x)
(if (<= t_0 0.05000000074505806)
t_2
(if (<= t_0 0.30000001192092896)
(copysign (exp (* (* 3.0 (log t_1)) 0.3333333333333333)) x)
(if (<= t_0 0.5)
t_2
(if (<= t_0 8.0)
(copysign t_1 x)
(copysign (log (* x (+ 1.0 (/ x x)))) x)))))))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float t_1 = logf((x + hypotf(1.0f, x)));
float t_2 = copysignf(-logf((hypotf(1.0f, x) - x)), x);
float tmp;
if (t_0 <= -0.20000000298023224f) {
tmp = t_2;
} else if (t_0 <= 0.004999999888241291f) {
tmp = copysignf(fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x)), x);
} else if (t_0 <= 0.05000000074505806f) {
tmp = t_2;
} else if (t_0 <= 0.30000001192092896f) {
tmp = copysignf(expf(((3.0f * logf(t_1)) * 0.3333333333333333f)), x);
} else if (t_0 <= 0.5f) {
tmp = t_2;
} else if (t_0 <= 8.0f) {
tmp = copysignf(t_1, x);
} else {
tmp = copysignf(logf((x * (1.0f + (x / 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 = log(Float32(x + hypot(Float32(1.0), x))) t_2 = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x) tmp = Float32(0.0) if (t_0 <= Float32(-0.20000000298023224)) tmp = t_2; elseif (t_0 <= Float32(0.004999999888241291)) tmp = copysign(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x)), x); elseif (t_0 <= Float32(0.05000000074505806)) tmp = t_2; elseif (t_0 <= Float32(0.30000001192092896)) tmp = copysign(exp(Float32(Float32(Float32(3.0) * log(t_1)) * Float32(0.3333333333333333))), x); elseif (t_0 <= Float32(0.5)) tmp = t_2; elseif (t_0 <= Float32(8.0)) tmp = copysign(t_1, x); else tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / 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 := \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\\
t_2 := \mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{if}\;t\_0 \leq -0.20000000298023224:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0.05000000074505806:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 0.30000001192092896:\\
\;\;\;\;\mathsf{copysign}\left(e^{\left(3 \cdot \log t\_1\right) \cdot 0.3333333333333333}, x\right)\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 8:\\
\;\;\;\;\mathsf{copysign}\left(t\_1, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.200000003 or 0.00499999989 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.0500000007 or 0.300000012 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.5Initial program 56.5%
+-commutative56.5%
hypot-1-def99.6%
Simplified99.6%
flip-+9.6%
clear-num9.6%
log-div9.8%
metadata-eval9.8%
add-sqr-sqrt3.7%
fabs-sqr3.7%
add-sqr-sqrt11.3%
pow211.3%
add-sqr-sqrt3.8%
fabs-sqr3.8%
add-sqr-sqrt11.3%
hypot-1-def11.3%
hypot-1-def11.3%
add-sqr-sqrt11.7%
+-commutative11.7%
Applied egg-rr11.7%
neg-sub011.7%
div-sub11.7%
fma-undefine11.7%
unpow211.7%
associate--r+11.7%
+-inverses11.7%
metadata-eval11.7%
*-rgt-identity11.7%
associate-/l*11.7%
metadata-eval11.7%
*-commutative11.7%
fma-undefine11.7%
unpow211.7%
associate--r+53.8%
+-inverses99.8%
metadata-eval99.8%
*-rgt-identity99.8%
associate-/l*99.8%
metadata-eval99.8%
*-commutative99.8%
neg-mul-199.8%
Simplified99.8%
if -0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.00499999989Initial program 15.2%
+-commutative15.2%
hypot-1-def15.2%
Simplified15.2%
Taylor expanded in x around 0 16.3%
+-commutative16.3%
fma-define16.3%
rem-square-sqrt9.2%
fabs-sqr9.2%
rem-square-sqrt16.3%
log1p-define100.0%
rem-square-sqrt52.2%
fabs-sqr52.2%
rem-square-sqrt100.0%
Simplified100.0%
if 0.0500000007 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.300000012Initial program 93.8%
+-commutative93.8%
hypot-1-def93.8%
Simplified93.8%
add-cbrt-cube93.8%
pow1/395.0%
pow-to-exp96.9%
pow396.9%
log-pow96.9%
add-sqr-sqrt96.9%
fabs-sqr96.9%
add-sqr-sqrt96.9%
Applied egg-rr96.9%
if 0.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 8Initial program 100.0%
+-commutative100.0%
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-sqrt100.0%
fabs-sqr100.0%
add-sqr-sqrt100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-rgt-identity100.0%
Simplified100.0%
if 8 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) Initial program 45.1%
+-commutative45.1%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 100.0%
rem-square-sqrt100.0%
fabs-sqr100.0%
rem-square-sqrt100.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 (copysign (- (log (- (hypot 1.0 x) x))) x)))
(if (<= t_0 -0.20000000298023224)
t_1
(if (<= t_0 0.004999999888241291)
(copysign (fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x)) x)
(if (<= t_0 0.5)
t_1
(if (<= t_0 8.0)
(copysign (log (+ x (hypot 1.0 x))) x)
(copysign (log (* x (+ 1.0 (/ x x)))) x)))))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float t_1 = copysignf(-logf((hypotf(1.0f, x) - x)), x);
float tmp;
if (t_0 <= -0.20000000298023224f) {
tmp = t_1;
} else if (t_0 <= 0.004999999888241291f) {
tmp = copysignf(fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x)), x);
} else if (t_0 <= 0.5f) {
tmp = t_1;
} else if (t_0 <= 8.0f) {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
} else {
tmp = copysignf(logf((x * (1.0f + (x / 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 = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x) tmp = Float32(0.0) if (t_0 <= Float32(-0.20000000298023224)) tmp = t_1; elseif (t_0 <= Float32(0.004999999888241291)) tmp = copysign(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x)), x); elseif (t_0 <= Float32(0.5)) tmp = t_1; elseif (t_0 <= Float32(8.0)) tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); else tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / 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 := \mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{if}\;t\_0 \leq -0.20000000298023224:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 8:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.200000003 or 0.00499999989 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.5Initial program 57.0%
+-commutative57.0%
hypot-1-def99.5%
Simplified99.5%
flip-+10.6%
clear-num10.6%
log-div10.9%
metadata-eval10.9%
add-sqr-sqrt4.9%
fabs-sqr4.9%
add-sqr-sqrt12.4%
pow212.4%
add-sqr-sqrt5.0%
fabs-sqr5.0%
add-sqr-sqrt12.4%
hypot-1-def12.4%
hypot-1-def12.4%
add-sqr-sqrt12.7%
+-commutative12.7%
Applied egg-rr12.7%
neg-sub012.7%
div-sub12.7%
fma-undefine12.7%
unpow212.7%
associate--r+12.7%
+-inverses12.7%
metadata-eval12.7%
*-rgt-identity12.7%
associate-/l*12.7%
metadata-eval12.7%
*-commutative12.7%
fma-undefine12.7%
unpow212.7%
associate--r+54.3%
+-inverses99.7%
metadata-eval99.7%
*-rgt-identity99.7%
associate-/l*99.7%
metadata-eval99.7%
*-commutative99.7%
neg-mul-199.7%
Simplified99.7%
if -0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.00499999989Initial program 15.2%
+-commutative15.2%
hypot-1-def15.2%
Simplified15.2%
Taylor expanded in x around 0 16.3%
+-commutative16.3%
fma-define16.3%
rem-square-sqrt9.2%
fabs-sqr9.2%
rem-square-sqrt16.3%
log1p-define100.0%
rem-square-sqrt52.2%
fabs-sqr52.2%
rem-square-sqrt100.0%
Simplified100.0%
if 0.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 8Initial program 100.0%
+-commutative100.0%
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-sqrt100.0%
fabs-sqr100.0%
add-sqr-sqrt100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-rgt-identity100.0%
Simplified100.0%
if 8 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) Initial program 45.1%
+-commutative45.1%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 100.0%
rem-square-sqrt100.0%
fabs-sqr100.0%
rem-square-sqrt100.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 (copysign (- (log (- (hypot 1.0 x) x))) x)))
(if (<= t_0 -0.20000000298023224)
t_1
(if (<= t_0 0.004999999888241291)
(copysign x x)
(if (<= t_0 0.5)
t_1
(if (<= t_0 8.0)
(copysign (log (+ x (hypot 1.0 x))) x)
(copysign (log (* x (+ 1.0 (/ x x)))) x)))))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float t_1 = copysignf(-logf((hypotf(1.0f, x) - x)), x);
float tmp;
if (t_0 <= -0.20000000298023224f) {
tmp = t_1;
} else if (t_0 <= 0.004999999888241291f) {
tmp = copysignf(x, x);
} else if (t_0 <= 0.5f) {
tmp = t_1;
} else if (t_0 <= 8.0f) {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
} else {
tmp = copysignf(logf((x * (1.0f + (x / 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 = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x) tmp = Float32(0.0) if (t_0 <= Float32(-0.20000000298023224)) tmp = t_1; elseif (t_0 <= Float32(0.004999999888241291)) tmp = copysign(x, x); elseif (t_0 <= Float32(0.5)) tmp = t_1; elseif (t_0 <= Float32(8.0)) tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); else tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / 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)))))); t_1 = sign(x) * abs(-log((hypot(single(1.0), x) - x))); tmp = single(0.0); if (t_0 <= single(-0.20000000298023224)) tmp = t_1; elseif (t_0 <= single(0.004999999888241291)) tmp = sign(x) * abs(x); elseif (t_0 <= single(0.5)) tmp = t_1; elseif (t_0 <= single(8.0)) tmp = sign(x) * abs(log((x + hypot(single(1.0), x)))); else tmp = sign(x) * abs(log((x * (single(1.0) + (x / 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)\\
t_1 := \mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{if}\;t\_0 \leq -0.20000000298023224:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 8:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.200000003 or 0.00499999989 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.5Initial program 57.0%
+-commutative57.0%
hypot-1-def99.5%
Simplified99.5%
flip-+10.6%
clear-num10.6%
log-div10.9%
metadata-eval10.9%
add-sqr-sqrt4.9%
fabs-sqr4.9%
add-sqr-sqrt12.4%
pow212.4%
add-sqr-sqrt5.0%
fabs-sqr5.0%
add-sqr-sqrt12.4%
hypot-1-def12.4%
hypot-1-def12.4%
add-sqr-sqrt12.7%
+-commutative12.7%
Applied egg-rr12.7%
neg-sub012.7%
div-sub12.7%
fma-undefine12.7%
unpow212.7%
associate--r+12.7%
+-inverses12.7%
metadata-eval12.7%
*-rgt-identity12.7%
associate-/l*12.7%
metadata-eval12.7%
*-commutative12.7%
fma-undefine12.7%
unpow212.7%
associate--r+54.3%
+-inverses99.7%
metadata-eval99.7%
*-rgt-identity99.7%
associate-/l*99.7%
metadata-eval99.7%
*-commutative99.7%
neg-mul-199.7%
Simplified99.7%
if -0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.00499999989Initial program 15.2%
+-commutative15.2%
hypot-1-def15.2%
Simplified15.2%
Taylor expanded in x around 0 15.0%
log1p-define98.3%
rem-square-sqrt51.1%
fabs-sqr51.1%
rem-square-sqrt98.3%
Simplified98.3%
Taylor expanded in x around 0 99.9%
if 0.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 8Initial program 100.0%
+-commutative100.0%
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-sqrt100.0%
fabs-sqr100.0%
add-sqr-sqrt100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-rgt-identity100.0%
Simplified100.0%
if 8 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) Initial program 45.1%
+-commutative45.1%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 100.0%
rem-square-sqrt100.0%
fabs-sqr100.0%
rem-square-sqrt100.0%
Simplified100.0%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (- x)) x)
(if (<= x 0.5)
(copysign x x)
(if (<= x 2.0)
(copysign (+ (/ 1.0 x) (log x)) x)
(if (or (<= x 6.0)
(and (not (<= x 20.0))
(or (<= x 100.0)
(and (not (<= x 5000.0))
(or (<= x 10000000000.0)
(and (not (<= x 499999997952.0))
(or (<= x 19999999655936.0)
(and (not (<= x 100000000376832.0))
(or (<= x 499999993495552.0)
(and (not
(<=
x
30000000817692670.0))
(or (<=
x
199999996861349900.0)
(and (not
(<=
x
499999992153374700.0))
(or (<=
x
7.000000069917397e+21)
(and (not
(<=
x
5.0000001268882145e+25))
(or (<=
x
9.999999884841548e+26)
(and (not
(<=
x
1.4999999753475345e+28))
(or (<=
x
5.000000075237331e+28)
(and (not
(<=
x
4.000000060189865e+29))
(or (<=
x
2.000000066362707e+32)
(and (not
(<=
x
4.9999999724786364e+32))
(or (<=
x
4.999999895107384e+33)
(and (not
(<=
x
8.500000224013066e+33))
(or (<=
x
1.2000000491021745e+35)
(and (not
(<=
x
2.0000000818369575e+35))
(<=
x
9.999999933815813e+36)))))))))))))))))))))))))
(copysign (log (* x E)) x)
(copysign (+ 1.0 (log x)) x))))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 0.5f) {
tmp = copysignf(x, x);
} else if (x <= 2.0f) {
tmp = copysignf(((1.0f / x) + logf(x)), x);
} else if ((x <= 6.0f) || (!(x <= 20.0f) && ((x <= 100.0f) || (!(x <= 5000.0f) && ((x <= 10000000000.0f) || (!(x <= 499999997952.0f) && ((x <= 19999999655936.0f) || (!(x <= 100000000376832.0f) && ((x <= 499999993495552.0f) || (!(x <= 30000000817692670.0f) && ((x <= 199999996861349900.0f) || (!(x <= 499999992153374700.0f) && ((x <= 7.000000069917397e+21f) || (!(x <= 5.0000001268882145e+25f) && ((x <= 9.999999884841548e+26f) || (!(x <= 1.4999999753475345e+28f) && ((x <= 5.000000075237331e+28f) || (!(x <= 4.000000060189865e+29f) && ((x <= 2.000000066362707e+32f) || (!(x <= 4.9999999724786364e+32f) && ((x <= 4.999999895107384e+33f) || (!(x <= 8.500000224013066e+33f) && ((x <= 1.2000000491021745e+35f) || (!(x <= 2.0000000818369575e+35f) && (x <= 9.999999933815813e+36f))))))))))))))))))))))))) {
tmp = copysignf(logf((x * ((float) M_E))), x);
} else {
tmp = copysignf((1.0f + logf(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(0.5)) tmp = copysign(x, x); elseif (x <= Float32(2.0)) tmp = copysign(Float32(Float32(Float32(1.0) / x) + log(x)), x); elseif ((x <= Float32(6.0)) || (!(x <= Float32(20.0)) && ((x <= Float32(100.0)) || (!(x <= Float32(5000.0)) && ((x <= Float32(10000000000.0)) || (!(x <= Float32(499999997952.0)) && ((x <= Float32(19999999655936.0)) || (!(x <= Float32(100000000376832.0)) && ((x <= Float32(499999993495552.0)) || (!(x <= Float32(30000000817692670.0)) && ((x <= Float32(199999996861349900.0)) || (!(x <= Float32(499999992153374700.0)) && ((x <= Float32(7.000000069917397e+21)) || (!(x <= Float32(5.0000001268882145e+25)) && ((x <= Float32(9.999999884841548e+26)) || (!(x <= Float32(1.4999999753475345e+28)) && ((x <= Float32(5.000000075237331e+28)) || (!(x <= Float32(4.000000060189865e+29)) && ((x <= Float32(2.000000066362707e+32)) || (!(x <= Float32(4.9999999724786364e+32)) && ((x <= Float32(4.999999895107384e+33)) || (!(x <= Float32(8.500000224013066e+33)) && ((x <= Float32(1.2000000491021745e+35)) || (!(x <= Float32(2.0000000818369575e+35)) && (x <= Float32(9.999999933815813e+36)))))))))))))))))))))))))) tmp = copysign(log(Float32(x * Float32(exp(1)))), x); else tmp = copysign(Float32(Float32(1.0) + 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(log(-x)); elseif (x <= single(0.5)) tmp = sign(x) * abs(x); elseif (x <= single(2.0)) tmp = sign(x) * abs(((single(1.0) / x) + log(x))); elseif ((x <= single(6.0)) || (~((x <= single(20.0))) && ((x <= single(100.0)) || (~((x <= single(5000.0))) && ((x <= single(10000000000.0)) || (~((x <= single(499999997952.0))) && ((x <= single(19999999655936.0)) || (~((x <= single(100000000376832.0))) && ((x <= single(499999993495552.0)) || (~((x <= single(30000000817692670.0))) && ((x <= single(199999996861349900.0)) || (~((x <= single(499999992153374700.0))) && ((x <= single(7.000000069917397e+21)) || (~((x <= single(5.0000001268882145e+25))) && ((x <= single(9.999999884841548e+26)) || (~((x <= single(1.4999999753475345e+28))) && ((x <= single(5.000000075237331e+28)) || (~((x <= single(4.000000060189865e+29))) && ((x <= single(2.000000066362707e+32)) || (~((x <= single(4.9999999724786364e+32))) && ((x <= single(4.999999895107384e+33)) || (~((x <= single(8.500000224013066e+33))) && ((x <= single(1.2000000491021745e+35)) || (~((x <= single(2.0000000818369575e+35))) && (x <= single(9.999999933815813e+36)))))))))))))))))))))))))) tmp = sign(x) * abs(log((x * single(2.71828182845904523536)))); else tmp = sign(x) * abs((single(1.0) + log(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 0.5:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(\frac{1}{x} + \log x, x\right)\\
\mathbf{elif}\;x \leq 6 \lor \neg \left(x \leq 20\right) \land \left(x \leq 100 \lor \neg \left(x \leq 5000\right) \land \left(x \leq 10000000000 \lor \neg \left(x \leq 499999997952\right) \land \left(x \leq 19999999655936 \lor \neg \left(x \leq 100000000376832\right) \land \left(x \leq 499999993495552 \lor \neg \left(x \leq 30000000817692670\right) \land \left(x \leq 199999996861349900 \lor \neg \left(x \leq 499999992153374700\right) \land \left(x \leq 7.000000069917397 \cdot 10^{+21} \lor \neg \left(x \leq 5.0000001268882145 \cdot 10^{+25}\right) \land \left(x \leq 9.999999884841548 \cdot 10^{+26} \lor \neg \left(x \leq 1.4999999753475345 \cdot 10^{+28}\right) \land \left(x \leq 5.000000075237331 \cdot 10^{+28} \lor \neg \left(x \leq 4.000000060189865 \cdot 10^{+29}\right) \land \left(x \leq 2.000000066362707 \cdot 10^{+32} \lor \neg \left(x \leq 4.9999999724786364 \cdot 10^{+32}\right) \land \left(x \leq 4.999999895107384 \cdot 10^{+33} \lor \neg \left(x \leq 8.500000224013066 \cdot 10^{+33}\right) \land \left(x \leq 1.2000000491021745 \cdot 10^{+35} \lor \neg \left(x \leq 2.0000000818369575 \cdot 10^{+35}\right) \land x \leq 9.999999933815813 \cdot 10^{+36}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot e\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(1 + \log x, x\right)\\
\end{array}
\end{array}
if x < -2Initial program 54.5%
+-commutative54.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.4%
mul-1-neg44.4%
Simplified44.4%
if -2 < x < 0.5Initial program 18.4%
+-commutative18.4%
hypot-1-def18.4%
Simplified18.4%
Taylor expanded in x around 0 16.0%
log1p-define95.8%
rem-square-sqrt50.3%
fabs-sqr50.3%
rem-square-sqrt95.8%
Simplified95.8%
Taylor expanded in x around 0 98.0%
if 0.5 < x < 2Initial program 100.0%
+-commutative100.0%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
log1p-define32.1%
rem-square-sqrt32.1%
fabs-sqr32.1%
rem-square-sqrt32.1%
Simplified32.1%
Taylor expanded in x around inf 42.5%
+-commutative42.5%
mul-1-neg42.5%
log-rec42.5%
remove-double-neg42.5%
Simplified42.5%
if 2 < x < 6 or 20 < x < 100 or 5e3 < x < 1e10 or 499999998000 < x < 1.99999997e13 or 1e14 < x < 4.99999993e14 or 3.00000008e16 < x < 1.99999997e17 or 4.99999992e17 < x < 7.00000007e21 or 5.00000013e25 < x < 9.99999988e26 or 1.49999998e28 < x < 5.00000008e28 or 4.00000006e29 < x < 2.00000007e32 or 4.99999997e32 < x < 4.9999999e33 or 8.50000022e33 < x < 1.20000005e35 or 2.00000008e35 < x < 9.99999993e36Initial program 46.6%
+-commutative46.6%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 48.9%
mul-1-neg48.9%
log-rec48.9%
remove-double-neg48.9%
rem-square-sqrt48.9%
fabs-sqr48.9%
rem-square-sqrt48.9%
Simplified48.9%
add-log-exp48.9%
*-inverses48.9%
exp-sum48.9%
add-exp-log48.9%
exp-1-e48.9%
Applied egg-rr48.9%
if 6 < x < 20 or 100 < x < 5e3 or 1e10 < x < 499999998000 or 1.99999997e13 < x < 1e14 or 4.99999993e14 < x < 3.00000008e16 or 1.99999997e17 < x < 4.99999992e17 or 7.00000007e21 < x < 5.00000013e25 or 9.99999988e26 < x < 1.49999998e28 or 5.00000008e28 < x < 4.00000006e29 or 2.00000007e32 < x < 4.99999997e32 or 4.9999999e33 < x < 8.50000022e33 or 1.20000005e35 < x < 2.00000008e35 or 9.99999993e36 < x Initial program 53.1%
+-commutative53.1%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 47.9%
mul-1-neg47.9%
log-rec47.9%
remove-double-neg47.9%
rem-square-sqrt47.9%
fabs-sqr47.9%
rem-square-sqrt47.9%
Simplified47.9%
Taylor expanded in x around 0 47.9%
Final simplification70.5%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (- x)) x)
(if (<= x 0.5)
(copysign x x)
(if (<= x 2.0)
(copysign (* x (+ 1.0 (* x (- (* x 0.3333333333333333) 0.5)))) x)
(if (or (<= x 6.0)
(and (not (<= x 20.0))
(or (<= x 100.0)
(and (not (<= x 5000.0))
(or (<= x 10000000000.0)
(and (not (<= x 499999997952.0))
(or (<= x 19999999655936.0)
(and (not (<= x 100000000376832.0))
(or (<= x 499999993495552.0)
(and (not
(<=
x
30000000817692670.0))
(or (<=
x
199999996861349900.0)
(and (not
(<=
x
499999992153374700.0))
(or (<=
x
7.000000069917397e+21)
(and (not
(<=
x
5.0000001268882145e+25))
(or (<=
x
9.999999884841548e+26)
(and (not
(<=
x
1.4999999753475345e+28))
(or (<=
x
5.000000075237331e+28)
(and (not
(<=
x
4.000000060189865e+29))
(or (<=
x
2.000000066362707e+32)
(and (not
(<=
x
4.9999999724786364e+32))
(or (<=
x
4.999999895107384e+33)
(and (not
(<=
x
8.500000224013066e+33))
(or (<=
x
1.2000000491021745e+35)
(and (not
(<=
x
2.0000000818369575e+35))
(<=
x
9.999999933815813e+36)))))))))))))))))))))))))
(copysign (log (* x E)) x)
(copysign (+ 1.0 (log x)) x))))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 0.5f) {
tmp = copysignf(x, x);
} else if (x <= 2.0f) {
tmp = copysignf((x * (1.0f + (x * ((x * 0.3333333333333333f) - 0.5f)))), x);
} else if ((x <= 6.0f) || (!(x <= 20.0f) && ((x <= 100.0f) || (!(x <= 5000.0f) && ((x <= 10000000000.0f) || (!(x <= 499999997952.0f) && ((x <= 19999999655936.0f) || (!(x <= 100000000376832.0f) && ((x <= 499999993495552.0f) || (!(x <= 30000000817692670.0f) && ((x <= 199999996861349900.0f) || (!(x <= 499999992153374700.0f) && ((x <= 7.000000069917397e+21f) || (!(x <= 5.0000001268882145e+25f) && ((x <= 9.999999884841548e+26f) || (!(x <= 1.4999999753475345e+28f) && ((x <= 5.000000075237331e+28f) || (!(x <= 4.000000060189865e+29f) && ((x <= 2.000000066362707e+32f) || (!(x <= 4.9999999724786364e+32f) && ((x <= 4.999999895107384e+33f) || (!(x <= 8.500000224013066e+33f) && ((x <= 1.2000000491021745e+35f) || (!(x <= 2.0000000818369575e+35f) && (x <= 9.999999933815813e+36f))))))))))))))))))))))))) {
tmp = copysignf(logf((x * ((float) M_E))), x);
} else {
tmp = copysignf((1.0f + logf(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(0.5)) tmp = copysign(x, x); elseif (x <= Float32(2.0)) tmp = copysign(Float32(x * Float32(Float32(1.0) + Float32(x * Float32(Float32(x * Float32(0.3333333333333333)) - Float32(0.5))))), x); elseif ((x <= Float32(6.0)) || (!(x <= Float32(20.0)) && ((x <= Float32(100.0)) || (!(x <= Float32(5000.0)) && ((x <= Float32(10000000000.0)) || (!(x <= Float32(499999997952.0)) && ((x <= Float32(19999999655936.0)) || (!(x <= Float32(100000000376832.0)) && ((x <= Float32(499999993495552.0)) || (!(x <= Float32(30000000817692670.0)) && ((x <= Float32(199999996861349900.0)) || (!(x <= Float32(499999992153374700.0)) && ((x <= Float32(7.000000069917397e+21)) || (!(x <= Float32(5.0000001268882145e+25)) && ((x <= Float32(9.999999884841548e+26)) || (!(x <= Float32(1.4999999753475345e+28)) && ((x <= Float32(5.000000075237331e+28)) || (!(x <= Float32(4.000000060189865e+29)) && ((x <= Float32(2.000000066362707e+32)) || (!(x <= Float32(4.9999999724786364e+32)) && ((x <= Float32(4.999999895107384e+33)) || (!(x <= Float32(8.500000224013066e+33)) && ((x <= Float32(1.2000000491021745e+35)) || (!(x <= Float32(2.0000000818369575e+35)) && (x <= Float32(9.999999933815813e+36)))))))))))))))))))))))))) tmp = copysign(log(Float32(x * Float32(exp(1)))), x); else tmp = copysign(Float32(Float32(1.0) + 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(log(-x)); elseif (x <= single(0.5)) tmp = sign(x) * abs(x); elseif (x <= single(2.0)) tmp = sign(x) * abs((x * (single(1.0) + (x * ((x * single(0.3333333333333333)) - single(0.5)))))); elseif ((x <= single(6.0)) || (~((x <= single(20.0))) && ((x <= single(100.0)) || (~((x <= single(5000.0))) && ((x <= single(10000000000.0)) || (~((x <= single(499999997952.0))) && ((x <= single(19999999655936.0)) || (~((x <= single(100000000376832.0))) && ((x <= single(499999993495552.0)) || (~((x <= single(30000000817692670.0))) && ((x <= single(199999996861349900.0)) || (~((x <= single(499999992153374700.0))) && ((x <= single(7.000000069917397e+21)) || (~((x <= single(5.0000001268882145e+25))) && ((x <= single(9.999999884841548e+26)) || (~((x <= single(1.4999999753475345e+28))) && ((x <= single(5.000000075237331e+28)) || (~((x <= single(4.000000060189865e+29))) && ((x <= single(2.000000066362707e+32)) || (~((x <= single(4.9999999724786364e+32))) && ((x <= single(4.999999895107384e+33)) || (~((x <= single(8.500000224013066e+33))) && ((x <= single(1.2000000491021745e+35)) || (~((x <= single(2.0000000818369575e+35))) && (x <= single(9.999999933815813e+36)))))))))))))))))))))))))) tmp = sign(x) * abs(log((x * single(2.71828182845904523536)))); else tmp = sign(x) * abs((single(1.0) + log(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 0.5:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + x \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\right), x\right)\\
\mathbf{elif}\;x \leq 6 \lor \neg \left(x \leq 20\right) \land \left(x \leq 100 \lor \neg \left(x \leq 5000\right) \land \left(x \leq 10000000000 \lor \neg \left(x \leq 499999997952\right) \land \left(x \leq 19999999655936 \lor \neg \left(x \leq 100000000376832\right) \land \left(x \leq 499999993495552 \lor \neg \left(x \leq 30000000817692670\right) \land \left(x \leq 199999996861349900 \lor \neg \left(x \leq 499999992153374700\right) \land \left(x \leq 7.000000069917397 \cdot 10^{+21} \lor \neg \left(x \leq 5.0000001268882145 \cdot 10^{+25}\right) \land \left(x \leq 9.999999884841548 \cdot 10^{+26} \lor \neg \left(x \leq 1.4999999753475345 \cdot 10^{+28}\right) \land \left(x \leq 5.000000075237331 \cdot 10^{+28} \lor \neg \left(x \leq 4.000000060189865 \cdot 10^{+29}\right) \land \left(x \leq 2.000000066362707 \cdot 10^{+32} \lor \neg \left(x \leq 4.9999999724786364 \cdot 10^{+32}\right) \land \left(x \leq 4.999999895107384 \cdot 10^{+33} \lor \neg \left(x \leq 8.500000224013066 \cdot 10^{+33}\right) \land \left(x \leq 1.2000000491021745 \cdot 10^{+35} \lor \neg \left(x \leq 2.0000000818369575 \cdot 10^{+35}\right) \land x \leq 9.999999933815813 \cdot 10^{+36}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot e\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(1 + \log x, x\right)\\
\end{array}
\end{array}
if x < -2Initial program 54.5%
+-commutative54.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.4%
mul-1-neg44.4%
Simplified44.4%
if -2 < x < 0.5Initial program 18.4%
+-commutative18.4%
hypot-1-def18.4%
Simplified18.4%
Taylor expanded in x around 0 16.0%
log1p-define95.8%
rem-square-sqrt50.3%
fabs-sqr50.3%
rem-square-sqrt95.8%
Simplified95.8%
Taylor expanded in x around 0 98.0%
if 0.5 < x < 2Initial program 100.0%
+-commutative100.0%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
log1p-define32.1%
rem-square-sqrt32.1%
fabs-sqr32.1%
rem-square-sqrt32.1%
Simplified32.1%
Taylor expanded in x around 0 38.6%
if 2 < x < 6 or 20 < x < 100 or 5e3 < x < 1e10 or 499999998000 < x < 1.99999997e13 or 1e14 < x < 4.99999993e14 or 3.00000008e16 < x < 1.99999997e17 or 4.99999992e17 < x < 7.00000007e21 or 5.00000013e25 < x < 9.99999988e26 or 1.49999998e28 < x < 5.00000008e28 or 4.00000006e29 < x < 2.00000007e32 or 4.99999997e32 < x < 4.9999999e33 or 8.50000022e33 < x < 1.20000005e35 or 2.00000008e35 < x < 9.99999993e36Initial program 46.6%
+-commutative46.6%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 48.9%
mul-1-neg48.9%
log-rec48.9%
remove-double-neg48.9%
rem-square-sqrt48.9%
fabs-sqr48.9%
rem-square-sqrt48.9%
Simplified48.9%
add-log-exp48.9%
*-inverses48.9%
exp-sum48.9%
add-exp-log48.9%
exp-1-e48.9%
Applied egg-rr48.9%
if 6 < x < 20 or 100 < x < 5e3 or 1e10 < x < 499999998000 or 1.99999997e13 < x < 1e14 or 4.99999993e14 < x < 3.00000008e16 or 1.99999997e17 < x < 4.99999992e17 or 7.00000007e21 < x < 5.00000013e25 or 9.99999988e26 < x < 1.49999998e28 or 5.00000008e28 < x < 4.00000006e29 or 2.00000007e32 < x < 4.99999997e32 or 4.9999999e33 < x < 8.50000022e33 or 1.20000005e35 < x < 2.00000008e35 or 9.99999993e36 < x Initial program 53.1%
+-commutative53.1%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 47.9%
mul-1-neg47.9%
log-rec47.9%
remove-double-neg47.9%
rem-square-sqrt47.9%
fabs-sqr47.9%
rem-square-sqrt47.9%
Simplified47.9%
Taylor expanded in x around 0 47.9%
Final simplification70.5%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (+ (+ 1.0 (log (/ -0.5 x))) -1.0) x)
(if (<= x 0.004999999888241291)
(copysign x x)
(if (<= x 500.0)
(copysign (log (+ x (hypot 1.0 x))) x)
(copysign (log (* x (+ 1.0 (/ x x)))) x)))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(((1.0f + logf((-0.5f / x))) + -1.0f), x);
} else if (x <= 0.004999999888241291f) {
tmp = copysignf(x, x);
} else if (x <= 500.0f) {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
} else {
tmp = copysignf(logf((x * (1.0f + (x / x)))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(Float32(Float32(Float32(1.0) + log(Float32(Float32(-0.5) / x))) + Float32(-1.0)), x); elseif (x <= Float32(0.004999999888241291)) tmp = copysign(x, x); elseif (x <= Float32(500.0)) tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); else tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / 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(1.0) + log((single(-0.5) / x))) + single(-1.0))); elseif (x <= single(0.004999999888241291)) tmp = sign(x) * abs(x); elseif (x <= single(500.0)) tmp = sign(x) * abs(log((x + hypot(single(1.0), x)))); else tmp = sign(x) * abs(log((x * (single(1.0) + (x / x))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\left(1 + \log \left(\frac{-0.5}{x}\right)\right) + -1, x\right)\\
\mathbf{elif}\;x \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{elif}\;x \leq 500:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 54.5%
+-commutative54.5%
hypot-1-def100.0%
Simplified100.0%
expm1-log1p-u97.6%
expm1-undefine97.6%
log1p-undefine97.6%
rem-exp-log99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt11.0%
Applied egg-rr11.0%
Taylor expanded in x around -inf 98.3%
if -2 < x < 0.00499999989Initial program 15.9%
+-commutative15.9%
hypot-1-def15.9%
Simplified15.9%
Taylor expanded in x around 0 15.2%
log1p-define97.7%
rem-square-sqrt50.7%
fabs-sqr50.7%
rem-square-sqrt97.7%
Simplified97.7%
Taylor expanded in x around 0 99.4%
if 0.00499999989 < x < 500Initial program 96.5%
+-commutative96.5%
hypot-1-def96.5%
Simplified96.5%
*-un-lft-identity96.5%
*-commutative96.5%
log-prod96.5%
*-un-lft-identity96.5%
*-un-lft-identity96.5%
add-sqr-sqrt96.7%
fabs-sqr96.7%
add-sqr-sqrt96.5%
metadata-eval96.5%
Applied egg-rr96.5%
+-rgt-identity96.5%
Simplified96.5%
if 500 < x Initial program 45.1%
+-commutative45.1%
hypot-1-def99.9%
Simplified99.9%
Taylor expanded in x around inf 100.0%
rem-square-sqrt100.0%
fabs-sqr100.0%
rem-square-sqrt100.0%
Simplified100.0%
Final simplification99.1%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (+ (+ 1.0 (log (/ -0.5 x))) -1.0) x)
(if (<= x 0.004999999888241291)
(copysign x x)
(if (<= x 0.5)
(copysign (+ (+ 1.0 (+ x (* (pow x 3.0) -0.16666666666666666))) -1.0) x)
(if (<= x 2.0)
(copysign (+ (/ 1.0 x) (log x)) x)
(copysign (log (* x (+ 1.0 (/ x x)))) x))))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(((1.0f + logf((-0.5f / x))) + -1.0f), x);
} else if (x <= 0.004999999888241291f) {
tmp = copysignf(x, x);
} else if (x <= 0.5f) {
tmp = copysignf(((1.0f + (x + (powf(x, 3.0f) * -0.16666666666666666f))) + -1.0f), x);
} else if (x <= 2.0f) {
tmp = copysignf(((1.0f / x) + logf(x)), x);
} else {
tmp = copysignf(logf((x * (1.0f + (x / x)))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(Float32(Float32(Float32(1.0) + log(Float32(Float32(-0.5) / x))) + Float32(-1.0)), x); elseif (x <= Float32(0.004999999888241291)) tmp = copysign(x, x); elseif (x <= Float32(0.5)) tmp = copysign(Float32(Float32(Float32(1.0) + Float32(x + Float32((x ^ Float32(3.0)) * Float32(-0.16666666666666666)))) + Float32(-1.0)), x); elseif (x <= Float32(2.0)) tmp = copysign(Float32(Float32(Float32(1.0) / x) + log(x)), x); else tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / 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(1.0) + log((single(-0.5) / x))) + single(-1.0))); elseif (x <= single(0.004999999888241291)) tmp = sign(x) * abs(x); elseif (x <= single(0.5)) tmp = sign(x) * abs(((single(1.0) + (x + ((x ^ single(3.0)) * single(-0.16666666666666666)))) + single(-1.0))); elseif (x <= single(2.0)) tmp = sign(x) * abs(((single(1.0) / x) + log(x))); else tmp = sign(x) * abs(log((x * (single(1.0) + (x / x))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\left(1 + \log \left(\frac{-0.5}{x}\right)\right) + -1, x\right)\\
\mathbf{elif}\;x \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\mathsf{copysign}\left(\left(1 + \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right) + -1, x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(\frac{1}{x} + \log x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 54.5%
+-commutative54.5%
hypot-1-def100.0%
Simplified100.0%
expm1-log1p-u97.6%
expm1-undefine97.6%
log1p-undefine97.6%
rem-exp-log99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt11.0%
Applied egg-rr11.0%
Taylor expanded in x around -inf 98.3%
if -2 < x < 0.00499999989Initial program 15.9%
+-commutative15.9%
hypot-1-def15.9%
Simplified15.9%
Taylor expanded in x around 0 15.2%
log1p-define97.7%
rem-square-sqrt50.7%
fabs-sqr50.7%
rem-square-sqrt97.7%
Simplified97.7%
Taylor expanded in x around 0 99.4%
if 0.00499999989 < x < 0.5Initial program 91.3%
+-commutative91.3%
hypot-1-def91.3%
Simplified91.3%
expm1-log1p-u91.7%
expm1-undefine90.0%
log1p-undefine90.0%
rem-exp-log90.0%
*-un-lft-identity90.0%
*-un-lft-identity90.0%
add-sqr-sqrt89.2%
fabs-sqr89.2%
add-sqr-sqrt90.0%
Applied egg-rr90.0%
Taylor expanded in x around 0 73.7%
distribute-lft-in73.7%
*-rgt-identity73.7%
*-commutative73.7%
associate-*r*73.7%
unpow273.7%
cube-mult73.7%
Simplified73.7%
if 0.5 < x < 2Initial program 100.0%
+-commutative100.0%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
log1p-define32.1%
rem-square-sqrt32.1%
fabs-sqr32.1%
rem-square-sqrt32.1%
Simplified32.1%
Taylor expanded in x around inf 42.5%
+-commutative42.5%
mul-1-neg42.5%
log-rec42.5%
remove-double-neg42.5%
Simplified42.5%
if 2 < x Initial program 49.5%
+-commutative49.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 97.5%
rem-square-sqrt97.5%
fabs-sqr97.5%
rem-square-sqrt97.5%
Simplified97.5%
Final simplification98.0%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (+ (+ 1.0 (log (/ -0.5 x))) -1.0) x)
(if (<= x 0.5)
(copysign x x)
(if (<= x 2.0)
(copysign (+ (/ 1.0 x) (log x)) x)
(copysign (log (* x (+ 1.0 (/ x x)))) x)))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(((1.0f + logf((-0.5f / x))) + -1.0f), x);
} else if (x <= 0.5f) {
tmp = copysignf(x, x);
} else if (x <= 2.0f) {
tmp = copysignf(((1.0f / x) + logf(x)), x);
} else {
tmp = copysignf(logf((x * (1.0f + (x / x)))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(Float32(Float32(Float32(1.0) + log(Float32(Float32(-0.5) / x))) + Float32(-1.0)), x); elseif (x <= Float32(0.5)) tmp = copysign(x, x); elseif (x <= Float32(2.0)) tmp = copysign(Float32(Float32(Float32(1.0) / x) + log(x)), x); else tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / 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(1.0) + log((single(-0.5) / x))) + single(-1.0))); elseif (x <= single(0.5)) tmp = sign(x) * abs(x); elseif (x <= single(2.0)) tmp = sign(x) * abs(((single(1.0) / x) + log(x))); else tmp = sign(x) * abs(log((x * (single(1.0) + (x / x))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\left(1 + \log \left(\frac{-0.5}{x}\right)\right) + -1, x\right)\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(\frac{1}{x} + \log x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 54.5%
+-commutative54.5%
hypot-1-def100.0%
Simplified100.0%
expm1-log1p-u97.6%
expm1-undefine97.6%
log1p-undefine97.6%
rem-exp-log99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt11.0%
Applied egg-rr11.0%
Taylor expanded in x around -inf 98.3%
if -2 < x < 0.5Initial program 18.4%
+-commutative18.4%
hypot-1-def18.4%
Simplified18.4%
Taylor expanded in x around 0 16.0%
log1p-define95.8%
rem-square-sqrt50.3%
fabs-sqr50.3%
rem-square-sqrt95.8%
Simplified95.8%
Taylor expanded in x around 0 98.0%
if 0.5 < x < 2Initial program 100.0%
+-commutative100.0%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
log1p-define32.1%
rem-square-sqrt32.1%
fabs-sqr32.1%
rem-square-sqrt32.1%
Simplified32.1%
Taylor expanded in x around inf 42.5%
+-commutative42.5%
mul-1-neg42.5%
log-rec42.5%
remove-double-neg42.5%
Simplified42.5%
if 2 < x Initial program 49.5%
+-commutative49.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 97.5%
rem-square-sqrt97.5%
fabs-sqr97.5%
rem-square-sqrt97.5%
Simplified97.5%
Final simplification97.7%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (- x)) x)
(if (<= x 0.5)
(copysign x x)
(if (<= x 2.0)
(copysign (+ (/ 1.0 x) (log x)) x)
(copysign (log (* x (+ 1.0 (/ x x)))) x)))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 0.5f) {
tmp = copysignf(x, x);
} else if (x <= 2.0f) {
tmp = copysignf(((1.0f / x) + logf(x)), x);
} else {
tmp = copysignf(logf((x * (1.0f + (x / 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(0.5)) tmp = copysign(x, x); elseif (x <= Float32(2.0)) tmp = copysign(Float32(Float32(Float32(1.0) / x) + log(x)), x); else tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / 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(0.5)) tmp = sign(x) * abs(x); elseif (x <= single(2.0)) tmp = sign(x) * abs(((single(1.0) / x) + log(x))); else tmp = sign(x) * abs(log((x * (single(1.0) + (x / 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 0.5:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(\frac{1}{x} + \log x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 54.5%
+-commutative54.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.4%
mul-1-neg44.4%
Simplified44.4%
if -2 < x < 0.5Initial program 18.4%
+-commutative18.4%
hypot-1-def18.4%
Simplified18.4%
Taylor expanded in x around 0 16.0%
log1p-define95.8%
rem-square-sqrt50.3%
fabs-sqr50.3%
rem-square-sqrt95.8%
Simplified95.8%
Taylor expanded in x around 0 98.0%
if 0.5 < x < 2Initial program 100.0%
+-commutative100.0%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
log1p-define32.1%
rem-square-sqrt32.1%
fabs-sqr32.1%
rem-square-sqrt32.1%
Simplified32.1%
Taylor expanded in x around inf 42.5%
+-commutative42.5%
mul-1-neg42.5%
log-rec42.5%
remove-double-neg42.5%
Simplified42.5%
if 2 < x Initial program 49.5%
+-commutative49.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 97.5%
rem-square-sqrt97.5%
fabs-sqr97.5%
rem-square-sqrt97.5%
Simplified97.5%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (- x)) x)
(if (<= x 0.5)
(copysign x x)
(if (<= x 2.0)
(copysign (* x (+ 1.0 (* x (- (* x 0.3333333333333333) 0.5)))) x)
(copysign (log (* x E)) x)))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 0.5f) {
tmp = copysignf(x, x);
} else if (x <= 2.0f) {
tmp = copysignf((x * (1.0f + (x * ((x * 0.3333333333333333f) - 0.5f)))), x);
} else {
tmp = copysignf(logf((x * ((float) M_E))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(-x)), x); elseif (x <= Float32(0.5)) tmp = copysign(x, x); elseif (x <= Float32(2.0)) tmp = copysign(Float32(x * Float32(Float32(1.0) + Float32(x * Float32(Float32(x * Float32(0.3333333333333333)) - Float32(0.5))))), x); else tmp = copysign(log(Float32(x * Float32(exp(1)))), 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(0.5)) tmp = sign(x) * abs(x); elseif (x <= single(2.0)) tmp = sign(x) * abs((x * (single(1.0) + (x * ((x * single(0.3333333333333333)) - single(0.5)))))); else tmp = sign(x) * abs(log((x * single(2.71828182845904523536)))); 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 0.5:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + x \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot e\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 54.5%
+-commutative54.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.4%
mul-1-neg44.4%
Simplified44.4%
if -2 < x < 0.5Initial program 18.4%
+-commutative18.4%
hypot-1-def18.4%
Simplified18.4%
Taylor expanded in x around 0 16.0%
log1p-define95.8%
rem-square-sqrt50.3%
fabs-sqr50.3%
rem-square-sqrt95.8%
Simplified95.8%
Taylor expanded in x around 0 98.0%
if 0.5 < x < 2Initial program 100.0%
+-commutative100.0%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
log1p-define32.1%
rem-square-sqrt32.1%
fabs-sqr32.1%
rem-square-sqrt32.1%
Simplified32.1%
Taylor expanded in x around 0 38.6%
if 2 < x Initial program 49.5%
+-commutative49.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 48.5%
mul-1-neg48.5%
log-rec48.5%
remove-double-neg48.5%
rem-square-sqrt48.5%
fabs-sqr48.5%
rem-square-sqrt48.5%
Simplified48.5%
add-log-exp48.5%
*-inverses48.5%
exp-sum48.5%
add-exp-log48.5%
exp-1-e48.5%
Applied egg-rr48.5%
Final simplification70.5%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (- x)) x)
(if (<= x 0.5)
(copysign x x)
(if (<= x 2.0)
(copysign (* x (+ 1.0 (* x (- (* x 0.3333333333333333) 0.5)))) x)
(copysign (log1p x) x)))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 0.5f) {
tmp = copysignf(x, x);
} else if (x <= 2.0f) {
tmp = copysignf((x * (1.0f + (x * ((x * 0.3333333333333333f) - 0.5f)))), 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); elseif (x <= Float32(0.5)) tmp = copysign(x, x); elseif (x <= Float32(2.0)) tmp = copysign(Float32(x * Float32(Float32(1.0) + Float32(x * Float32(Float32(x * Float32(0.3333333333333333)) - Float32(0.5))))), 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{elif}\;x \leq 0.5:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + x \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 54.5%
+-commutative54.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 44.4%
mul-1-neg44.4%
Simplified44.4%
if -2 < x < 0.5Initial program 18.4%
+-commutative18.4%
hypot-1-def18.4%
Simplified18.4%
Taylor expanded in x around 0 16.0%
log1p-define95.8%
rem-square-sqrt50.3%
fabs-sqr50.3%
rem-square-sqrt95.8%
Simplified95.8%
Taylor expanded in x around 0 98.0%
if 0.5 < x < 2Initial program 100.0%
+-commutative100.0%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
log1p-define32.1%
rem-square-sqrt32.1%
fabs-sqr32.1%
rem-square-sqrt32.1%
Simplified32.1%
Taylor expanded in x around 0 38.6%
if 2 < x Initial program 49.5%
+-commutative49.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 44.8%
log1p-define44.8%
rem-square-sqrt44.8%
fabs-sqr44.8%
rem-square-sqrt44.8%
Simplified44.8%
Final simplification69.6%
(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 32.3%
+-commutative32.3%
hypot-1-def49.3%
Simplified49.3%
Taylor expanded in x around 0 26.7%
log1p-define76.3%
rem-square-sqrt31.5%
fabs-sqr31.5%
rem-square-sqrt59.7%
Simplified59.7%
Taylor expanded in x around 0 65.3%
if 2 < x Initial program 49.5%
+-commutative49.5%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 44.8%
log1p-define44.8%
rem-square-sqrt44.8%
fabs-sqr44.8%
rem-square-sqrt44.8%
Simplified44.8%
(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 36.5%
+-commutative36.5%
hypot-1-def61.7%
Simplified61.7%
Taylor expanded in x around 0 31.1%
log1p-define68.6%
rem-square-sqrt34.7%
fabs-sqr34.7%
rem-square-sqrt56.1%
Simplified56.1%
Taylor expanded in x around 0 51.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 2024096
(FPCore (x)
:name "Rust f32::asinh"
:precision binary32
:alt
(copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))) x)
(copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))