?

Average Accuracy: 30.1% → 99.5%
Time: 7.1s
Precision: binary64
Cost: 91400

?

\[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
\[\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 -10:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\ \mathbf{elif}\;t_0 \leq 10^{-8}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
(FPCore (x)
 :precision binary64
 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
   (if (<= t_0 -10.0)
     (copysign (log (/ 1.0 (+ (* x -2.0) (/ -0.5 x)))) x)
     (if (<= t_0 1e-8)
       (copysign
        (+
         (fma -0.16666666666666666 (pow x 3.0) (* 0.075 (pow x 5.0)))
         (expm1 (log1p x)))
        x)
       (copysign (log (+ x (hypot 1.0 x))) x)))))
double code(double x) {
	return copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
}
double code(double x) {
	double t_0 = copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
	double tmp;
	if (t_0 <= -10.0) {
		tmp = copysign(log((1.0 / ((x * -2.0) + (-0.5 / x)))), x);
	} else if (t_0 <= 1e-8) {
		tmp = copysign((fma(-0.16666666666666666, pow(x, 3.0), (0.075 * pow(x, 5.0))) + expm1(log1p(x))), x);
	} else {
		tmp = copysign(log((x + hypot(1.0, x))), x);
	}
	return tmp;
}
function code(x)
	return copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x)
end
function code(x)
	t_0 = copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x)
	tmp = 0.0
	if (t_0 <= -10.0)
		tmp = copysign(log(Float64(1.0 / Float64(Float64(x * -2.0) + Float64(-0.5 / x)))), x);
	elseif (t_0 <= 1e-8)
		tmp = copysign(Float64(fma(-0.16666666666666666, (x ^ 3.0), Float64(0.075 * (x ^ 5.0))) + expm1(log1p(x))), x);
	else
		tmp = copysign(log(Float64(x + hypot(1.0, x))), x);
	end
	return tmp
end
code[x_] := N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x_] := Block[{t$95$0 = N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]}, If[LessEqual[t$95$0, -10.0], N[With[{TMP1 = Abs[N[Log[N[(1.0 / N[(N[(x * -2.0), $MachinePrecision] + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[t$95$0, 1e-8], N[With[{TMP1 = Abs[N[(N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision] + N[(0.075 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(Exp[N[Log[1 + x], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]]
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\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 -10:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\

\mathbf{elif}\;t_0 \leq 10^{-8}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right), x\right)\\

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


\end{array}

Error?

Target

Original30.1%
Target99.9%
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 3 regimes
  2. if (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < -10

    1. Initial program 50.7%

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

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

      [Start]50.7

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

      +-commutative [=>]50.7

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

      hypot-1-def [=>]99.8

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

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

      [Start]99.8

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

      +-commutative [=>]99.8

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

      flip-+ [=>]0.6

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

      hypot-udef [=>]0.6

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

      hypot-udef [=>]0.6

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

      add-sqr-sqrt [<=]0.6

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

      metadata-eval [=>]0.6

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

      sqr-abs [=>]0.6

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

      add-sqr-sqrt [=>]0.0

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

      fabs-sqr [=>]0.0

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

      add-sqr-sqrt [<=]1.3

      \[ \mathsf{copysign}\left(\log \left(\frac{\left(1 + x \cdot x\right) - x \cdot x}{\mathsf{hypot}\left(1, x\right) - \color{blue}{x}}\right), x\right) \]
    4. Taylor expanded in x around -inf 1.3%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\left(1 + x \cdot x\right) - x \cdot x}{\color{blue}{-2 \cdot x - 0.5 \cdot \frac{1}{x}}}\right), x\right) \]
    5. Simplified1.3%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\left(1 + x \cdot x\right) - x \cdot x}{\color{blue}{x \cdot -2 - \frac{0.5}{x}}}\right), x\right) \]
      Proof

      [Start]1.3

      \[ \mathsf{copysign}\left(\log \left(\frac{\left(1 + x \cdot x\right) - x \cdot x}{-2 \cdot x - 0.5 \cdot \frac{1}{x}}\right), x\right) \]

      *-commutative [=>]1.3

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

      associate-*r/ [=>]1.3

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

      metadata-eval [=>]1.3

      \[ \mathsf{copysign}\left(\log \left(\frac{\left(1 + x \cdot x\right) - x \cdot x}{x \cdot -2 - \frac{\color{blue}{0.5}}{x}}\right), x\right) \]
    6. Taylor expanded in x around 0 99.8%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{1}}{x \cdot -2 - \frac{0.5}{x}}\right), x\right) \]

    if -10 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < 1e-8

    1. Initial program 8.1%

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

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

      [Start]8.1

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

      +-commutative [=>]8.1

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

      hypot-1-def [=>]8.1

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

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

      [Start]8.1

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

      *-un-lft-identity [=>]8.1

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

      log-prod [=>]8.1

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

      metadata-eval [=>]8.1

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

      add-sqr-sqrt [=>]3.2

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

      fabs-sqr [=>]3.2

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

      add-sqr-sqrt [<=]8.0

      \[ \mathsf{copysign}\left(0 + \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right), x\right) \]
    4. Simplified8.0%

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

      [Start]8.0

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

      +-lft-identity [=>]8.0

      \[ \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    5. Taylor expanded in x around 0 99.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{-0.16666666666666666 \cdot {x}^{3} + \left(0.075 \cdot {x}^{5} + x\right)}, x\right) \]
    6. Applied egg-rr7.5%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{e^{\mathsf{log1p}\left(x\right)} - \left(1 - \mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right)\right)}, x\right) \]
      Proof

      [Start]99.4

      \[ \mathsf{copysign}\left(-0.16666666666666666 \cdot {x}^{3} + \left(0.075 \cdot {x}^{5} + x\right), x\right) \]

      associate-+r+ [=>]99.4

      \[ \mathsf{copysign}\left(\color{blue}{\left(-0.16666666666666666 \cdot {x}^{3} + 0.075 \cdot {x}^{5}\right) + x}, x\right) \]

      +-commutative [=>]99.4

      \[ \mathsf{copysign}\left(\color{blue}{x + \left(-0.16666666666666666 \cdot {x}^{3} + 0.075 \cdot {x}^{5}\right)}, x\right) \]

      expm1-log1p-u [=>]99.4

      \[ \mathsf{copysign}\left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right)} + \left(-0.16666666666666666 \cdot {x}^{3} + 0.075 \cdot {x}^{5}\right), x\right) \]

      expm1-udef [=>]8.0

      \[ \mathsf{copysign}\left(\color{blue}{\left(e^{\mathsf{log1p}\left(x\right)} - 1\right)} + \left(-0.16666666666666666 \cdot {x}^{3} + 0.075 \cdot {x}^{5}\right), x\right) \]

      associate-+l- [=>]7.5

      \[ \mathsf{copysign}\left(\color{blue}{e^{\mathsf{log1p}\left(x\right)} - \left(1 - \left(-0.16666666666666666 \cdot {x}^{3} + 0.075 \cdot {x}^{5}\right)\right)}, x\right) \]

      fma-def [=>]7.5

      \[ \mathsf{copysign}\left(e^{\mathsf{log1p}\left(x\right)} - \left(1 - \color{blue}{\mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right)}\right), x\right) \]
    7. Simplified99.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right)}, x\right) \]
      Proof

      [Start]7.5

      \[ \mathsf{copysign}\left(e^{\mathsf{log1p}\left(x\right)} - \left(1 - \mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right)\right), x\right) \]

      associate--r- [=>]8.0

      \[ \mathsf{copysign}\left(\color{blue}{\left(e^{\mathsf{log1p}\left(x\right)} - 1\right) + \mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right)}, x\right) \]

      +-commutative [=>]8.0

      \[ \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right) + \left(e^{\mathsf{log1p}\left(x\right)} - 1\right)}, x\right) \]

      expm1-def [=>]99.4

      \[ \mathsf{copysign}\left(\mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right) + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right)}, x\right) \]

    if 1e-8 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x)

    1. Initial program 50.9%

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

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

      [Start]50.9

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

      +-commutative [=>]50.9

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

      hypot-1-def [=>]99.5

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

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

      [Start]99.5

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

      *-un-lft-identity [=>]99.5

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

      log-prod [=>]99.5

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

      metadata-eval [=>]99.5

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

      add-sqr-sqrt [=>]99.5

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

      fabs-sqr [=>]99.5

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

      add-sqr-sqrt [<=]99.5

      \[ \mathsf{copysign}\left(0 + \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right), x\right) \]
    4. Simplified99.5%

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

      [Start]99.5

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

      +-lft-identity [=>]99.5

      \[ \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
  3. Recombined 3 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 -10:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 10^{-8}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.16666666666666666, {x}^{3}, 0.075 \cdot {x}^{5}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.5%
Cost71880
\[\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 -10:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\ \mathbf{elif}\;t_0 \leq 10^{-8}:\\ \;\;\;\;\mathsf{copysign}\left(-0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right) + \left(x + 0.075 \cdot {x}^{5}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
Alternative 2
Accuracy99.6%
Cost14024
\[\begin{array}{l} \mathbf{if}\;x \leq -1.05:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\ \mathbf{elif}\;x \leq 1.05:\\ \;\;\;\;\mathsf{copysign}\left(-0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right) + \left(x + 0.075 \cdot {x}^{5}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\ \end{array} \]
Alternative 3
Accuracy99.4%
Cost13576
\[\begin{array}{l} \mathbf{if}\;x \leq -1.25:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.95:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\ \end{array} \]
Alternative 4
Accuracy99.5%
Cost13576
\[\begin{array}{l} \mathbf{if}\;x \leq -0.96:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\ \mathbf{elif}\;x \leq 0.95:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\ \end{array} \]
Alternative 5
Accuracy82.3%
Cost13320
\[\begin{array}{l} \mathbf{if}\;x \leq -1.95:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 1.28:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 6
Accuracy99.4%
Cost13320
\[\begin{array}{l} \mathbf{if}\;x \leq -1.25:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1.28:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 7
Accuracy63.9%
Cost13124
\[\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 8
Accuracy57.9%
Cost13060
\[\begin{array}{l} \mathbf{if}\;x \leq 1.6:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
Alternative 9
Accuracy51.1%
Cost6528
\[\mathsf{copysign}\left(x, x\right) \]

Error

Reproduce?

herbie shell --seed 2023131 
(FPCore (x)
  :name "Rust f64::asinh"
  :precision binary64

  :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))