| Alternative 1 | |
|---|---|
| Error | 12.6 |
| Cost | 16520 |
(FPCore (x) :precision binary32 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
(FPCore (x)
:precision binary32
(let* ((t_0 (- (fabs x) -1.0))
(t_1 (/ 0.25 (pow x 3.0)))
(t_2 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_2 -2.0)
(copysign (log (* 0.5 (- t_1 (/ 1.0 x)))) x)
(if (<= t_2 0.10000000149011612)
(copysign
(+
(* 0.5 (/ (pow x 2.0) t_0))
(+
(log t_0)
(*
(* 3.0 (+ (/ 1.0 (pow t_0 2.0)) (/ 1.0 t_0)))
(* -0.041666666666666664 (pow x 4.0)))))
x)
(copysign (log (pow (sqrt (/ (- (/ 1.0 x) t_1) 2.0)) 2.0)) x)))))float code(float x) {
return copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
}
float code(float x) {
float t_0 = fabsf(x) - -1.0f;
float t_1 = 0.25f / powf(x, 3.0f);
float t_2 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
float tmp;
if (t_2 <= -2.0f) {
tmp = copysignf(logf((0.5f * (t_1 - (1.0f / x)))), x);
} else if (t_2 <= 0.10000000149011612f) {
tmp = copysignf(((0.5f * (powf(x, 2.0f) / t_0)) + (logf(t_0) + ((3.0f * ((1.0f / powf(t_0, 2.0f)) + (1.0f / t_0))) * (-0.041666666666666664f * powf(x, 4.0f))))), x);
} else {
tmp = copysignf(logf(powf(sqrtf((((1.0f / x) - t_1) / 2.0f)), 2.0f)), x);
}
return tmp;
}
function code(x) return copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) end
function code(x) t_0 = Float32(abs(x) - Float32(-1.0)) t_1 = Float32(Float32(0.25) / (x ^ Float32(3.0))) t_2 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) tmp = Float32(0.0) if (t_2 <= Float32(-2.0)) tmp = copysign(log(Float32(Float32(0.5) * Float32(t_1 - Float32(Float32(1.0) / x)))), x); elseif (t_2 <= Float32(0.10000000149011612)) tmp = copysign(Float32(Float32(Float32(0.5) * Float32((x ^ Float32(2.0)) / t_0)) + Float32(log(t_0) + Float32(Float32(Float32(3.0) * Float32(Float32(Float32(1.0) / (t_0 ^ Float32(2.0))) + Float32(Float32(1.0) / t_0))) * Float32(Float32(-0.041666666666666664) * (x ^ Float32(4.0)))))), x); else tmp = copysign(log((sqrt(Float32(Float32(Float32(Float32(1.0) / x) - t_1) / Float32(2.0))) ^ Float32(2.0))), x); end return tmp end
function tmp = code(x) tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0)))))); end
function tmp_2 = code(x) t_0 = abs(x) - single(-1.0); t_1 = single(0.25) / (x ^ single(3.0)); t_2 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0)))))); tmp = single(0.0); if (t_2 <= single(-2.0)) tmp = sign(x) * abs(log((single(0.5) * (t_1 - (single(1.0) / x))))); elseif (t_2 <= single(0.10000000149011612)) tmp = sign(x) * abs(((single(0.5) * ((x ^ single(2.0)) / t_0)) + (log(t_0) + ((single(3.0) * ((single(1.0) / (t_0 ^ single(2.0))) + (single(1.0) / t_0))) * (single(-0.041666666666666664) * (x ^ single(4.0))))))); else tmp = sign(x) * abs(log((sqrt((((single(1.0) / x) - t_1) / single(2.0))) ^ single(2.0)))); end tmp_2 = tmp; end
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\begin{array}{l}
t_0 := \left|x\right| - -1\\
t_1 := \frac{0.25}{{x}^{3}}\\
t_2 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_2 \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(0.5 \cdot \left(t_1 - \frac{1}{x}\right)\right), x\right)\\
\mathbf{elif}\;t_2 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(0.5 \cdot \frac{{x}^{2}}{t_0} + \left(\log t_0 + \left(3 \cdot \left(\frac{1}{{t_0}^{2}} + \frac{1}{t_0}\right)\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left({\left(\sqrt{\frac{\frac{1}{x} - t_1}{2}}\right)}^{2}\right), x\right)\\
\end{array}
| Original | 20.5 |
|---|---|
| Target | 0.2 |
| Herbie | 12.8 |
if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -2Initial program 16.2
Taylor expanded in x around -inf 0.3
Simplified0.3
[Start]0.3 | \[ \mathsf{copysign}\left(\log \left(\left(0.125 \cdot \frac{1}{{x}^{3}} + \left(\left|x\right| + -1 \cdot x\right)\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
|---|---|
rational.json-simplify-48 [=>]0.3 | \[ \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) + \left(0.125 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{x}\right)\right)}, x\right)
\] |
rational.json-simplify-2 [=>]0.3 | \[ \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{x \cdot -1}\right) + \left(0.125 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{x}\right)\right), x\right)
\] |
rational.json-simplify-8 [<=]0.3 | \[ \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{\left(-x\right)}\right) + \left(0.125 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{x}\right)\right), x\right)
\] |
Taylor expanded in x around 0 0.2
Simplified0.2
[Start]0.2 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
|---|---|
rational.json-simplify-6 [<=]0.2 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \color{blue}{\left(1 \cdot \frac{1}{{x}^{3}}\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [=>]0.2 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \color{blue}{\left(\frac{1}{{x}^{3}} \cdot 1\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
metadata-eval [<=]0.2 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \left(\frac{1}{{x}^{3}} \cdot \color{blue}{\left(0.5 + 0.5\right)}\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-51 [<=]0.2 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \color{blue}{\left(\frac{1}{{x}^{3}} \cdot 0.5 + 0.5 \cdot \frac{1}{{x}^{3}}\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [=>]0.2 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \left(\color{blue}{0.5 \cdot \frac{1}{{x}^{3}}} + 0.5 \cdot \frac{1}{{x}^{3}}\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [<=]0.2 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \left(0.5 \cdot \frac{1}{{x}^{3}} + \color{blue}{\frac{1}{{x}^{3}} \cdot 0.5}\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-51 [=>]0.2 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \color{blue}{\left(0.5 \cdot \left(\frac{1}{{x}^{3}} + \frac{1}{{x}^{3}}\right)\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-43 [=>]0.2 | \[ \mathsf{copysign}\left(\log \left(\color{blue}{0.5 \cdot \left(\left(\frac{1}{{x}^{3}} + \frac{1}{{x}^{3}}\right) \cdot 0.125\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
metadata-eval [<=]0.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \left(\left(\frac{1}{{x}^{3}} + \frac{1}{{x}^{3}}\right) \cdot \color{blue}{\frac{0.5}{4}}\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-49 [<=]0.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \color{blue}{\frac{0.5 \cdot \left(\frac{1}{{x}^{3}} + \frac{1}{{x}^{3}}\right)}{4}} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-51 [<=]0.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{0.5 \cdot \frac{1}{{x}^{3}} + \frac{1}{{x}^{3}} \cdot 0.5}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [<=]0.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{\frac{1}{{x}^{3}} \cdot 0.5} + \frac{1}{{x}^{3}} \cdot 0.5}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [=>]0.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\frac{1}{{x}^{3}} \cdot 0.5 + \color{blue}{0.5 \cdot \frac{1}{{x}^{3}}}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-51 [=>]0.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{\frac{1}{{x}^{3}} \cdot \left(0.5 + 0.5\right)}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
metadata-eval [=>]0.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\frac{1}{{x}^{3}} \cdot \color{blue}{1}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [<=]0.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{1 \cdot \frac{1}{{x}^{3}}}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-6 [=>]0.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{\frac{1}{{x}^{3}}}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
if -2 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001Initial program 25.0
Taylor expanded in x around 0 25.0
Simplified25.0
[Start]25.0 | \[ \mathsf{copysign}\left(-0.041666666666666664 \cdot \left(\left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right) \cdot {x}^{4}\right) + \left(0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + \log \left(1 + \left|x\right|\right)\right), x\right)
\] |
|---|---|
rational.json-simplify-41 [=>]25.0 | \[ \mathsf{copysign}\left(\color{blue}{0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + \left(\log \left(1 + \left|x\right|\right) + -0.041666666666666664 \cdot \left(\left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right) \cdot {x}^{4}\right)\right)}, x\right)
\] |
rational.json-simplify-17 [=>]25.0 | \[ \mathsf{copysign}\left(0.5 \cdot \frac{{x}^{2}}{\color{blue}{\left|x\right| - -1}} + \left(\log \left(1 + \left|x\right|\right) + -0.041666666666666664 \cdot \left(\left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right) \cdot {x}^{4}\right)\right), x\right)
\] |
rational.json-simplify-17 [=>]25.0 | \[ \mathsf{copysign}\left(0.5 \cdot \frac{{x}^{2}}{\left|x\right| - -1} + \left(\log \color{blue}{\left(\left|x\right| - -1\right)} + -0.041666666666666664 \cdot \left(\left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right) \cdot {x}^{4}\right)\right), x\right)
\] |
rational.json-simplify-43 [=>]25.0 | \[ \mathsf{copysign}\left(0.5 \cdot \frac{{x}^{2}}{\left|x\right| - -1} + \left(\log \left(\left|x\right| - -1\right) + \color{blue}{\left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right) \cdot \left({x}^{4} \cdot -0.041666666666666664\right)}\right), x\right)
\] |
if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) Initial program 15.8
Taylor expanded in x around -inf 31.9
Simplified31.9
[Start]31.9 | \[ \mathsf{copysign}\left(\log \left(\left(0.125 \cdot \frac{1}{{x}^{3}} + \left(\left|x\right| + -1 \cdot x\right)\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
|---|---|
rational.json-simplify-48 [=>]31.9 | \[ \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) + \left(0.125 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{x}\right)\right)}, x\right)
\] |
rational.json-simplify-2 [=>]31.9 | \[ \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{x \cdot -1}\right) + \left(0.125 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{x}\right)\right), x\right)
\] |
rational.json-simplify-8 [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{\left(-x\right)}\right) + \left(0.125 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{x}\right)\right), x\right)
\] |
Taylor expanded in x around 0 31.9
Simplified31.9
[Start]31.9 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
|---|---|
rational.json-simplify-6 [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \color{blue}{\left(1 \cdot \frac{1}{{x}^{3}}\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [=>]31.9 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \color{blue}{\left(\frac{1}{{x}^{3}} \cdot 1\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
metadata-eval [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \left(\frac{1}{{x}^{3}} \cdot \color{blue}{\left(0.5 + 0.5\right)}\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-51 [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \color{blue}{\left(\frac{1}{{x}^{3}} \cdot 0.5 + 0.5 \cdot \frac{1}{{x}^{3}}\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [=>]31.9 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \left(\color{blue}{0.5 \cdot \frac{1}{{x}^{3}}} + 0.5 \cdot \frac{1}{{x}^{3}}\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \left(0.5 \cdot \frac{1}{{x}^{3}} + \color{blue}{\frac{1}{{x}^{3}} \cdot 0.5}\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-51 [=>]31.9 | \[ \mathsf{copysign}\left(\log \left(0.125 \cdot \color{blue}{\left(0.5 \cdot \left(\frac{1}{{x}^{3}} + \frac{1}{{x}^{3}}\right)\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-43 [=>]31.9 | \[ \mathsf{copysign}\left(\log \left(\color{blue}{0.5 \cdot \left(\left(\frac{1}{{x}^{3}} + \frac{1}{{x}^{3}}\right) \cdot 0.125\right)} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
metadata-eval [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \left(\left(\frac{1}{{x}^{3}} + \frac{1}{{x}^{3}}\right) \cdot \color{blue}{\frac{0.5}{4}}\right) - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-49 [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \color{blue}{\frac{0.5 \cdot \left(\frac{1}{{x}^{3}} + \frac{1}{{x}^{3}}\right)}{4}} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-51 [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{0.5 \cdot \frac{1}{{x}^{3}} + \frac{1}{{x}^{3}} \cdot 0.5}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{\frac{1}{{x}^{3}} \cdot 0.5} + \frac{1}{{x}^{3}} \cdot 0.5}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [=>]31.9 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\frac{1}{{x}^{3}} \cdot 0.5 + \color{blue}{0.5 \cdot \frac{1}{{x}^{3}}}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-51 [=>]31.9 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{\frac{1}{{x}^{3}} \cdot \left(0.5 + 0.5\right)}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
metadata-eval [=>]31.9 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\frac{1}{{x}^{3}} \cdot \color{blue}{1}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-2 [<=]31.9 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{1 \cdot \frac{1}{{x}^{3}}}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
rational.json-simplify-6 [=>]31.9 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{\color{blue}{\frac{1}{{x}^{3}}}}{4} - 0.5 \cdot \frac{1}{x}\right), x\right)
\] |
Applied egg-rr14.4
Simplified1.0
[Start]14.4 | \[ \mathsf{copysign}\left(0.5 \cdot \log \left({\left(\frac{\frac{1}{x} - \frac{0.25}{{x}^{3}}}{2}\right)}^{2}\right), x\right)
\] |
|---|---|
exponential.json-simplify-13 [=>]14.4 | \[ \mathsf{copysign}\left(\color{blue}{\log \left(\sqrt{{\left(\frac{\frac{1}{x} - \frac{0.25}{{x}^{3}}}{2}\right)}^{2}}\right)}, x\right)
\] |
exponential.json-simplify-23 [=>]1.0 | \[ \mathsf{copysign}\left(\log \color{blue}{\left({\left(\sqrt{\frac{\frac{1}{x} - \frac{0.25}{{x}^{3}}}{2}}\right)}^{2}\right)}, x\right)
\] |
Final simplification12.8
| Alternative 1 | |
|---|---|
| Error | 12.6 |
| Cost | 16520 |
| Alternative 2 | |
|---|---|
| Error | 12.6 |
| Cost | 13192 |
| Alternative 3 | |
|---|---|
| Error | 13.3 |
| Cost | 10088 |
| Alternative 4 | |
|---|---|
| Error | 13.5 |
| Cost | 10056 |
| Alternative 5 | |
|---|---|
| Error | 13.4 |
| Cost | 10056 |
| Alternative 6 | |
|---|---|
| Error | 13.6 |
| Cost | 9864 |
| Alternative 7 | |
|---|---|
| Error | 15.0 |
| Cost | 9796 |
| Alternative 8 | |
|---|---|
| Error | 19.1 |
| Cost | 6596 |
| Alternative 9 | |
|---|---|
| Error | 23.3 |
| Cost | 6564 |
| Alternative 10 | |
|---|---|
| Error | 27.6 |
| Cost | 6464 |
herbie shell --seed 2023074
(FPCore (x)
:name "Rust f32::asinh"
:precision binary32
:herbie-target
(copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))) x)
(copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))