Rust f32::asinh

?

Percentage Accurate: 37.6% → 99.4%
Time: 10.4s
Precision: binary32
Cost: 59752

?

\[\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)\\ t_1 := {\left(x + 1\right)}^{2}\\ \mathbf{if}\;t_0 \leq -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.20000000298023224:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664 \cdot \left(\frac{3}{x + 1} + \frac{3}{t_1}\right), {x}^{4}, \mathsf{fma}\left(0.001388888888888889 \cdot \left(\frac{45}{t_1} + \left(\frac{45}{x + 1} + \frac{30}{{\left(x + 1\right)}^{3}}\right)\right), {x}^{6}, \mathsf{fma}\left(0.5, \frac{x \cdot x}{x + 1}, \mathsf{log1p}\left(x\right)\right)\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 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))
        (t_1 (pow (+ x 1.0) 2.0)))
   (if (<= t_0 -0.4000000059604645)
     (copysign (- (log (- (hypot 1.0 x) x))) x)
     (if (<= t_0 0.20000000298023224)
       (copysign
        (fma
         (* -0.041666666666666664 (+ (/ 3.0 (+ x 1.0)) (/ 3.0 t_1)))
         (pow x 4.0)
         (fma
          (*
           0.001388888888888889
           (+
            (/ 45.0 t_1)
            (+ (/ 45.0 (+ x 1.0)) (/ 30.0 (pow (+ x 1.0) 3.0)))))
          (pow x 6.0)
          (fma 0.5 (/ (* x x) (+ x 1.0)) (log1p x))))
        x)
       (copysign (log (+ x (hypot 1.0 x))) 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 t_1 = powf((x + 1.0f), 2.0f);
	float tmp;
	if (t_0 <= -0.4000000059604645f) {
		tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
	} else if (t_0 <= 0.20000000298023224f) {
		tmp = copysignf(fmaf((-0.041666666666666664f * ((3.0f / (x + 1.0f)) + (3.0f / t_1))), powf(x, 4.0f), fmaf((0.001388888888888889f * ((45.0f / t_1) + ((45.0f / (x + 1.0f)) + (30.0f / powf((x + 1.0f), 3.0f))))), powf(x, 6.0f), fmaf(0.5f, ((x * x) / (x + 1.0f)), log1pf(x)))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, 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)
	t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	t_1 = Float32(x + Float32(1.0)) ^ Float32(2.0)
	tmp = Float32(0.0)
	if (t_0 <= Float32(-0.4000000059604645))
		tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x);
	elseif (t_0 <= Float32(0.20000000298023224))
		tmp = copysign(fma(Float32(Float32(-0.041666666666666664) * Float32(Float32(Float32(3.0) / Float32(x + Float32(1.0))) + Float32(Float32(3.0) / t_1))), (x ^ Float32(4.0)), fma(Float32(Float32(0.001388888888888889) * Float32(Float32(Float32(45.0) / t_1) + Float32(Float32(Float32(45.0) / Float32(x + Float32(1.0))) + Float32(Float32(30.0) / (Float32(x + Float32(1.0)) ^ Float32(3.0)))))), (x ^ Float32(6.0)), fma(Float32(0.5), Float32(Float32(x * x) / Float32(x + Float32(1.0))), log1p(x)))), x);
	else
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), 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}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
t_1 := {\left(x + 1\right)}^{2}\\
\mathbf{if}\;t_0 \leq -0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\

\mathbf{elif}\;t_0 \leq 0.20000000298023224:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664 \cdot \left(\frac{3}{x + 1} + \frac{3}{t_1}\right), {x}^{4}, \mathsf{fma}\left(0.001388888888888889 \cdot \left(\frac{45}{t_1} + \left(\frac{45}{x + 1} + \frac{30}{{\left(x + 1\right)}^{3}}\right)\right), {x}^{6}, \mathsf{fma}\left(0.5, \frac{x \cdot x}{x + 1}, \mathsf{log1p}\left(x\right)\right)\right)\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\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 15 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.6%
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) < -0.400000006

    1. Initial program 61.6%

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

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

      [Start]61.6%

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

      +-commutative [=>]61.6%

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

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

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

      fabs-sqr [=>]-0.0%

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

      add-sqr-sqrt [<=]16.0%

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

      flip-+ [=>]13.0%

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

      log-div [=>]13.1%

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

      add-sqr-sqrt [<=]17.5%

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

      fma-def [=>]17.5%

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

      +-commutative [=>]17.5%

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

      hypot-1-def [=>]17.5%

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

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

      [Start]17.5%

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

      fma-udef [=>]17.4%

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

      +-commutative [<=]17.4%

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

      associate--l+ [=>]59.0%

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

      +-inverses [=>]99.9%

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

      metadata-eval [=>]99.9%

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

      metadata-eval [=>]99.9%

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

      neg-sub0 [<=]99.9%

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

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

    1. Initial program 22.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around 0 22.9%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{-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.001388888888888889 \cdot \left(\left(45 \cdot \frac{1}{1 + \left|x\right|} + \left(30 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{3}} + 45 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) \cdot {x}^{6}\right) + \left(0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + \log \left(1 + \left|x\right|\right)\right)\right)}, x\right) \]
    3. Simplified99.9%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(-0.041666666666666664 \cdot \left(\frac{3}{1 + x} + \frac{3}{{\left(1 + x\right)}^{2}}\right), {x}^{4}, \mathsf{fma}\left(0.001388888888888889 \cdot \left(\frac{45}{{\left(1 + x\right)}^{2}} + \left(\frac{45}{1 + x} + \frac{30}{{\left(1 + x\right)}^{3}}\right)\right), {x}^{6}, \mathsf{fma}\left(0.5, \frac{x \cdot x}{1 + x}, \mathsf{log1p}\left(x\right)\right)\right)\right)}, x\right) \]
      Step-by-step derivation

      [Start]22.9%

      \[ \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.001388888888888889 \cdot \left(\left(45 \cdot \frac{1}{1 + \left|x\right|} + \left(30 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{3}} + 45 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) \cdot {x}^{6}\right) + \left(0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + \log \left(1 + \left|x\right|\right)\right)\right), x\right) \]

      associate-*r* [=>]22.9%

      \[ \mathsf{copysign}\left(\color{blue}{\left(-0.041666666666666664 \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) \cdot {x}^{4}} + \left(0.001388888888888889 \cdot \left(\left(45 \cdot \frac{1}{1 + \left|x\right|} + \left(30 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{3}} + 45 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) \cdot {x}^{6}\right) + \left(0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + \log \left(1 + \left|x\right|\right)\right)\right), x\right) \]

      fma-def [=>]22.9%

      \[ \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(-0.041666666666666664 \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right), {x}^{4}, 0.001388888888888889 \cdot \left(\left(45 \cdot \frac{1}{1 + \left|x\right|} + \left(30 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{3}} + 45 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) \cdot {x}^{6}\right) + \left(0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + \log \left(1 + \left|x\right|\right)\right)\right)}, x\right) \]

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

    1. Initial program 56.7%

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

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

      [Start]56.7%

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

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

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

      *-commutative [=>]56.7%

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

      log-prod [=>]56.7%

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

      add-sqr-sqrt [=>]56.7%

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

      fabs-sqr [=>]56.7%

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

      add-sqr-sqrt [<=]56.7%

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

      +-commutative [=>]56.7%

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

      hypot-1-def [=>]98.4%

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

      metadata-eval [=>]98.4%

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

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

      [Start]98.4%

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

      +-rgt-identity [=>]98.4%

      \[ \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 -0.4000000059604645:\\ \;\;\;\;\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 0.20000000298023224:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664 \cdot \left(\frac{3}{x + 1} + \frac{3}{{\left(x + 1\right)}^{2}}\right), {x}^{4}, \mathsf{fma}\left(0.001388888888888889 \cdot \left(\frac{45}{{\left(x + 1\right)}^{2}} + \left(\frac{45}{x + 1} + \frac{30}{{\left(x + 1\right)}^{3}}\right)\right), {x}^{6}, \mathsf{fma}\left(0.5, \frac{x \cdot x}{x + 1}, \mathsf{log1p}\left(x\right)\right)\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.4%
Cost59752
\[\begin{array}{l} t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ t_1 := {\left(x + 1\right)}^{2}\\ \mathbf{if}\;t_0 \leq -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.20000000298023224:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664 \cdot \left(\frac{3}{x + 1} + \frac{3}{t_1}\right), {x}^{4}, \mathsf{fma}\left(0.001388888888888889 \cdot \left(\frac{45}{t_1} + \left(\frac{45}{x + 1} + \frac{30}{{\left(x + 1\right)}^{3}}\right)\right), {x}^{6}, \mathsf{fma}\left(0.5, \frac{x \cdot x}{x + 1}, \mathsf{log1p}\left(x\right)\right)\right)\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.3%
Cost46216
\[\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 -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.019999999552965164:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, \left(\frac{3}{x + 1} + \frac{3}{{\left(x + 1\right)}^{2}}\right) \cdot {x}^{4}, \mathsf{fma}\left(0.5, \frac{x \cdot x}{x + 1}, \mathsf{log1p}\left(x\right)\right)\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.3%
Cost39208
\[\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 -0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.014999999664723873:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{x \cdot x}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(2 \cdot \log \left(\sqrt{x + \mathsf{hypot}\left(1, x\right)}\right), x\right)\\ \end{array} \]
Alternative 4
Accuracy99.3%
Cost10056
\[\begin{array}{l} \mathbf{if}\;x \leq -0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.014999999664723873:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{x \cdot x}{x + 1}, \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} \]
Alternative 5
Accuracy98.9%
Cost10024
\[\begin{array}{l} \mathbf{if}\;x \leq -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.019999999552965164:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \mathsf{fma}\left(x, 3, {x}^{3} \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 6
Accuracy98.1%
Cost9896
\[\begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.019999999552965164:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
Alternative 7
Accuracy98.8%
Cost9896
\[\begin{array}{l} \mathbf{if}\;x \leq -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.019999999552965164:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
Alternative 8
Accuracy97.5%
Cost9796
\[\begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| - x\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\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 9
Accuracy97.7%
Cost6888
\[\begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) - \frac{0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\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 10
Accuracy83.7%
Cost6792
\[\begin{array}{l} \mathbf{if}\;x \leq -20:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\frac{-1}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.800000011920929:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\ \end{array} \]
Alternative 11
Accuracy96.9%
Cost6792
\[\begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) - \frac{0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.800000011920929:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\ \end{array} \]
Alternative 12
Accuracy83.4%
Cost6664
\[\begin{array}{l} \mathbf{if}\;x \leq -20:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\frac{-1}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1.2000000476837158:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 13
Accuracy75.4%
Cost6596
\[\begin{array}{l} \mathbf{if}\;x \leq 1.2000000476837158:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
Alternative 14
Accuracy62.4%
Cost6532
\[\begin{array}{l} \mathbf{if}\;x \leq 2:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
Alternative 15
Accuracy54.2%
Cost3392
\[\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right) \]

Reproduce?

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