
(FPCore (x) :precision binary32 (asinh x))
float code(float x) {
return asinhf(x);
}
function code(x) return asinh(x) end
function tmp = code(x) tmp = asinh(x); end
\begin{array}{l}
\\
\sinh^{-1} x
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary32 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
float code(float x) {
return copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
}
function code(x) return copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) end
function tmp = code(x) tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0)))))); end
\begin{array}{l}
\\
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\end{array}
(FPCore (x)
:precision binary32
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -1.0)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.004999999888241291)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 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 <= -1.0f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (t_0 <= 0.004999999888241291f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 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(-1.0)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (t_0 <= Float32(0.004999999888241291)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + 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(-1.0)) tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x))); elseif (t_0 <= single(0.004999999888241291)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + 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 -1:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -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) < -1Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
flip-+12.5%
log-div12.5%
hypot-1-def12.5%
hypot-1-def12.5%
add-sqr-sqrt14.3%
Applied egg-rr14.3%
associate--l+52.4%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
if -1 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.00499999989Initial program 20.7%
Taylor expanded in x around 0 20.8%
rem-square-sqrt9.1%
fabs-sqr9.1%
rem-square-sqrt21.1%
unpow221.1%
associate-*l*21.1%
unpow221.1%
*-commutative21.1%
sub-neg21.1%
metadata-eval21.1%
+-commutative21.1%
unpow221.1%
Simplified21.1%
Taylor expanded in x around 0 100.0%
unpow2100.0%
*-commutative100.0%
sub-neg100.0%
unpow2100.0%
*-commutative100.0%
unpow2100.0%
metadata-eval100.0%
Simplified100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
*-commutative100.0%
*-commutative100.0%
+-commutative100.0%
*-commutative100.0%
Applied egg-rr100.0%
if 0.00499999989 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) Initial program 61.1%
+-commutative61.1%
hypot-1-def98.6%
Simplified98.6%
Final simplification99.6%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= x 0.004999999888241291)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
} else if (x <= 0.004999999888241291f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 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(-2.0)) tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x); elseif (x <= Float32(0.004999999888241291)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + 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(-2.0)) tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x))); elseif (x <= single(0.004999999888241291)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + 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 -2:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;x \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -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 < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
flip-+12.5%
log-div12.5%
hypot-1-def12.5%
hypot-1-def12.5%
add-sqr-sqrt14.3%
Applied egg-rr14.3%
associate--l+52.4%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
if -2 < x < 0.00499999989Initial program 20.7%
Taylor expanded in x around 0 20.8%
rem-square-sqrt9.1%
fabs-sqr9.1%
rem-square-sqrt21.1%
unpow221.1%
associate-*l*21.1%
unpow221.1%
*-commutative21.1%
sub-neg21.1%
metadata-eval21.1%
+-commutative21.1%
unpow221.1%
Simplified21.1%
Taylor expanded in x around 0 100.0%
unpow2100.0%
*-commutative100.0%
sub-neg100.0%
unpow2100.0%
*-commutative100.0%
unpow2100.0%
metadata-eval100.0%
Simplified100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
*-commutative100.0%
*-commutative100.0%
+-commutative100.0%
*-commutative100.0%
Applied egg-rr100.0%
if 0.00499999989 < x Initial program 61.1%
+-commutative61.1%
+-commutative61.1%
hypot-1-def98.6%
add-sqr-sqrt98.6%
fabs-sqr98.6%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
Final simplification99.6%
(FPCore (x)
:precision binary32
(let* ((t_0 (* x (* x x))))
(if (<= x -2.0)
(copysign
(log
(/
(-
(-
(+ (/ 0.125 (* x x)) (/ 0.0390625 (* t_0 t_0)))
(/ 0.0625 (* x t_0)))
0.5)
x))
x)
(if (<= x 0.004999999888241291)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
float t_0 = x * (x * x);
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf((((((0.125f / (x * x)) + (0.0390625f / (t_0 * t_0))) - (0.0625f / (x * t_0))) - 0.5f) / x)), x);
} else if (x <= 0.004999999888241291f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
}
return tmp;
}
function code(x) t_0 = Float32(x * Float32(x * x)) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) + Float32(Float32(0.0390625) / Float32(t_0 * t_0))) - Float32(Float32(0.0625) / Float32(x * t_0))) - Float32(0.5)) / x)), x); elseif (x <= Float32(0.004999999888241291)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + 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) t_0 = x * (x * x); tmp = single(0.0); if (x <= single(-2.0)) tmp = sign(x) * abs(log((((((single(0.125) / (x * x)) + (single(0.0390625) / (t_0 * t_0))) - (single(0.0625) / (x * t_0))) - single(0.5)) / x))); elseif (x <= single(0.004999999888241291)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + 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}
t_0 := x \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\left(\frac{0.125}{x \cdot x} + \frac{0.0390625}{t\_0 \cdot t\_0}\right) - \frac{0.0625}{x \cdot t\_0}\right) - 0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -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 < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 99.6%
mul-1-neg99.6%
neg-sub099.6%
Simplified99.6%
if -2 < x < 0.00499999989Initial program 20.7%
Taylor expanded in x around 0 20.8%
rem-square-sqrt9.1%
fabs-sqr9.1%
rem-square-sqrt21.1%
unpow221.1%
associate-*l*21.1%
unpow221.1%
*-commutative21.1%
sub-neg21.1%
metadata-eval21.1%
+-commutative21.1%
unpow221.1%
Simplified21.1%
Taylor expanded in x around 0 100.0%
unpow2100.0%
*-commutative100.0%
sub-neg100.0%
unpow2100.0%
*-commutative100.0%
unpow2100.0%
metadata-eval100.0%
Simplified100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
*-commutative100.0%
*-commutative100.0%
+-commutative100.0%
*-commutative100.0%
Applied egg-rr100.0%
if 0.00499999989 < x Initial program 61.1%
+-commutative61.1%
+-commutative61.1%
hypot-1-def98.6%
add-sqr-sqrt98.6%
fabs-sqr98.6%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
Final simplification99.5%
(FPCore (x)
:precision binary32
(let* ((t_0 (* x (* x x))) (t_1 (* t_0 t_0)) (t_2 (* x t_0)))
(if (<= x -2.0)
(copysign
(log
(/
(- (- (+ (/ 0.125 (* x x)) (/ 0.0390625 t_1)) (/ 0.0625 t_2)) 0.5)
x))
x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign
(log
(* x (+ 2.0 (+ (+ (/ 0.0625 t_1) (/ 0.5 (* x x))) (/ -0.125 t_2)))))
x)))))
float code(float x) {
float t_0 = x * (x * x);
float t_1 = t_0 * t_0;
float t_2 = x * t_0;
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf((((((0.125f / (x * x)) + (0.0390625f / t_1)) - (0.0625f / t_2)) - 0.5f) / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x * (2.0f + (((0.0625f / t_1) + (0.5f / (x * x))) + (-0.125f / t_2))))), x);
}
return tmp;
}
function code(x) t_0 = Float32(x * Float32(x * x)) t_1 = Float32(t_0 * t_0) t_2 = Float32(x * t_0) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) + Float32(Float32(0.0390625) / t_1)) - Float32(Float32(0.0625) / t_2)) - Float32(0.5)) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(x * Float32(Float32(2.0) + Float32(Float32(Float32(Float32(0.0625) / t_1) + Float32(Float32(0.5) / Float32(x * x))) + Float32(Float32(-0.125) / t_2))))), x); end return tmp end
function tmp_2 = code(x) t_0 = x * (x * x); t_1 = t_0 * t_0; t_2 = x * t_0; tmp = single(0.0); if (x <= single(-2.0)) tmp = sign(x) * abs(log((((((single(0.125) / (x * x)) + (single(0.0390625) / t_1)) - (single(0.0625) / t_2)) - single(0.5)) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((x * (single(2.0) + (((single(0.0625) / t_1) + (single(0.5) / (x * x))) + (single(-0.125) / t_2)))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
t_1 := t\_0 \cdot t\_0\\
t_2 := x \cdot t\_0\\
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\left(\frac{0.125}{x \cdot x} + \frac{0.0390625}{t\_1}\right) - \frac{0.0625}{t\_2}\right) - 0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{t\_1} + \frac{0.5}{x \cdot x}\right) + \frac{-0.125}{t\_2}\right)\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 99.6%
mul-1-neg99.6%
neg-sub099.6%
Simplified99.6%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
+-commutative59.9%
+-commutative59.9%
hypot-1-def98.5%
add-sqr-sqrt98.5%
fabs-sqr98.5%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
Taylor expanded in x around inf 98.5%
associate--l+98.5%
sub-neg98.5%
+-commutative98.5%
associate-*r/98.5%
metadata-eval98.5%
metadata-eval98.5%
pow-sqr98.5%
cube-unmult98.5%
cube-unmult98.5%
unpow298.5%
associate-*r/98.5%
metadata-eval98.5%
metadata-eval98.5%
pow-plus98.5%
unpow398.5%
associate-*r*98.5%
Simplified98.5%
Final simplification99.3%
(FPCore (x)
:precision binary32
(let* ((t_0 (* x (* x x))) (t_1 (* x t_0)))
(if (<= x -2.0)
(copysign (log (/ (- (- (/ 0.125 (* x x)) 0.5) (/ 0.0625 t_1)) x)) x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign
(log
(*
x
(+
2.0
(+ (+ (/ 0.0625 (* t_0 t_0)) (/ 0.5 (* x x))) (/ -0.125 t_1)))))
x)))))
float code(float x) {
float t_0 = x * (x * x);
float t_1 = x * t_0;
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(((((0.125f / (x * x)) - 0.5f) - (0.0625f / t_1)) / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x * (2.0f + (((0.0625f / (t_0 * t_0)) + (0.5f / (x * x))) + (-0.125f / t_1))))), x);
}
return tmp;
}
function code(x) t_0 = Float32(x * Float32(x * x)) t_1 = Float32(x * t_0) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) - Float32(0.5)) - Float32(Float32(0.0625) / t_1)) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(x * Float32(Float32(2.0) + Float32(Float32(Float32(Float32(0.0625) / Float32(t_0 * t_0)) + Float32(Float32(0.5) / Float32(x * x))) + Float32(Float32(-0.125) / t_1))))), x); end return tmp end
function tmp_2 = code(x) t_0 = x * (x * x); t_1 = x * t_0; tmp = single(0.0); if (x <= single(-2.0)) tmp = sign(x) * abs(log(((((single(0.125) / (x * x)) - single(0.5)) - (single(0.0625) / t_1)) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((x * (single(2.0) + (((single(0.0625) / (t_0 * t_0)) + (single(0.5) / (x * x))) + (single(-0.125) / t_1)))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
t_1 := x \cdot t\_0\\
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\frac{0.125}{x \cdot x} - 0.5\right) - \frac{0.0625}{t\_1}}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{t\_0 \cdot t\_0} + \frac{0.5}{x \cdot x}\right) + \frac{-0.125}{t\_1}\right)\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 99.3%
mul-1-neg99.3%
neg-sub099.3%
+-commutative99.3%
associate--l+99.4%
metadata-eval99.4%
pow-plus99.4%
unpow399.4%
associate-*r*99.4%
associate-*l*99.4%
unpow299.4%
associate-*r/99.4%
metadata-eval99.4%
Simplified99.4%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
+-commutative59.9%
+-commutative59.9%
hypot-1-def98.5%
add-sqr-sqrt98.5%
fabs-sqr98.5%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
Taylor expanded in x around inf 98.5%
associate--l+98.5%
sub-neg98.5%
+-commutative98.5%
associate-*r/98.5%
metadata-eval98.5%
metadata-eval98.5%
pow-sqr98.5%
cube-unmult98.5%
cube-unmult98.5%
unpow298.5%
associate-*r/98.5%
metadata-eval98.5%
metadata-eval98.5%
pow-plus98.5%
unpow398.5%
associate-*r*98.5%
Simplified98.5%
Final simplification99.3%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign
(log (/ (- (- (/ 0.125 (* x x)) 0.5) (/ 0.0625 (* x (* x (* x x))))) x))
x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign
(log
(*
x
(+ (+ (/ 0.5 (* x x)) (/ x x)) (- 1.0 (/ 0.125 (* (* x x) (* x x)))))))
x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(((((0.125f / (x * x)) - 0.5f) - (0.0625f / (x * (x * (x * x))))) / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x * (((0.5f / (x * x)) + (x / x)) + (1.0f - (0.125f / ((x * x) * (x * x))))))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) - Float32(0.5)) - Float32(Float32(0.0625) / Float32(x * Float32(x * Float32(x * x))))) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(x * Float32(Float32(Float32(Float32(0.5) / Float32(x * x)) + Float32(x / x)) + Float32(Float32(1.0) - Float32(Float32(0.125) / Float32(Float32(x * x) * 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(((((single(0.125) / (x * x)) - single(0.5)) - (single(0.0625) / (x * (x * (x * x))))) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((x * (((single(0.5) / (x * x)) + (x / x)) + (single(1.0) - (single(0.125) / ((x * x) * (x * x)))))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\frac{0.125}{x \cdot x} - 0.5\right) - \frac{0.0625}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)}}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(\left(\frac{0.5}{x \cdot x} + \frac{x}{x}\right) + \left(1 - \frac{0.125}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\right)\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 99.3%
mul-1-neg99.3%
neg-sub099.3%
+-commutative99.3%
associate--l+99.4%
metadata-eval99.4%
pow-plus99.4%
unpow399.4%
associate-*r*99.4%
associate-*l*99.4%
unpow299.4%
associate-*r/99.4%
metadata-eval99.4%
Simplified99.4%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
Taylor expanded in x around inf 98.2%
+-commutative98.2%
associate-*r/98.2%
metadata-eval98.2%
associate--l+98.2%
+-commutative98.2%
rem-square-sqrt98.3%
fabs-sqr98.3%
rem-square-sqrt98.2%
unpow298.2%
metadata-eval98.2%
pow-plus98.2%
unpow398.2%
associate-*r*98.2%
Simplified98.2%
Final simplification99.2%
(FPCore (x)
:precision binary32
(let* ((t_0 (* x (* x (* x x)))))
(if (<= x -2.0)
(copysign (log (/ (- (- (/ 0.125 (* x x)) 0.5) (/ 0.0625 t_0)) x)) x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign (log (* x (+ 2.0 (+ (/ 0.5 (* x x)) (/ -0.125 t_0))))) x)))))
float code(float x) {
float t_0 = x * (x * (x * x));
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(((((0.125f / (x * x)) - 0.5f) - (0.0625f / t_0)) / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x * (2.0f + ((0.5f / (x * x)) + (-0.125f / t_0))))), x);
}
return tmp;
}
function code(x) t_0 = Float32(x * Float32(x * Float32(x * x))) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) - Float32(0.5)) - Float32(Float32(0.0625) / t_0)) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(x * Float32(Float32(2.0) + Float32(Float32(Float32(0.5) / Float32(x * x)) + Float32(Float32(-0.125) / t_0))))), x); end return tmp end
function tmp_2 = code(x) t_0 = x * (x * (x * x)); tmp = single(0.0); if (x <= single(-2.0)) tmp = sign(x) * abs(log(((((single(0.125) / (x * x)) - single(0.5)) - (single(0.0625) / t_0)) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((x * (single(2.0) + ((single(0.5) / (x * x)) + (single(-0.125) / t_0)))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\frac{0.125}{x \cdot x} - 0.5\right) - \frac{0.0625}{t\_0}}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \frac{-0.125}{t\_0}\right)\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 99.3%
mul-1-neg99.3%
neg-sub099.3%
+-commutative99.3%
associate--l+99.4%
metadata-eval99.4%
pow-plus99.4%
unpow399.4%
associate-*r*99.4%
associate-*l*99.4%
unpow299.4%
associate-*r/99.4%
metadata-eval99.4%
Simplified99.4%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
+-commutative59.9%
+-commutative59.9%
hypot-1-def98.5%
add-sqr-sqrt98.5%
fabs-sqr98.5%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
Taylor expanded in x around inf 98.2%
associate--l+98.2%
unpow298.2%
associate-*r/98.2%
metadata-eval98.2%
sub-neg98.2%
metadata-eval98.2%
pow-plus98.2%
unpow398.2%
associate-*r*98.2%
distribute-neg-frac98.2%
metadata-eval98.2%
associate-*l*98.2%
Simplified98.2%
Final simplification99.2%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (/ (- (/ 0.125 (* x x)) 0.5) x)) x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign
(log (* x (+ 2.0 (+ (/ 0.5 (* x x)) (/ -0.125 (* x (* x (* x x))))))))
x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf((((0.125f / (x * x)) - 0.5f) / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x * (2.0f + ((0.5f / (x * x)) + (-0.125f / (x * (x * (x * x)))))))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) - Float32(0.5)) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(x * Float32(Float32(2.0) + Float32(Float32(Float32(0.5) / Float32(x * x)) + Float32(Float32(-0.125) / Float32(x * Float32(x * 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((((single(0.125) / (x * x)) - single(0.5)) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((x * (single(2.0) + ((single(0.5) / (x * x)) + (single(-0.125) / (x * (x * (x * x))))))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\frac{0.125}{x \cdot x} - 0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \frac{-0.125}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)}\right)\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 99.0%
mul-1-neg99.0%
distribute-neg-frac299.0%
unpow299.0%
associate-*r/99.0%
metadata-eval99.0%
neg-mul-199.0%
*-commutative99.0%
Simplified99.0%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
+-commutative59.9%
+-commutative59.9%
hypot-1-def98.5%
add-sqr-sqrt98.5%
fabs-sqr98.5%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
Taylor expanded in x around inf 98.2%
associate--l+98.2%
unpow298.2%
associate-*r/98.2%
metadata-eval98.2%
sub-neg98.2%
metadata-eval98.2%
pow-plus98.2%
unpow398.2%
associate-*r*98.2%
distribute-neg-frac98.2%
metadata-eval98.2%
associate-*l*98.2%
Simplified98.2%
Final simplification99.1%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (/ (- (/ 0.125 (* x x)) 0.5) x)) x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign (log (* x (+ 2.0 (/ 0.5 (* x x))))) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf((((0.125f / (x * x)) - 0.5f) / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x * (2.0f + (0.5f / (x * x))))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) - Float32(0.5)) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(x * Float32(Float32(2.0) + Float32(Float32(0.5) / 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((((single(0.125) / (x * x)) - single(0.5)) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((x * (single(2.0) + (single(0.5) / (x * x)))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\frac{0.125}{x \cdot x} - 0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \frac{0.5}{x \cdot x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 99.0%
mul-1-neg99.0%
distribute-neg-frac299.0%
unpow299.0%
associate-*r/99.0%
metadata-eval99.0%
neg-mul-199.0%
*-commutative99.0%
Simplified99.0%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
Taylor expanded in x around inf 97.6%
associate-+r+97.6%
metadata-eval97.6%
unpow297.6%
associate-*r/97.6%
unpow297.6%
+-commutative97.6%
rem-square-sqrt97.6%
fabs-sqr97.6%
rem-square-sqrt97.6%
unpow297.6%
associate-*r/97.6%
metadata-eval97.6%
unpow297.6%
unpow297.6%
Simplified97.6%
*-commutative97.6%
*-inverses97.6%
+-commutative97.6%
+-commutative97.6%
associate-+l+97.6%
metadata-eval97.6%
Applied egg-rr97.6%
Final simplification99.0%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign (log (* x (+ 2.0 (/ 0.5 (* x x))))) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((x * (2.0f + (0.5f / (x * x))))), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(x * Float32(Float32(2.0) + Float32(Float32(0.5) / 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((single(-0.5) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((x * (single(2.0) + (single(0.5) / (x * x)))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \frac{0.5}{x \cdot x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 96.7%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
Taylor expanded in x around inf 97.6%
associate-+r+97.6%
metadata-eval97.6%
unpow297.6%
associate-*r/97.6%
unpow297.6%
+-commutative97.6%
rem-square-sqrt97.6%
fabs-sqr97.6%
rem-square-sqrt97.6%
unpow297.6%
associate-*r/97.6%
metadata-eval97.6%
unpow297.6%
unpow297.6%
Simplified97.6%
*-commutative97.6%
*-inverses97.6%
+-commutative97.6%
+-commutative97.6%
associate-+l+97.6%
metadata-eval97.6%
Applied egg-rr97.6%
Final simplification98.5%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign (log (/ 0.5 x)) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(logf((0.5f / x)), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(-0.5) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x); else tmp = copysign(log(Float32(Float32(0.5) / x)), x); end return tmp end
function tmp_2 = code(x) tmp = single(0.0); if (x <= single(-2.0)) tmp = sign(x) * abs(log((single(-0.5) / x))); elseif (x <= single(1.0)) tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666)))))); else tmp = sign(x) * abs(log((single(0.5) / x))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 96.7%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
Taylor expanded in x around inf 97.6%
associate-+r+97.6%
metadata-eval97.6%
unpow297.6%
associate-*r/97.6%
unpow297.6%
+-commutative97.6%
rem-square-sqrt97.6%
fabs-sqr97.6%
rem-square-sqrt97.6%
unpow297.6%
associate-*r/97.6%
metadata-eval97.6%
unpow297.6%
unpow297.6%
Simplified97.6%
Taylor expanded in x around 0 97.6%
Final simplification98.4%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (/ -0.5 x)) x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign (log1p x) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf((-0.5f / x)), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), 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(Float32(-0.5) / x)), x); elseif (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), 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(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
+-commutative55.5%
+-commutative55.5%
hypot-1-def99.9%
add-sqr-sqrt-0.0%
fabs-sqr-0.0%
add-sqr-sqrt15.1%
Applied egg-rr15.1%
Taylor expanded in x around -inf 96.7%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
Taylor expanded in x around 0 43.7%
log1p-define43.7%
rem-square-sqrt43.7%
fabs-sqr43.7%
rem-square-sqrt43.7%
Simplified43.7%
Final simplification85.2%
(FPCore (x)
:precision binary32
(if (<= x -2.0)
(copysign (log (- x)) x)
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign (log1p x) x))))
float code(float x) {
float tmp;
if (x <= -2.0f) {
tmp = copysignf(logf(-x), x);
} else if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), 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(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), 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 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < -2Initial program 55.5%
Taylor expanded in x around -inf 43.5%
if -2 < x < 1Initial program 21.8%
Taylor expanded in x around 0 21.6%
rem-square-sqrt10.1%
fabs-sqr10.1%
rem-square-sqrt21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
*-commutative21.9%
sub-neg21.9%
metadata-eval21.9%
+-commutative21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in x around 0 99.6%
unpow299.6%
*-commutative99.6%
sub-neg99.6%
unpow299.6%
*-commutative99.6%
unpow299.6%
metadata-eval99.6%
Simplified99.6%
distribute-rgt-in99.6%
*-un-lft-identity99.6%
*-commutative99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < x Initial program 59.9%
Taylor expanded in x around 0 43.7%
log1p-define43.7%
rem-square-sqrt43.7%
fabs-sqr43.7%
rem-square-sqrt43.7%
Simplified43.7%
Final simplification72.9%
(FPCore (x)
:precision binary32
(if (<= x 1.0)
(copysign
(+
x
(*
x
(*
(* x x)
(+
(* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
-0.16666666666666666))))
x)
(copysign (log1p x) x)))
float code(float x) {
float tmp;
if (x <= 1.0f) {
tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
} else {
tmp = copysignf(log1pf(x), x);
}
return tmp;
}
function code(x) tmp = Float32(0.0) if (x <= Float32(1.0)) tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x); else tmp = copysign(log1p(x), x); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < 1Initial program 32.1%
Taylor expanded in x around 0 18.6%
rem-square-sqrt7.0%
fabs-sqr7.0%
rem-square-sqrt18.8%
unpow218.8%
associate-*l*18.8%
unpow218.8%
*-commutative18.8%
sub-neg18.8%
metadata-eval18.8%
+-commutative18.8%
unpow218.8%
Simplified18.8%
Taylor expanded in x around 0 71.4%
unpow271.4%
*-commutative71.4%
sub-neg71.4%
unpow271.4%
*-commutative71.4%
unpow271.4%
metadata-eval71.4%
Simplified71.4%
distribute-rgt-in71.4%
*-un-lft-identity71.4%
*-commutative71.4%
*-commutative71.4%
+-commutative71.4%
*-commutative71.4%
Applied egg-rr71.4%
if 1 < x Initial program 59.9%
Taylor expanded in x around 0 43.7%
log1p-define43.7%
rem-square-sqrt43.7%
fabs-sqr43.7%
rem-square-sqrt43.7%
Simplified43.7%
Final simplification64.6%
(FPCore (x) :precision binary32 (copysign x x))
float code(float x) {
return copysignf(x, x);
}
function code(x) return copysign(x, x) end
function tmp = code(x) tmp = sign(x) * abs(x); end
\begin{array}{l}
\\
\mathsf{copysign}\left(x, x\right)
\end{array}
Initial program 39.0%
Taylor expanded in x around 0 30.4%
rem-square-sqrt15.6%
fabs-sqr15.6%
rem-square-sqrt20.4%
Simplified20.4%
Taylor expanded in x around 0 56.5%
(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 2024107
(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))