
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary32 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
float code(float x) {
return copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
}
function code(x) return copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) end
function tmp = code(x) tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0)))))); end
\begin{array}{l}
\\
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\end{array}
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.11999999731779099)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.10000000149011612)
(copysign
(+ x (* (fma (pow x 2.0) 0.075 -0.16666666666666666) (pow x 3.0)))
x)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float tmp;
if (t_0 <= -0.11999999731779099f) {
tmp = copysignf(logf((1.0f / (hypotf(1.0f, x) - x))), x);
} else if (t_0 <= 0.10000000149011612f) {
tmp = copysignf((x + (fmaf(powf(x, 2.0f), 0.075f, -0.16666666666666666f) * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) tmp = Float32(0.0) if (t_0 <= Float32(-0.11999999731779099)) tmp = copysign(log(Float32(Float32(1.0) / Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.10000000149011612)) tmp = copysign(Float32(x + Float32(fma((x ^ Float32(2.0)), Float32(0.075), Float32(-0.16666666666666666)) * (x ^ Float32(3.0)))), x); else tmp = copysign(log(Float32(abs(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.11999999731779099:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x + \mathsf{fma}\left({x}^{2}, 0.075, -0.16666666666666666\right) \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.119999997Initial program 47.1%
+-commutative47.1%
hypot-1-def99.9%
flip-+4.9%
hypot-1-def4.9%
hypot-1-def4.9%
add-sqr-sqrt4.6%
+-commutative4.6%
hypot-1-def4.6%
+-commutative4.6%
div-sub4.8%
Applied egg-rr7.0%
div-sub8.8%
remove-double-neg8.8%
distribute-neg-frac28.8%
distribute-frac-neg8.8%
neg-sub08.8%
associate--r-8.8%
neg-sub08.8%
+-commutative8.8%
fma-undefine8.8%
unpow28.8%
+-commutative8.8%
associate-+l+43.5%
sub-neg43.5%
+-inverses99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
if -0.119999997 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.100000001Initial program 21.4%
+-commutative21.4%
hypot-1-def21.4%
flip-+21.7%
hypot-1-def21.7%
hypot-1-def21.6%
add-sqr-sqrt21.7%
+-commutative21.7%
hypot-1-def21.6%
+-commutative21.6%
div-sub21.7%
Applied egg-rr21.8%
div-sub21.7%
remove-double-neg21.7%
distribute-neg-frac221.7%
distribute-frac-neg21.7%
neg-sub021.7%
associate--r-21.7%
neg-sub021.7%
+-commutative21.7%
fma-undefine21.7%
unpow221.7%
+-commutative21.7%
associate-+l+21.8%
sub-neg21.8%
+-inverses21.8%
metadata-eval21.8%
neg-sub021.8%
associate--r-21.8%
neg-sub021.8%
+-commutative21.8%
sub-neg21.8%
Simplified21.8%
Taylor expanded in x around 0 99.9%
distribute-rgt-in100.0%
*-lft-identity100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
fmm-def100.0%
metadata-eval100.0%
unpow2100.0%
unpow3100.0%
Simplified100.0%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) Initial program 41.7%
+-commutative41.7%
hypot-1-def98.6%
Simplified98.6%
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.11999999731779099)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.10000000149011612)
(copysign
(*
x
(+ 1.0 (* (pow x 2.0) (- (* (pow x 2.0) 0.075) 0.16666666666666666))))
x)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)))))
float code(float x) {
float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float tmp;
if (t_0 <= -0.11999999731779099f) {
tmp = copysignf(logf((1.0f / (hypotf(1.0f, x) - x))), x);
} else if (t_0 <= 0.10000000149011612f) {
tmp = copysignf((x * (1.0f + (powf(x, 2.0f) * ((powf(x, 2.0f) * 0.075f) - 0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) tmp = Float32(0.0) if (t_0 <= Float32(-0.11999999731779099)) tmp = copysign(log(Float32(Float32(1.0) / Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.10000000149011612)) tmp = copysign(Float32(x * Float32(Float32(1.0) + Float32((x ^ Float32(2.0)) * Float32(Float32((x ^ Float32(2.0)) * Float32(0.075)) - Float32(0.16666666666666666))))), x); else tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x); end return tmp end
function tmp_2 = code(x) t_0 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0)))))); tmp = single(0.0); if (t_0 <= single(-0.11999999731779099)) tmp = sign(x) * abs(log((single(1.0) / (hypot(single(1.0), x) - x)))); elseif (t_0 <= single(0.10000000149011612)) tmp = sign(x) * abs((x * (single(1.0) + ((x ^ single(2.0)) * (((x ^ single(2.0)) * single(0.075)) - single(0.16666666666666666)))))); else tmp = sign(x) * abs(log((abs(x) + hypot(single(1.0), x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t\_0 \leq -0.11999999731779099:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot 0.075 - 0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.119999997Initial program 47.1%
+-commutative47.1%
hypot-1-def99.9%
flip-+4.9%
hypot-1-def4.9%
hypot-1-def4.9%
add-sqr-sqrt4.6%
+-commutative4.6%
hypot-1-def4.6%
+-commutative4.6%
div-sub4.8%
Applied egg-rr7.0%
div-sub8.8%
remove-double-neg8.8%
distribute-neg-frac28.8%
distribute-frac-neg8.8%
neg-sub08.8%
associate--r-8.8%
neg-sub08.8%
+-commutative8.8%
fma-undefine8.8%
unpow28.8%
+-commutative8.8%
associate-+l+43.5%
sub-neg43.5%
+-inverses99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
if -0.119999997 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.100000001Initial program 21.4%
+-commutative21.4%
hypot-1-def21.4%
flip-+21.7%
hypot-1-def21.7%
hypot-1-def21.6%
add-sqr-sqrt21.7%
+-commutative21.7%
hypot-1-def21.6%
+-commutative21.6%
div-sub21.7%
Applied egg-rr21.8%
div-sub21.7%
remove-double-neg21.7%
distribute-neg-frac221.7%
distribute-frac-neg21.7%
neg-sub021.7%
associate--r-21.7%
neg-sub021.7%
+-commutative21.7%
fma-undefine21.7%
unpow221.7%
+-commutative21.7%
associate-+l+21.8%
sub-neg21.8%
+-inverses21.8%
metadata-eval21.8%
neg-sub021.8%
associate--r-21.8%
neg-sub021.8%
+-commutative21.8%
sub-neg21.8%
Simplified21.8%
Taylor expanded in x around 0 99.9%
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) Initial program 41.7%
+-commutative41.7%
hypot-1-def98.6%
Simplified98.6%
Final simplification99.6%
(FPCore (x)
:precision binary32
(if (<= x -0.11999999731779099)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= x 0.10000000149011612)
(copysign
(*
x
(+ 1.0 (* (pow x 2.0) (- (* (pow x 2.0) 0.075) 0.16666666666666666))))
x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -0.11999999731779099f) {
tmp = copysignf(logf((1.0f / (hypotf(1.0f, x) - x))), x);
} else if (x <= 0.10000000149011612f) {
tmp = copysignf((x * (1.0f + (powf(x, 2.0f) * ((powf(x, 2.0f) * 0.075f) - 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(-0.11999999731779099)) tmp = copysign(log(Float32(Float32(1.0) / Float32(hypot(Float32(1.0), x) - x))), x); elseif (x <= Float32(0.10000000149011612)) tmp = copysign(Float32(x * Float32(Float32(1.0) + Float32((x ^ Float32(2.0)) * Float32(Float32((x ^ Float32(2.0)) * Float32(0.075)) - 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(-0.11999999731779099)) tmp = sign(x) * abs(log((single(1.0) / (hypot(single(1.0), x) - x)))); elseif (x <= single(0.10000000149011612)) tmp = sign(x) * abs((x * (single(1.0) + ((x ^ single(2.0)) * (((x ^ single(2.0)) * single(0.075)) - 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 -0.11999999731779099:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot 0.075 - 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 < -0.119999997Initial program 47.1%
+-commutative47.1%
hypot-1-def99.9%
flip-+4.9%
hypot-1-def4.9%
hypot-1-def4.9%
add-sqr-sqrt4.6%
+-commutative4.6%
hypot-1-def4.6%
+-commutative4.6%
div-sub4.8%
Applied egg-rr7.0%
div-sub8.8%
remove-double-neg8.8%
distribute-neg-frac28.8%
distribute-frac-neg8.8%
neg-sub08.8%
associate--r-8.8%
neg-sub08.8%
+-commutative8.8%
fma-undefine8.8%
unpow28.8%
+-commutative8.8%
associate-+l+43.5%
sub-neg43.5%
+-inverses99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
if -0.119999997 < x < 0.100000001Initial program 21.4%
+-commutative21.4%
hypot-1-def21.4%
flip-+21.7%
hypot-1-def21.7%
hypot-1-def21.6%
add-sqr-sqrt21.7%
+-commutative21.7%
hypot-1-def21.6%
+-commutative21.6%
div-sub21.7%
Applied egg-rr21.8%
div-sub21.7%
remove-double-neg21.7%
distribute-neg-frac221.7%
distribute-frac-neg21.7%
neg-sub021.7%
associate--r-21.7%
neg-sub021.7%
+-commutative21.7%
fma-undefine21.7%
unpow221.7%
+-commutative21.7%
associate-+l+21.8%
sub-neg21.8%
+-inverses21.8%
metadata-eval21.8%
neg-sub021.8%
associate--r-21.8%
neg-sub021.8%
+-commutative21.8%
sub-neg21.8%
Simplified21.8%
Taylor expanded in x around 0 99.9%
if 0.100000001 < x Initial program 41.7%
Taylor expanded in x around 0 41.7%
rem-square-sqrt41.7%
fabs-sqr41.7%
metadata-eval41.7%
unpow241.7%
hypot-undefine98.6%
rem-square-sqrt98.6%
Simplified98.6%
Final simplification99.6%
(FPCore (x)
:precision binary32
(if (<= x -0.10000000149011612)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= x 0.05000000074505806)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -0.10000000149011612f) {
tmp = copysignf(logf((1.0f / (hypotf(1.0f, x) - x))), x);
} else if (x <= 0.05000000074505806f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-0.10000000149011612)) tmp = copysign(log(Float32(Float32(1.0) / Float32(hypot(Float32(1.0), x) - x))), x); elseif (x <= Float32(0.05000000074505806)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0)))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-0.10000000149011612)) tmp = sign(x) * abs(log((single(1.0) / (hypot(single(1.0), x) - x)))); elseif (x <= single(0.05000000074505806)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (x ^ single(3.0))))); else tmp = sign(x) * abs(log((x + hypot(single(1.0), x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if x < -0.100000001Initial program 47.8%
+-commutative47.8%
hypot-1-def99.8%
flip-+6.3%
hypot-1-def6.3%
hypot-1-def6.3%
add-sqr-sqrt6.0%
+-commutative6.0%
hypot-1-def6.0%
+-commutative6.0%
div-sub6.2%
Applied egg-rr8.4%
div-sub10.2%
remove-double-neg10.2%
distribute-neg-frac210.2%
distribute-frac-neg10.2%
neg-sub010.2%
associate--r-10.2%
neg-sub010.2%
+-commutative10.2%
fma-undefine10.2%
unpow210.2%
+-commutative10.2%
associate-+l+44.3%
sub-neg44.3%
+-inverses99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
if -0.100000001 < x < 0.0500000007Initial program 20.2%
+-commutative20.2%
hypot-1-def20.2%
flip-+20.5%
hypot-1-def20.5%
hypot-1-def20.5%
add-sqr-sqrt20.5%
+-commutative20.5%
hypot-1-def20.5%
+-commutative20.5%
div-sub20.6%
Applied egg-rr20.6%
div-sub20.5%
remove-double-neg20.5%
distribute-neg-frac220.5%
distribute-frac-neg20.5%
neg-sub020.5%
associate--r-20.5%
neg-sub020.5%
+-commutative20.5%
fma-undefine20.5%
unpow220.5%
+-commutative20.5%
associate-+l+20.6%
sub-neg20.6%
+-inverses20.6%
metadata-eval20.6%
neg-sub020.6%
associate--r-20.6%
neg-sub020.6%
+-commutative20.6%
sub-neg20.6%
Simplified20.6%
Taylor expanded in x around 0 99.9%
distribute-rgt-in99.9%
*-lft-identity99.9%
associate-*l*99.9%
unpow299.9%
unpow399.9%
Simplified99.9%
if 0.0500000007 < x Initial program 42.5%
Taylor expanded in x around 0 42.5%
rem-square-sqrt42.5%
fabs-sqr42.5%
metadata-eval42.5%
unpow242.5%
hypot-undefine98.5%
rem-square-sqrt98.6%
Simplified98.6%
(FPCore (x)
:precision binary32
(if (<= x -0.10000000149011612)
(copysign (log (- (hypot 1.0 x) x)) x)
(if (<= x 0.05000000074505806)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -0.10000000149011612f) {
tmp = copysignf(logf((hypotf(1.0f, x) - x)), x);
} else if (x <= 0.05000000074505806f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-0.10000000149011612)) tmp = copysign(log(Float32(hypot(Float32(1.0), x) - x)), x); elseif (x <= Float32(0.05000000074505806)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0)))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-0.10000000149011612)) tmp = sign(x) * abs(log((hypot(single(1.0), x) - x))); elseif (x <= single(0.05000000074505806)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (x ^ single(3.0))))); else tmp = sign(x) * abs(log((x + hypot(single(1.0), x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if x < -0.100000001Initial program 47.8%
+-commutative47.8%
hypot-1-def99.8%
flip-+6.3%
hypot-1-def6.3%
hypot-1-def6.3%
add-sqr-sqrt6.0%
+-commutative6.0%
hypot-1-def6.0%
+-commutative6.0%
div-sub6.2%
Applied egg-rr8.4%
div-sub10.2%
remove-double-neg10.2%
distribute-neg-frac210.2%
distribute-frac-neg10.2%
neg-sub010.2%
associate--r-10.2%
neg-sub010.2%
+-commutative10.2%
fma-undefine10.2%
unpow210.2%
+-commutative10.2%
associate-+l+44.3%
sub-neg44.3%
+-inverses99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
expm1-log1p-u3.1%
expm1-undefine3.1%
log-rec3.0%
Applied egg-rr3.0%
sub-neg3.0%
metadata-eval3.0%
+-commutative3.0%
log1p-undefine3.0%
rem-exp-log99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in x around 0 47.8%
metadata-eval47.8%
unpow247.8%
hypot-undefine99.8%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt99.8%
fabs-neg99.8%
rem-square-sqrt98.4%
fabs-sqr98.4%
rem-square-sqrt99.8%
Simplified99.8%
if -0.100000001 < x < 0.0500000007Initial program 20.2%
+-commutative20.2%
hypot-1-def20.2%
flip-+20.5%
hypot-1-def20.5%
hypot-1-def20.5%
add-sqr-sqrt20.5%
+-commutative20.5%
hypot-1-def20.5%
+-commutative20.5%
div-sub20.6%
Applied egg-rr20.6%
div-sub20.5%
remove-double-neg20.5%
distribute-neg-frac220.5%
distribute-frac-neg20.5%
neg-sub020.5%
associate--r-20.5%
neg-sub020.5%
+-commutative20.5%
fma-undefine20.5%
unpow220.5%
+-commutative20.5%
associate-+l+20.6%
sub-neg20.6%
+-inverses20.6%
metadata-eval20.6%
neg-sub020.6%
associate--r-20.6%
neg-sub020.6%
+-commutative20.6%
sub-neg20.6%
Simplified20.6%
Taylor expanded in x around 0 99.9%
distribute-rgt-in99.9%
*-lft-identity99.9%
associate-*l*99.9%
unpow299.9%
unpow399.9%
Simplified99.9%
if 0.0500000007 < x Initial program 42.5%
Taylor expanded in x around 0 42.5%
rem-square-sqrt42.5%
fabs-sqr42.5%
metadata-eval42.5%
unpow242.5%
hypot-undefine98.5%
rem-square-sqrt98.6%
Simplified98.6%
(FPCore (x)
:precision binary32
(if (<= x -50.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 0.05000000074505806)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 0.05000000074505806f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(0.05000000074505806)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0)))), x); else tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-50.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(0.05000000074505806)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (x ^ single(3.0))))); else tmp = sign(x) * abs(log((x + hypot(single(1.0), x)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if x < -50Initial program 46.3%
+-commutative46.3%
hypot-1-def100.0%
flip-+3.4%
hypot-1-def3.4%
hypot-1-def3.4%
add-sqr-sqrt3.2%
+-commutative3.2%
hypot-1-def3.2%
+-commutative3.2%
div-sub3.3%
Applied egg-rr5.5%
div-sub7.3%
remove-double-neg7.3%
distribute-neg-frac27.3%
distribute-frac-neg7.3%
neg-sub07.3%
associate--r-7.3%
neg-sub07.3%
+-commutative7.3%
fma-undefine7.3%
unpow27.3%
+-commutative7.3%
associate-+l+42.6%
sub-neg42.6%
+-inverses100.0%
metadata-eval100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.4%
if -50 < x < 0.0500000007Initial program 21.4%
+-commutative21.4%
hypot-1-def21.4%
flip-+21.7%
hypot-1-def21.7%
hypot-1-def21.7%
add-sqr-sqrt21.6%
+-commutative21.6%
hypot-1-def21.6%
+-commutative21.6%
div-sub21.8%
Applied egg-rr21.8%
div-sub21.7%
remove-double-neg21.7%
distribute-neg-frac221.7%
distribute-frac-neg21.7%
neg-sub021.7%
associate--r-21.7%
neg-sub021.7%
+-commutative21.7%
fma-undefine21.7%
unpow221.7%
+-commutative21.7%
associate-+l+21.8%
sub-neg21.8%
+-inverses21.8%
metadata-eval21.8%
neg-sub021.8%
associate--r-21.8%
neg-sub021.8%
+-commutative21.8%
sub-neg21.8%
Simplified21.8%
Taylor expanded in x around 0 99.5%
distribute-rgt-in99.5%
*-lft-identity99.5%
associate-*l*99.5%
unpow299.5%
unpow399.5%
Simplified99.5%
if 0.0500000007 < x Initial program 42.5%
Taylor expanded in x around 0 42.5%
rem-square-sqrt42.5%
fabs-sqr42.5%
metadata-eval42.5%
unpow242.5%
hypot-undefine98.5%
rem-square-sqrt98.6%
Simplified98.6%
(FPCore (x)
:precision binary32
(if (<= x -50.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 1.5)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.5f) {
tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
} else {
tmp = copysignf(logf((0.5f / x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(1.5)) tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0)))), x); else tmp = copysign(log(Float32(Float32(0.5) / x)), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-50.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(1.5)) tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (x ^ single(3.0))))); else tmp = sign(x) * abs(log((single(0.5) / x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1.5:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -50Initial program 46.3%
+-commutative46.3%
hypot-1-def100.0%
flip-+3.4%
hypot-1-def3.4%
hypot-1-def3.4%
add-sqr-sqrt3.2%
+-commutative3.2%
hypot-1-def3.2%
+-commutative3.2%
div-sub3.3%
Applied egg-rr5.5%
div-sub7.3%
remove-double-neg7.3%
distribute-neg-frac27.3%
distribute-frac-neg7.3%
neg-sub07.3%
associate--r-7.3%
neg-sub07.3%
+-commutative7.3%
fma-undefine7.3%
unpow27.3%
+-commutative7.3%
associate-+l+42.6%
sub-neg42.6%
+-inverses100.0%
metadata-eval100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.4%
if -50 < x < 1.5Initial program 22.6%
+-commutative22.6%
hypot-1-def22.6%
flip-+22.8%
hypot-1-def22.8%
hypot-1-def22.8%
add-sqr-sqrt22.8%
+-commutative22.8%
hypot-1-def22.8%
+-commutative22.8%
div-sub22.9%
Applied egg-rr23.0%
div-sub22.9%
remove-double-neg22.9%
distribute-neg-frac222.9%
distribute-frac-neg22.9%
neg-sub022.9%
associate--r-22.9%
neg-sub022.9%
+-commutative22.9%
fma-undefine22.9%
unpow222.9%
+-commutative22.9%
associate-+l+23.0%
sub-neg23.0%
+-inverses23.0%
metadata-eval23.0%
neg-sub023.0%
associate--r-23.0%
neg-sub023.0%
+-commutative23.0%
sub-neg23.0%
Simplified23.0%
Taylor expanded in x around 0 98.9%
distribute-rgt-in98.9%
*-lft-identity98.9%
associate-*l*98.9%
unpow298.9%
unpow398.9%
Simplified98.9%
if 1.5 < x Initial program 40.9%
+-commutative40.9%
hypot-1-def98.6%
flip-+6.8%
hypot-1-def6.8%
hypot-1-def6.8%
add-sqr-sqrt6.7%
+-commutative6.7%
hypot-1-def6.7%
+-commutative6.7%
div-sub7.0%
Applied egg-rr6.9%
div-sub6.6%
remove-double-neg6.6%
distribute-neg-frac26.6%
distribute-frac-neg6.6%
neg-sub06.6%
associate--r-6.6%
neg-sub06.6%
+-commutative6.6%
fma-undefine6.7%
unpow26.7%
+-commutative6.7%
associate-+l+6.6%
sub-neg6.6%
+-inverses6.6%
metadata-eval6.6%
neg-sub012.5%
associate--r-12.5%
neg-sub012.5%
+-commutative12.5%
sub-neg12.5%
Simplified12.5%
expm1-log1p-u12.5%
expm1-undefine12.5%
log-rec12.5%
Applied egg-rr12.5%
sub-neg12.5%
metadata-eval12.5%
+-commutative12.5%
log1p-undefine12.5%
rem-exp-log12.5%
unsub-neg12.5%
Simplified12.5%
Taylor expanded in x around 0 12.5%
metadata-eval12.5%
unpow212.5%
hypot-undefine12.5%
rem-square-sqrt12.5%
fabs-sqr12.5%
rem-square-sqrt12.5%
fabs-neg12.5%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt12.5%
Simplified12.5%
Taylor expanded in x around inf 97.3%
(FPCore (x) :precision binary32 (if (<= x -50.0) (copysign (log (/ -0.5 x)) x) (if (<= x 1.5) (copysign x x) (copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.5f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((0.5f / x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(1.5)) 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(-50.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(1.5)) 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 -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1.5:\\
\;\;\;\;\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 < -50Initial program 46.3%
+-commutative46.3%
hypot-1-def100.0%
flip-+3.4%
hypot-1-def3.4%
hypot-1-def3.4%
add-sqr-sqrt3.2%
+-commutative3.2%
hypot-1-def3.2%
+-commutative3.2%
div-sub3.3%
Applied egg-rr5.5%
div-sub7.3%
remove-double-neg7.3%
distribute-neg-frac27.3%
distribute-frac-neg7.3%
neg-sub07.3%
associate--r-7.3%
neg-sub07.3%
+-commutative7.3%
fma-undefine7.3%
unpow27.3%
+-commutative7.3%
associate-+l+42.6%
sub-neg42.6%
+-inverses100.0%
metadata-eval100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.4%
if -50 < x < 1.5Initial program 22.6%
+-commutative22.6%
hypot-1-def22.6%
flip-+22.8%
hypot-1-def22.8%
hypot-1-def22.8%
add-sqr-sqrt22.8%
+-commutative22.8%
hypot-1-def22.8%
+-commutative22.8%
div-sub22.9%
Applied egg-rr23.0%
div-sub22.9%
remove-double-neg22.9%
distribute-neg-frac222.9%
distribute-frac-neg22.9%
neg-sub022.9%
associate--r-22.9%
neg-sub022.9%
+-commutative22.9%
fma-undefine22.9%
unpow222.9%
+-commutative22.9%
associate-+l+23.0%
sub-neg23.0%
+-inverses23.0%
metadata-eval23.0%
neg-sub023.0%
associate--r-23.0%
neg-sub023.0%
+-commutative23.0%
sub-neg23.0%
Simplified23.0%
Taylor expanded in x around 0 96.9%
if 1.5 < x Initial program 40.9%
+-commutative40.9%
hypot-1-def98.6%
flip-+6.8%
hypot-1-def6.8%
hypot-1-def6.8%
add-sqr-sqrt6.7%
+-commutative6.7%
hypot-1-def6.7%
+-commutative6.7%
div-sub7.0%
Applied egg-rr6.9%
div-sub6.6%
remove-double-neg6.6%
distribute-neg-frac26.6%
distribute-frac-neg6.6%
neg-sub06.6%
associate--r-6.6%
neg-sub06.6%
+-commutative6.6%
fma-undefine6.7%
unpow26.7%
+-commutative6.7%
associate-+l+6.6%
sub-neg6.6%
+-inverses6.6%
metadata-eval6.6%
neg-sub012.5%
associate--r-12.5%
neg-sub012.5%
+-commutative12.5%
sub-neg12.5%
Simplified12.5%
expm1-log1p-u12.5%
expm1-undefine12.5%
log-rec12.5%
Applied egg-rr12.5%
sub-neg12.5%
metadata-eval12.5%
+-commutative12.5%
log1p-undefine12.5%
rem-exp-log12.5%
unsub-neg12.5%
Simplified12.5%
Taylor expanded in x around 0 12.5%
metadata-eval12.5%
unpow212.5%
hypot-undefine12.5%
rem-square-sqrt12.5%
fabs-sqr12.5%
rem-square-sqrt12.5%
fabs-neg12.5%
rem-square-sqrt-0.0%
fabs-sqr-0.0%
rem-square-sqrt12.5%
Simplified12.5%
Taylor expanded in x around inf 97.3%
(FPCore (x) :precision binary32 (if (<= x -50.0) (copysign (log (/ -0.5 x)) x) (if (<= x 1.5) (copysign x x) (copysign (log (* x 2.0)) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.5f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((x * 2.0f)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(1.5)) 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(-50.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(1.5)) 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 -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1.5:\\
\;\;\;\;\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 < -50Initial program 46.3%
+-commutative46.3%
hypot-1-def100.0%
flip-+3.4%
hypot-1-def3.4%
hypot-1-def3.4%
add-sqr-sqrt3.2%
+-commutative3.2%
hypot-1-def3.2%
+-commutative3.2%
div-sub3.3%
Applied egg-rr5.5%
div-sub7.3%
remove-double-neg7.3%
distribute-neg-frac27.3%
distribute-frac-neg7.3%
neg-sub07.3%
associate--r-7.3%
neg-sub07.3%
+-commutative7.3%
fma-undefine7.3%
unpow27.3%
+-commutative7.3%
associate-+l+42.6%
sub-neg42.6%
+-inverses100.0%
metadata-eval100.0%
neg-sub0100.0%
associate--r-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.4%
if -50 < x < 1.5Initial program 22.6%
+-commutative22.6%
hypot-1-def22.6%
flip-+22.8%
hypot-1-def22.8%
hypot-1-def22.8%
add-sqr-sqrt22.8%
+-commutative22.8%
hypot-1-def22.8%
+-commutative22.8%
div-sub22.9%
Applied egg-rr23.0%
div-sub22.9%
remove-double-neg22.9%
distribute-neg-frac222.9%
distribute-frac-neg22.9%
neg-sub022.9%
associate--r-22.9%
neg-sub022.9%
+-commutative22.9%
fma-undefine22.9%
unpow222.9%
+-commutative22.9%
associate-+l+23.0%
sub-neg23.0%
+-inverses23.0%
metadata-eval23.0%
neg-sub023.0%
associate--r-23.0%
neg-sub023.0%
+-commutative23.0%
sub-neg23.0%
Simplified23.0%
Taylor expanded in x around 0 96.9%
if 1.5 < x Initial program 40.9%
Taylor expanded in x around inf 95.9%
+-commutative95.9%
rem-square-sqrt95.9%
fabs-sqr95.9%
rem-square-sqrt95.9%
*-inverses95.9%
metadata-eval95.9%
Simplified95.9%
(FPCore (x) :precision binary32 (if (<= x -50.0) (copysign (log (- x)) x) (if (<= x 1.5) (copysign x x) (copysign (log (* x 2.0)) x))))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 1.5f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(logf((x * 2.0f)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(-x)), x); elseif (x <= Float32(1.5)) 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(-50.0)) tmp = sign(x) * abs(log(-x)); elseif (x <= single(1.5)) 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 -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{elif}\;x \leq 1.5:\\
\;\;\;\;\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 < -50Initial program 46.3%
Taylor expanded in x around -inf 44.8%
neg-mul-144.8%
Simplified44.8%
if -50 < x < 1.5Initial program 22.6%
+-commutative22.6%
hypot-1-def22.6%
flip-+22.8%
hypot-1-def22.8%
hypot-1-def22.8%
add-sqr-sqrt22.8%
+-commutative22.8%
hypot-1-def22.8%
+-commutative22.8%
div-sub22.9%
Applied egg-rr23.0%
div-sub22.9%
remove-double-neg22.9%
distribute-neg-frac222.9%
distribute-frac-neg22.9%
neg-sub022.9%
associate--r-22.9%
neg-sub022.9%
+-commutative22.9%
fma-undefine22.9%
unpow222.9%
+-commutative22.9%
associate-+l+23.0%
sub-neg23.0%
+-inverses23.0%
metadata-eval23.0%
neg-sub023.0%
associate--r-23.0%
neg-sub023.0%
+-commutative23.0%
sub-neg23.0%
Simplified23.0%
Taylor expanded in x around 0 96.9%
if 1.5 < x Initial program 40.9%
Taylor expanded in x around inf 95.9%
+-commutative95.9%
rem-square-sqrt95.9%
fabs-sqr95.9%
rem-square-sqrt95.9%
*-inverses95.9%
metadata-eval95.9%
Simplified95.9%
(FPCore (x) :precision binary32 (if (<= x -50.0) (copysign (log (- x)) x) (copysign (log1p x) x)))
float code(float x) {
float tmp;
if (x <= -50.0f) {
tmp = copysignf(logf(-x), x);
} else {
tmp = copysignf(log1pf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-50.0)) tmp = copysign(log(Float32(-x)), x); else tmp = copysign(log1p(x), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < -50Initial program 46.3%
Taylor expanded in x around -inf 44.8%
neg-mul-144.8%
Simplified44.8%
if -50 < x Initial program 29.0%
Taylor expanded in x around 0 28.0%
log1p-define76.6%
rem-square-sqrt44.0%
fabs-sqr44.0%
rem-square-sqrt76.6%
Simplified76.6%
(FPCore (x) :precision binary32 (if (<= x 1.5) (copysign x x) (copysign (log1p x) x)))
float code(float x) {
float tmp;
if (x <= 1.5f) {
tmp = copysignf(x, x);
} else {
tmp = copysignf(log1pf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(1.5)) tmp = copysign(x, x); else tmp = copysign(log1p(x), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < 1.5Initial program 30.3%
+-commutative30.3%
hypot-1-def47.7%
flip-+16.5%
hypot-1-def16.5%
hypot-1-def16.5%
add-sqr-sqrt16.4%
+-commutative16.4%
hypot-1-def16.4%
+-commutative16.4%
div-sub16.5%
Applied egg-rr17.3%
div-sub17.9%
remove-double-neg17.9%
distribute-neg-frac217.9%
distribute-frac-neg17.9%
neg-sub017.9%
associate--r-17.9%
neg-sub017.9%
+-commutative17.9%
fma-undefine17.8%
unpow217.8%
+-commutative17.8%
associate-+l+29.3%
sub-neg29.3%
+-inverses48.0%
metadata-eval48.0%
neg-sub048.0%
associate--r-48.0%
neg-sub048.0%
+-commutative48.0%
sub-neg48.0%
Simplified48.0%
Taylor expanded in x around 0 68.9%
if 1.5 < x Initial program 40.9%
Taylor expanded in x around 0 45.0%
log1p-define45.0%
rem-square-sqrt45.0%
fabs-sqr45.0%
rem-square-sqrt45.0%
Simplified45.0%
(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 33.1%
+-commutative33.1%
hypot-1-def61.2%
flip-+13.9%
hypot-1-def13.9%
hypot-1-def13.9%
add-sqr-sqrt13.9%
+-commutative13.9%
hypot-1-def13.9%
+-commutative13.9%
div-sub14.0%
Applied egg-rr14.5%
div-sub14.9%
remove-double-neg14.9%
distribute-neg-frac214.9%
distribute-frac-neg14.9%
neg-sub014.9%
associate--r-14.9%
neg-sub014.9%
+-commutative14.9%
fma-undefine14.9%
unpow214.9%
+-commutative14.9%
associate-+l+23.3%
sub-neg23.3%
+-inverses37.0%
metadata-eval37.0%
neg-sub038.5%
associate--r-38.5%
neg-sub038.5%
+-commutative38.5%
sub-neg38.5%
Simplified38.5%
Taylor expanded in x around 0 53.4%
(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 2024165
(FPCore (x)
:name "Rust f32::asinh"
:precision binary32
:alt
(! :herbie-platform default (let* ((ax (fabs x)) (ix (/ 1 ax))) (copysign (log1p (+ ax (/ ax (+ (hypot 1 ix) ix)))) x)))
(copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))