Rust f64::asinh

?

Percentage Accurate: 29.8% → 98.9%
Time: 4.5s
Precision: binary64
Cost: 65608

?

\[\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 -5:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;t_0 \leq 10^{-9}:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\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 -5.0)
     (copysign (- (log (- (hypot 1.0 x) x))) x)
     (if (<= t_0 1e-9)
       (copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
       (copysign (log (+ x 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 <= -5.0) {
		tmp = copysign(-log((hypot(1.0, x) - x)), x);
	} else if (t_0 <= 1e-9) {
		tmp = copysign((x + (-0.16666666666666666 * pow(x, 3.0))), x);
	} else {
		tmp = copysign(log((x + x)), x);
	}
	return tmp;
}
public static double code(double x) {
	return Math.copySign(Math.log((Math.abs(x) + Math.sqrt(((x * x) + 1.0)))), x);
}
public static double code(double x) {
	double t_0 = Math.copySign(Math.log((Math.abs(x) + Math.sqrt(((x * x) + 1.0)))), x);
	double tmp;
	if (t_0 <= -5.0) {
		tmp = Math.copySign(-Math.log((Math.hypot(1.0, x) - x)), x);
	} else if (t_0 <= 1e-9) {
		tmp = Math.copySign((x + (-0.16666666666666666 * Math.pow(x, 3.0))), x);
	} else {
		tmp = Math.copySign(Math.log((x + x)), x);
	}
	return tmp;
}
def code(x):
	return math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x)
def code(x):
	t_0 = math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x)
	tmp = 0
	if t_0 <= -5.0:
		tmp = math.copysign(-math.log((math.hypot(1.0, x) - x)), x)
	elif t_0 <= 1e-9:
		tmp = math.copysign((x + (-0.16666666666666666 * math.pow(x, 3.0))), x)
	else:
		tmp = math.copysign(math.log((x + 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 <= -5.0)
		tmp = copysign(Float64(-log(Float64(hypot(1.0, x) - x))), x);
	elseif (t_0 <= 1e-9)
		tmp = copysign(Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0))), x);
	else
		tmp = copysign(log(Float64(x + x)), x);
	end
	return tmp
end
function tmp = code(x)
	tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + 1.0)))));
end
function tmp_2 = code(x)
	t_0 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + 1.0)))));
	tmp = 0.0;
	if (t_0 <= -5.0)
		tmp = sign(x) * abs(-log((hypot(1.0, x) - x)));
	elseif (t_0 <= 1e-9)
		tmp = sign(x) * abs((x + (-0.16666666666666666 * (x ^ 3.0))));
	else
		tmp = sign(x) * abs(log((x + x)));
	end
	tmp_2 = 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, -5.0], N[With[{TMP1 = Abs[(-N[Log[N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision])], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[t$95$0, 1e-9], N[With[{TMP1 = Abs[N[(x + N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + x), $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 -5:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\

\mathbf{elif}\;t_0 \leq 10^{-9}:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\

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


\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 9 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Target

Original29.8%
Target100.0%
Herbie98.9%
\[\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) < -5

    1. Initial program 49.6%

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
      Step-by-step derivation

      [Start]49.6%

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

      +-commutative [=>]49.6%

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

      hypot-1-def [=>]100.0%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0 + \log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
      Step-by-step derivation

      [Start]100.0%

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

      *-un-lft-identity [=>]100.0%

      \[ \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 [=>]100.0%

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

      metadata-eval [=>]100.0%

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

      *-un-lft-identity [=>]100.0%

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

      *-un-lft-identity [<=]100.0%

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

      add-sqr-sqrt [=>]0.0%

      \[ \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 [=>]0.0%

      \[ \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 [<=]5.0%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
      Step-by-step derivation

      [Start]5.0%

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

      +-lft-identity [=>]5.0%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(-\left(x \cdot x - \mathsf{fma}\left(x, x, 1\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
      Step-by-step derivation

      [Start]5.0%

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

      flip-+ [=>]3.8%

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

      frac-2neg [=>]3.8%

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

      log-div [=>]3.8%

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

      hypot-udef [=>]4.2%

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

      hypot-udef [=>]3.8%

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

      add-sqr-sqrt [<=]4.2%

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

      metadata-eval [=>]4.2%

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

      +-commutative [=>]4.2%

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

      fma-def [=>]4.2%

      \[ \mathsf{copysign}\left(\log \left(-\left(x \cdot x - \color{blue}{\mathsf{fma}\left(x, x, 1\right)}\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    6. Simplified100.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(\mathsf{hypot}\left(1, x\right) - x\right)}, x\right) \]
      Step-by-step derivation

      [Start]4.2%

      \[ \mathsf{copysign}\left(\log \left(-\left(x \cdot x - \mathsf{fma}\left(x, x, 1\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]

      neg-mul-1 [=>]4.2%

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

      fma-udef [=>]4.2%

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

      associate--r+ [=>]47.9%

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

      +-inverses [=>]100.0%

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

      metadata-eval [=>]100.0%

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

      metadata-eval [=>]100.0%

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

      metadata-eval [=>]100.0%

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

      neg-sub0 [<=]100.0%

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

      neg-sub0 [=>]100.0%

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

      associate--r- [=>]100.0%

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

      neg-sub0 [<=]100.0%

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

      +-commutative [<=]100.0%

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

      sub-neg [<=]100.0%

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

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

    1. Initial program 6.7%

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
      Step-by-step derivation

      [Start]6.7%

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

      +-commutative [=>]6.7%

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

      hypot-1-def [=>]6.7%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0 + \log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
      Step-by-step derivation

      [Start]6.7%

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

      *-un-lft-identity [=>]6.7%

      \[ \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 [=>]6.7%

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

      metadata-eval [=>]6.7%

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

      *-un-lft-identity [=>]6.7%

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

      *-un-lft-identity [<=]6.7%

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

      add-sqr-sqrt [=>]2.9%

      \[ \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 [=>]2.9%

      \[ \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 [<=]6.7%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
      Step-by-step derivation

      [Start]6.7%

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

      +-lft-identity [=>]6.7%

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

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

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

    1. Initial program 53.2%

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
      Step-by-step derivation

      [Start]53.2%

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

      +-commutative [=>]53.2%

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

      hypot-1-def [=>]100.0%

      \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Taylor expanded in x around inf 100.0%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left|x\right| + x\right)}, x\right) \]
    4. Simplified100.0%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + x\right)}, x\right) \]
      Step-by-step derivation

      [Start]100.0%

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

      unpow1 [<=]100.0%

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

      sqr-pow [=>]100.0%

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

      fabs-sqr [=>]100.0%

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

      sqr-pow [<=]100.0%

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

      unpow1 [=>]100.0%

      \[ \mathsf{copysign}\left(\log \left(\color{blue}{x} + x\right), x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification100.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -5:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 10^{-9}:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy98.9%
Cost65608
\[\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 -5:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;t_0 \leq 10^{-9}:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 2
Accuracy99.3%
Cost13512
\[\begin{array}{l} \mathbf{if}\;x \leq -1.3:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2\right), x\right)\\ \mathbf{elif}\;x \leq 1.25:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 3
Accuracy99.4%
Cost13512
\[\begin{array}{l} \mathbf{if}\;x \leq -0.96:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2 - \frac{0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1.25:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 4
Accuracy82.3%
Cost13320
\[\begin{array}{l} \mathbf{if}\;x \leq -3.2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 1.25:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 5
Accuracy99.1%
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.25:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 6
Accuracy99.0%
Cost13320
\[\begin{array}{l} \mathbf{if}\;x \leq -1.25:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2\right), x\right)\\ \mathbf{elif}\;x \leq 1.25:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 7
Accuracy65.0%
Cost13124
\[\begin{array}{l} \mathbf{if}\;x \leq -0.5:\\ \;\;\;\;\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
Accuracy59.2%
Cost13060
\[\begin{array}{l} \mathbf{if}\;x \leq 1.55:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
Alternative 9
Accuracy52.8%
Cost6528
\[\mathsf{copysign}\left(x, x\right) \]

Reproduce?

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