?

Average Accuracy: 36.2% → 99.5%
Time: 11.1s
Precision: binary32
Cost: 26052

?

\[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
\[\begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -1.5:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}\right), x\right)\\ \end{array} \]
(FPCore (x)
 :precision binary32
 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
(FPCore (x)
 :precision binary32
 (if (<= (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x) -1.5)
   (copysign (log (+ (fabs x) (hypot 1.0 x))) x)
   (copysign (log1p (+ x (/ x (/ (+ 1.0 (hypot 1.0 x)) x)))) x)))
float code(float x) {
	return copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
}
float code(float x) {
	float tmp;
	if (copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x) <= -1.5f) {
		tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
	} else {
		tmp = copysignf(log1pf((x + (x / ((1.0f + hypotf(1.0f, x)) / x)))), 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)
	tmp = Float32(0.0)
	if (copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) <= Float32(-1.5))
		tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x);
	else
		tmp = copysign(log1p(Float32(x + Float32(x / Float32(Float32(Float32(1.0) + hypot(Float32(1.0), x)) / x)))), x);
	end
	return tmp
end
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -1.5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}\right), x\right)\\


\end{array}

Error?

Target

Original36.2%
Target99.5%
Herbie99.5%
\[\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, \frac{1}{\left|x\right|}\right) + \frac{1}{\left|x\right|}}\right), x\right) \]

Derivation?

  1. Split input into 2 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -1.5

    1. Initial program 49.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Simplified99.3%

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
      Proof

      [Start]49.8

      \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]

      +-commutative [=>]49.8

      \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right) \]

      hypot-1-def [=>]99.3

      \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]

    if -1.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x)

    1. Initial program 31.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Applied egg-rr97.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, x\right) - 1\right)\right)}, x\right) \]
      Proof

      [Start]31.7

      \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]

      log1p-expm1-u [=>]31.7

      \[ \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)\right)}, x\right) \]

      expm1-udef [=>]31.7

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{e^{\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)} - 1}\right), x\right) \]

      add-exp-log [<=]31.7

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)} - 1\right), x\right) \]

      associate--l+ [=>]81.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\left|x\right| + \left(\sqrt{x \cdot x + 1} - 1\right)}\right), x\right) \]

      add-sqr-sqrt [=>]48.9

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \left(\sqrt{x \cdot x + 1} - 1\right)\right), x\right) \]

      fabs-sqr [=>]48.9

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \left(\sqrt{x \cdot x + 1} - 1\right)\right), x\right) \]

      add-sqr-sqrt [<=]81.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{x} + \left(\sqrt{x \cdot x + 1} - 1\right)\right), x\right) \]

      +-commutative [=>]81.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\sqrt{\color{blue}{1 + x \cdot x}} - 1\right)\right), x\right) \]

      sqr-abs [<=]81.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\sqrt{1 + \color{blue}{\left|x\right| \cdot \left|x\right|}} - 1\right)\right), x\right) \]

      hypot-1-def [=>]97.8

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\color{blue}{\mathsf{hypot}\left(1, \left|x\right|\right)} - 1\right)\right), x\right) \]

      add-sqr-sqrt [=>]65.8

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right) - 1\right)\right), x\right) \]

      fabs-sqr [=>]65.8

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right) - 1\right)\right), x\right) \]

      add-sqr-sqrt [<=]97.8

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, \color{blue}{x}\right) - 1\right)\right), x\right) \]
    3. Applied egg-rr83.1%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\left(x \cdot x + 0\right) \cdot \frac{1}{1 + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      Proof

      [Start]97.8

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, x\right) - 1\right)\right), x\right) \]

      flip-- [=>]81.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right) - 1 \cdot 1}{\mathsf{hypot}\left(1, x\right) + 1}}\right), x\right) \]

      div-inv [=>]81.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\left(\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right) - 1 \cdot 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}}\right), x\right) \]

      metadata-eval [=>]81.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right) - \color{blue}{1}\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      hypot-udef [=>]81.4

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\color{blue}{\sqrt{1 \cdot 1 + x \cdot x}} \cdot \mathsf{hypot}\left(1, x\right) - 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      hypot-udef [=>]81.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\sqrt{1 \cdot 1 + x \cdot x} \cdot \color{blue}{\sqrt{1 \cdot 1 + x \cdot x}} - 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      add-sqr-sqrt [<=]81.5

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\color{blue}{\left(1 \cdot 1 + x \cdot x\right)} - 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      metadata-eval [=>]81.5

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\left(\color{blue}{1} + x \cdot x\right) - 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      +-commutative [=>]81.5

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\color{blue}{\left(x \cdot x + 1\right)} - 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      associate--l+ [=>]83.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\left(x \cdot x + \left(1 - 1\right)\right)} \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      metadata-eval [=>]83.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(x \cdot x + \color{blue}{0}\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      +-commutative [=>]83.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(x \cdot x + 0\right) \cdot \frac{1}{\color{blue}{1 + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
    4. Simplified83.2%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\frac{x \cdot x}{1 + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      Proof

      [Start]83.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(x \cdot x + 0\right) \cdot \frac{1}{1 + \mathsf{hypot}\left(1, x\right)}\right), x\right) \]

      associate-*r/ [=>]83.2

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\frac{\left(x \cdot x + 0\right) \cdot 1}{1 + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]

      +-rgt-identity [=>]83.2

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{\color{blue}{\left(x \cdot x\right)} \cdot 1}{1 + \mathsf{hypot}\left(1, x\right)}\right), x\right) \]

      *-rgt-identity [=>]83.2

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{\color{blue}{x \cdot x}}{1 + \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    5. Applied egg-rr97.6%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}\right)} - 1\right)}\right), x\right) \]
      Proof

      [Start]83.2

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x \cdot x}{1 + \mathsf{hypot}\left(1, x\right)}\right), x\right) \]

      expm1-log1p-u [=>]83.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot x}{1 + \mathsf{hypot}\left(1, x\right)}\right)\right)}\right), x\right) \]

      expm1-udef [=>]81.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x \cdot x}{1 + \mathsf{hypot}\left(1, x\right)}\right)} - 1\right)}\right), x\right) \]

      associate-/l* [=>]97.6

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}}\right)} - 1\right)\right), x\right) \]
    6. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}}\right), x\right) \]
      Proof

      [Start]97.6

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(e^{\mathsf{log1p}\left(\frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}\right)} - 1\right)\right), x\right) \]

      expm1-def [=>]99.4

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}\right)\right)}\right), x\right) \]

      expm1-log1p [=>]99.6

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}}\right), x\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -1.5:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}\right), x\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy98.2%
Cost10020
\[\begin{array}{l} \mathbf{if}\;x \leq -0.20000000298023224:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{1}{\frac{1}{\mathsf{hypot}\left(1, x\right) + -1}}\right), x\right)\\ \end{array} \]
Alternative 2
Accuracy99.5%
Cost10020
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x}{\frac{1 + \mathsf{hypot}\left(1, x\right)}{x}}\right), x\right)\\ \end{array} \]
Alternative 3
Accuracy98.8%
Cost9896
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2\right), x\right)\\ \mathbf{elif}\;x \leq 0.009999999776482582:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x \cdot x}{2 + \left(x \cdot x\right) \cdot 0.5}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
Alternative 4
Accuracy99.4%
Cost9896
\[\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.009999999776482582:\\ \;\;\;\;\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} \]
Alternative 5
Accuracy98.2%
Cost9892
\[\begin{array}{l} \mathbf{if}\;x \leq -0.20000000298023224:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, x\right) + -1\right)\right), x\right)\\ \end{array} \]
Alternative 6
Accuracy98.3%
Cost6984
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2\right), x\right)\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x \cdot x}{2 + \left(x \cdot x\right) \cdot 0.5}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\ \end{array} \]
Alternative 7
Accuracy98.1%
Cost6760
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2\right), x\right)\\ \mathbf{elif}\;x \leq 0.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} \]
Alternative 8
Accuracy83.9%
Cost6664
\[\begin{array}{l} \mathbf{if}\;x \leq -5:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 9
Accuracy97.3%
Cost6664
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 10
Accuracy97.5%
Cost6664
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\ \end{array} \]
Alternative 11
Accuracy97.4%
Cost6664
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\ \end{array} \]
Alternative 12
Accuracy68.8%
Cost6564
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
Alternative 13
Accuracy62.4%
Cost6532
\[\begin{array}{l} \mathbf{if}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
Alternative 14
Accuracy54.1%
Cost3264
\[\mathsf{copysign}\left(x, x\right) \]

Error

Reproduce?

herbie shell --seed 2023126 
(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))