Rust f32::asinh

?

Percentage Accurate: 37.8% → 99.4%
Time: 10.6s
Precision: binary32
Cost: 42376

?

\[\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 -1:\\ \;\;\;\;\mathsf{copysign}\left(-\mathsf{log1p}\left(-1 + \frac{x - \mathsf{hypot}\left(1, x\right)}{-1}\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.15000000596046448:\\ \;\;\;\;\mathsf{copysign}\left(x - \mathsf{fma}\left(-0.075, {x}^{5}, 0.16666666666666666 \cdot {x}^{3}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\sqrt[3]{{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}^{3}}, x\right)\\ \end{array} \]
(FPCore (x)
 :precision binary32
 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
(FPCore (x)
 :precision binary32
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
   (if (<= t_0 -1.0)
     (copysign (- (log1p (+ -1.0 (/ (- x (hypot 1.0 x)) -1.0)))) x)
     (if (<= t_0 0.15000000596046448)
       (copysign
        (- x (fma -0.075 (pow x 5.0) (* 0.16666666666666666 (pow x 3.0))))
        x)
       (copysign (cbrt (pow (log (+ x (hypot 1.0 x))) 3.0)) x)))))
float code(float x) {
	return copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), 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(-log1pf((-1.0f + ((x - hypotf(1.0f, x)) / -1.0f))), x);
	} else if (t_0 <= 0.15000000596046448f) {
		tmp = copysignf((x - fmaf(-0.075f, powf(x, 5.0f), (0.16666666666666666f * powf(x, 3.0f)))), x);
	} else {
		tmp = copysignf(cbrtf(powf(logf((x + hypotf(1.0f, x))), 3.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 = 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(-log1p(Float32(Float32(-1.0) + Float32(Float32(x - hypot(Float32(1.0), x)) / Float32(-1.0))))), x);
	elseif (t_0 <= Float32(0.15000000596046448))
		tmp = copysign(Float32(x - fma(Float32(-0.075), (x ^ Float32(5.0)), Float32(Float32(0.16666666666666666) * (x ^ Float32(3.0))))), x);
	else
		tmp = copysign(cbrt((log(Float32(x + hypot(Float32(1.0), x))) ^ Float32(3.0))), x);
	end
	return tmp
end
\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 -1:\\
\;\;\;\;\mathsf{copysign}\left(-\mathsf{log1p}\left(-1 + \frac{x - \mathsf{hypot}\left(1, x\right)}{-1}\right), x\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\sqrt[3]{{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}^{3}}, 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 14 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

Original37.8%
Target99.5%
Herbie99.4%
\[\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.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -1

    1. Initial program 55.4%

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

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

      [Start]55.4%

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

      flip-+ [=>]10.9%

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

      clear-num [=>]10.9%

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

      log-rec [=>]10.9%

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

      +-commutative [=>]10.9%

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

      hypot-1-def [=>]10.9%

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

      add-sqr-sqrt [=>]-0.0%

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

      fabs-sqr [=>]-0.0%

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

      add-sqr-sqrt [<=]12.1%

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

      sqr-abs [=>]12.1%

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

      add-sqr-sqrt [<=]14.7%

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

      +-commutative [=>]14.7%

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

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

      [Start]15.3%

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

      log1p-expm1-u [=>]15.3%

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

      expm1-udef [=>]15.3%

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

      add-exp-log [<=]15.3%

      \[ \mathsf{copysign}\left(-\mathsf{log1p}\left(\color{blue}{\frac{x - \mathsf{hypot}\left(1, x\right)}{\mathsf{fma}\left(x, x, -1\right) - x \cdot x}} - 1\right), x\right) \]
    4. Simplified99.9%

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

      [Start]15.3%

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

      sub-neg [=>]15.3%

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

      fma-udef [=>]14.7%

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

      associate-+r- [<=]14.7%

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

      +-commutative [=>]14.7%

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

      associate-+l- [=>]52.4%

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

      +-inverses [=>]99.9%

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

      metadata-eval [=>]99.9%

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

      metadata-eval [=>]99.9%

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

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

    1. Initial program 21.6%

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

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

      [Start]21.6%

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

      flip-+ [=>]21.3%

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

      clear-num [=>]21.3%

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

      log-rec [=>]21.7%

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

      +-commutative [=>]21.7%

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

      hypot-1-def [=>]21.6%

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

      add-sqr-sqrt [=>]9.0%

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

      fabs-sqr [=>]9.0%

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

      add-sqr-sqrt [<=]21.4%

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

      sqr-abs [=>]21.4%

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

      add-sqr-sqrt [<=]21.5%

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

      +-commutative [=>]21.5%

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

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

      [Start]21.6%

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

      div-inv [=>]21.6%

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

      log-prod [=>]-0.0%

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

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

      [Start]-0.0%

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

      +-commutative [=>]-0.0%

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

      fma-udef [=>]-0.0%

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

      associate-+r- [<=]-0.0%

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

      +-commutative [=>]-0.0%

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

      associate-+l- [=>]-0.0%

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

      +-inverses [=>]-0.0%

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

      metadata-eval [=>]-0.0%

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

      metadata-eval [=>]-0.0%

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

      log-prod [<=]21.6%

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

      neg-mul-1 [<=]21.6%

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

      sub-neg [=>]21.6%

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

      +-commutative [=>]21.6%

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

      distribute-neg-in [=>]21.6%

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

      remove-double-neg [=>]21.6%

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

      sub-neg [<=]21.6%

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

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

      \[\leadsto \mathsf{copysign}\left(-\color{blue}{\left(\mathsf{fma}\left(-0.075, {x}^{5}, 0.16666666666666666 \cdot {x}^{3}\right) - x\right)}, x\right) \]
      Step-by-step derivation

      [Start]99.9%

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

      +-commutative [=>]99.9%

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

      associate-+r+ [=>]100.0%

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

      mul-1-neg [=>]100.0%

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

      unsub-neg [=>]100.0%

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

      +-commutative [=>]100.0%

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

      fma-def [=>]100.0%

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

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

    1. Initial program 46.7%

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

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

      [Start]46.7%

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

      add-cbrt-cube [=>]46.7%

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

      pow3 [=>]46.7%

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

      add-sqr-sqrt [=>]46.7%

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

      fabs-sqr [=>]46.7%

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

      add-sqr-sqrt [<=]46.7%

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

      +-commutative [=>]46.7%

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

      hypot-1-def [=>]100.0%

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

Alternatives

Alternative 1
Accuracy99.4%
Cost42376
\[\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(-\mathsf{log1p}\left(-1 + \frac{x - \mathsf{hypot}\left(1, x\right)}{-1}\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.15000000596046448:\\ \;\;\;\;\mathsf{copysign}\left(x - \mathsf{fma}\left(-0.075, {x}^{5}, 0.16666666666666666 \cdot {x}^{3}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\sqrt[3]{{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}^{3}}, x\right)\\ \end{array} \]
Alternative 2
Accuracy99.4%
Cost39304
\[\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(-\mathsf{log1p}\left(-1 + \frac{x - \mathsf{hypot}\left(1, x\right)}{-1}\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.15000000596046448:\\ \;\;\;\;\mathsf{copysign}\left(x - \mathsf{fma}\left(-0.075, {x}^{5}, 0.16666666666666666 \cdot {x}^{3}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
Alternative 3
Accuracy99.2%
Cost35976
\[\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(-\mathsf{log1p}\left(-1 + \frac{x - \mathsf{hypot}\left(1, x\right)}{-1}\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.05000000074505806:\\ \;\;\;\;\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 4
Accuracy98.7%
Cost9928
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.05000000074505806:\\ \;\;\;\;\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
Accuracy99.2%
Cost9928
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.05000000074505806:\\ \;\;\;\;\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 6
Accuracy97.9%
Cost9796
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| - x\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x - 0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(x \cdot 2 + 0.5 \cdot \frac{1}{x}\right)\right), x\right)\\ \end{array} \]
Alternative 7
Accuracy97.7%
Cost6984
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(\log \left(x \cdot -2\right) \cdot \left(-3\right)\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x - 0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(x \cdot 2 + 0.5 \cdot \frac{1}{x}\right)\right), x\right)\\ \end{array} \]
Alternative 8
Accuracy84.2%
Cost6792
\[\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 - 0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(x \cdot 2\right)\right), x\right)\\ \end{array} \]
Alternative 9
Accuracy97.6%
Cost6792
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\frac{-0.5}{x}\right)\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x - 0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(x \cdot 2\right)\right), x\right)\\ \end{array} \]
Alternative 10
Accuracy97.4%
Cost6792
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(\log \left(x \cdot -2\right) \cdot \left(-3\right)\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x - 0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(x \cdot 2\right)\right), x\right)\\ \end{array} \]
Alternative 11
Accuracy68.7%
Cost6628
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\frac{-1}{x}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
Alternative 12
Accuracy68.7%
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.0%
Cost6532
\[\begin{array}{l} \mathbf{if}\;x \leq 2:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
Alternative 14
Accuracy53.7%
Cost3264
\[\mathsf{copysign}\left(x, x\right) \]

Reproduce?

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