bug500, discussion (missed optimization)

Percentage Accurate: 52.6% → 97.4%
Time: 17.5s
Alternatives: 7
Speedup: N/A×

Specification

?
\[\log \left(\frac{\sinh x}{x}\right) \]

Your Program's Arguments

Results

Enter valid numbers for all inputs

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.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
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.

Alternative 1: 97.4% accurate, 0.6× speedup?

\[\mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \left({x}^{6} \cdot 0.0001984126984126984 + {x}^{4} \cdot 0.008333333333333333\right)\right) \]
Derivation
  1. Initial program 51.5%

    \[\log \left(\frac{\sinh x}{x}\right) \]
  2. Taylor expanded in x around 0 51.3%

    \[\leadsto \log \color{blue}{\left(0.16666666666666666 \cdot {x}^{2} + \left(1 + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)\right)} \]
  3. Step-by-step derivation
    1. *-un-lft-identity51.3%

      \[\leadsto \log \color{blue}{\left(1 \cdot \left(0.16666666666666666 \cdot {x}^{2} + \left(1 + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)\right)\right)} \]
    2. log-prod51.3%

      \[\leadsto \color{blue}{\log 1 + \log \left(0.16666666666666666 \cdot {x}^{2} + \left(1 + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)\right)} \]
    3. metadata-eval51.3%

      \[\leadsto \color{blue}{0} + \log \left(0.16666666666666666 \cdot {x}^{2} + \left(1 + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)\right) \]
    4. associate-+r+51.3%

      \[\leadsto 0 + \log \color{blue}{\left(\left(0.16666666666666666 \cdot {x}^{2} + 1\right) + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)} \]
    5. pow251.3%

      \[\leadsto 0 + \log \left(\left(0.16666666666666666 \cdot \color{blue}{\left(x \cdot x\right)} + 1\right) + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right) \]
    6. fma-udef51.3%

      \[\leadsto 0 + \log \left(\color{blue}{\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right)} + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right) \]
    7. *-commutative51.3%

      \[\leadsto 0 + \log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \left(\color{blue}{{x}^{6} \cdot 0.0001984126984126984} + 0.008333333333333333 \cdot {x}^{4}\right)\right) \]
    8. fma-def51.3%

      \[\leadsto 0 + \log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \color{blue}{\mathsf{fma}\left({x}^{6}, 0.0001984126984126984, 0.008333333333333333 \cdot {x}^{4}\right)}\right) \]
    9. *-commutative51.3%

      \[\leadsto 0 + \log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, \color{blue}{{x}^{4} \cdot 0.008333333333333333}\right)\right) \]
  4. Applied egg-rr51.3%

    \[\leadsto \color{blue}{0 + \log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)} \]
  5. Step-by-step derivation
    1. +-lft-identity51.3%

      \[\leadsto \color{blue}{\log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)} \]
    2. fma-def51.3%

      \[\leadsto \log \left(\color{blue}{\left(0.16666666666666666 \cdot \left(x \cdot x\right) + 1\right)} + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right) \]
    3. +-commutative51.3%

      \[\leadsto \log \left(\color{blue}{\left(1 + 0.16666666666666666 \cdot \left(x \cdot x\right)\right)} + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right) \]
    4. associate-+l+51.3%

      \[\leadsto \log \color{blue}{\left(1 + \left(0.16666666666666666 \cdot \left(x \cdot x\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)\right)} \]
    5. log1p-def97.9%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)} \]
  6. Simplified97.9%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)} \]
  7. Step-by-step derivation
    1. fma-udef97.9%

      \[\leadsto \mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \color{blue}{\left({x}^{6} \cdot 0.0001984126984126984 + {x}^{4} \cdot 0.008333333333333333\right)}\right) \]
  8. Applied egg-rr97.9%

    \[\leadsto \mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \color{blue}{\left({x}^{6} \cdot 0.0001984126984126984 + {x}^{4} \cdot 0.008333333333333333\right)}\right) \]
  9. Final simplification97.9%

    \[\leadsto \mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \left({x}^{6} \cdot 0.0001984126984126984 + {x}^{4} \cdot 0.008333333333333333\right)\right) \]

Alternative 2: 97.2% accurate, 0.9× speedup?

\[\left(x \cdot \left(0.16666666666666666 \cdot x\right) + {x}^{6} \cdot 0.0003527336860670194\right) + {x}^{4} \cdot -0.005555555555555556 \]
Derivation
  1. Initial program 51.5%

    \[\log \left(\frac{\sinh x}{x}\right) \]
  2. Taylor expanded in x around 0 97.7%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot {x}^{2} + \left(-0.005555555555555556 \cdot {x}^{4} + 0.0003527336860670194 \cdot {x}^{6}\right)} \]
  3. Step-by-step derivation
    1. fma-def97.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {x}^{2}, -0.005555555555555556 \cdot {x}^{4} + 0.0003527336860670194 \cdot {x}^{6}\right)} \]
    2. unpow297.7%

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, \color{blue}{x \cdot x}, -0.005555555555555556 \cdot {x}^{4} + 0.0003527336860670194 \cdot {x}^{6}\right) \]
    3. fma-def97.7%

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, x \cdot x, \color{blue}{\mathsf{fma}\left(-0.005555555555555556, {x}^{4}, 0.0003527336860670194 \cdot {x}^{6}\right)}\right) \]
  4. Simplified97.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, x \cdot x, \mathsf{fma}\left(-0.005555555555555556, {x}^{4}, 0.0003527336860670194 \cdot {x}^{6}\right)\right)} \]
  5. Step-by-step derivation
    1. fma-udef97.7%

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, x \cdot x, \color{blue}{-0.005555555555555556 \cdot {x}^{4} + 0.0003527336860670194 \cdot {x}^{6}}\right) \]
    2. +-commutative97.7%

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, x \cdot x, \color{blue}{0.0003527336860670194 \cdot {x}^{6} + -0.005555555555555556 \cdot {x}^{4}}\right) \]
  6. Applied egg-rr97.7%

    \[\leadsto \mathsf{fma}\left(0.16666666666666666, x \cdot x, \color{blue}{0.0003527336860670194 \cdot {x}^{6} + -0.005555555555555556 \cdot {x}^{4}}\right) \]
  7. Step-by-step derivation
    1. fma-udef97.7%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(x \cdot x\right) + \left(0.0003527336860670194 \cdot {x}^{6} + -0.005555555555555556 \cdot {x}^{4}\right)} \]
    2. associate-+r+97.7%

      \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot \left(x \cdot x\right) + 0.0003527336860670194 \cdot {x}^{6}\right) + -0.005555555555555556 \cdot {x}^{4}} \]
    3. *-commutative97.7%

      \[\leadsto \left(\color{blue}{\left(x \cdot x\right) \cdot 0.16666666666666666} + 0.0003527336860670194 \cdot {x}^{6}\right) + -0.005555555555555556 \cdot {x}^{4} \]
    4. associate-*l*97.8%

      \[\leadsto \left(\color{blue}{x \cdot \left(x \cdot 0.16666666666666666\right)} + 0.0003527336860670194 \cdot {x}^{6}\right) + -0.005555555555555556 \cdot {x}^{4} \]
    5. *-commutative97.8%

      \[\leadsto \left(x \cdot \left(x \cdot 0.16666666666666666\right) + \color{blue}{{x}^{6} \cdot 0.0003527336860670194}\right) + -0.005555555555555556 \cdot {x}^{4} \]
    6. *-commutative97.8%

      \[\leadsto \left(x \cdot \left(x \cdot 0.16666666666666666\right) + {x}^{6} \cdot 0.0003527336860670194\right) + \color{blue}{{x}^{4} \cdot -0.005555555555555556} \]
  8. Applied egg-rr97.8%

    \[\leadsto \color{blue}{\left(x \cdot \left(x \cdot 0.16666666666666666\right) + {x}^{6} \cdot 0.0003527336860670194\right) + {x}^{4} \cdot -0.005555555555555556} \]
  9. Final simplification97.8%

    \[\leadsto \left(x \cdot \left(0.16666666666666666 \cdot x\right) + {x}^{6} \cdot 0.0003527336860670194\right) + {x}^{4} \cdot -0.005555555555555556 \]

Alternative 3: 97.2% accurate, 1.0× speedup?

\[\mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + {x}^{4} \cdot 0.008333333333333333\right) \]
Derivation
  1. Initial program 51.5%

    \[\log \left(\frac{\sinh x}{x}\right) \]
  2. Taylor expanded in x around 0 51.3%

    \[\leadsto \log \color{blue}{\left(0.16666666666666666 \cdot {x}^{2} + \left(1 + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)\right)} \]
  3. Step-by-step derivation
    1. *-un-lft-identity51.3%

      \[\leadsto \log \color{blue}{\left(1 \cdot \left(0.16666666666666666 \cdot {x}^{2} + \left(1 + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)\right)\right)} \]
    2. log-prod51.3%

      \[\leadsto \color{blue}{\log 1 + \log \left(0.16666666666666666 \cdot {x}^{2} + \left(1 + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)\right)} \]
    3. metadata-eval51.3%

      \[\leadsto \color{blue}{0} + \log \left(0.16666666666666666 \cdot {x}^{2} + \left(1 + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)\right) \]
    4. associate-+r+51.3%

      \[\leadsto 0 + \log \color{blue}{\left(\left(0.16666666666666666 \cdot {x}^{2} + 1\right) + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right)} \]
    5. pow251.3%

      \[\leadsto 0 + \log \left(\left(0.16666666666666666 \cdot \color{blue}{\left(x \cdot x\right)} + 1\right) + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right) \]
    6. fma-udef51.3%

      \[\leadsto 0 + \log \left(\color{blue}{\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right)} + \left(0.0001984126984126984 \cdot {x}^{6} + 0.008333333333333333 \cdot {x}^{4}\right)\right) \]
    7. *-commutative51.3%

      \[\leadsto 0 + \log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \left(\color{blue}{{x}^{6} \cdot 0.0001984126984126984} + 0.008333333333333333 \cdot {x}^{4}\right)\right) \]
    8. fma-def51.3%

      \[\leadsto 0 + \log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \color{blue}{\mathsf{fma}\left({x}^{6}, 0.0001984126984126984, 0.008333333333333333 \cdot {x}^{4}\right)}\right) \]
    9. *-commutative51.3%

      \[\leadsto 0 + \log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, \color{blue}{{x}^{4} \cdot 0.008333333333333333}\right)\right) \]
  4. Applied egg-rr51.3%

    \[\leadsto \color{blue}{0 + \log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)} \]
  5. Step-by-step derivation
    1. +-lft-identity51.3%

      \[\leadsto \color{blue}{\log \left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 1\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)} \]
    2. fma-def51.3%

      \[\leadsto \log \left(\color{blue}{\left(0.16666666666666666 \cdot \left(x \cdot x\right) + 1\right)} + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right) \]
    3. +-commutative51.3%

      \[\leadsto \log \left(\color{blue}{\left(1 + 0.16666666666666666 \cdot \left(x \cdot x\right)\right)} + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right) \]
    4. associate-+l+51.3%

      \[\leadsto \log \color{blue}{\left(1 + \left(0.16666666666666666 \cdot \left(x \cdot x\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)\right)} \]
    5. log1p-def97.9%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)} \]
  6. Simplified97.9%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \mathsf{fma}\left({x}^{6}, 0.0001984126984126984, {x}^{4} \cdot 0.008333333333333333\right)\right)} \]
  7. Step-by-step derivation
    1. fma-udef97.9%

      \[\leadsto \mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \color{blue}{\left({x}^{6} \cdot 0.0001984126984126984 + {x}^{4} \cdot 0.008333333333333333\right)}\right) \]
  8. Applied egg-rr97.9%

    \[\leadsto \mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \color{blue}{\left({x}^{6} \cdot 0.0001984126984126984 + {x}^{4} \cdot 0.008333333333333333\right)}\right) \]
  9. Taylor expanded in x around 0 97.6%

    \[\leadsto \mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + \color{blue}{0.008333333333333333 \cdot {x}^{4}}\right) \]
  10. Final simplification97.6%

    \[\leadsto \mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right) + {x}^{4} \cdot 0.008333333333333333\right) \]

Alternative 4: 96.9% accurate, 1.0× speedup?

\[\mathsf{fma}\left(x, 0.16666666666666666 \cdot x, {x}^{4} \cdot -0.005555555555555556\right) \]
Derivation
  1. Initial program 51.5%

    \[\log \left(\frac{\sinh x}{x}\right) \]
  2. Taylor expanded in x around 0 97.7%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot {x}^{2} + \left(-0.005555555555555556 \cdot {x}^{4} + 0.0003527336860670194 \cdot {x}^{6}\right)} \]
  3. Step-by-step derivation
    1. fma-def97.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {x}^{2}, -0.005555555555555556 \cdot {x}^{4} + 0.0003527336860670194 \cdot {x}^{6}\right)} \]
    2. unpow297.7%

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, \color{blue}{x \cdot x}, -0.005555555555555556 \cdot {x}^{4} + 0.0003527336860670194 \cdot {x}^{6}\right) \]
    3. fma-def97.7%

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, x \cdot x, \color{blue}{\mathsf{fma}\left(-0.005555555555555556, {x}^{4}, 0.0003527336860670194 \cdot {x}^{6}\right)}\right) \]
  4. Simplified97.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, x \cdot x, \mathsf{fma}\left(-0.005555555555555556, {x}^{4}, 0.0003527336860670194 \cdot {x}^{6}\right)\right)} \]
  5. Step-by-step derivation
    1. fma-udef97.7%

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, x \cdot x, \color{blue}{-0.005555555555555556 \cdot {x}^{4} + 0.0003527336860670194 \cdot {x}^{6}}\right) \]
    2. +-commutative97.7%

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, x \cdot x, \color{blue}{0.0003527336860670194 \cdot {x}^{6} + -0.005555555555555556 \cdot {x}^{4}}\right) \]
  6. Applied egg-rr97.7%

    \[\leadsto \mathsf{fma}\left(0.16666666666666666, x \cdot x, \color{blue}{0.0003527336860670194 \cdot {x}^{6} + -0.005555555555555556 \cdot {x}^{4}}\right) \]
  7. Taylor expanded in x around 0 97.3%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot {x}^{2} + -0.005555555555555556 \cdot {x}^{4}} \]
  8. Step-by-step derivation
    1. unpow297.3%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(x \cdot x\right)} + -0.005555555555555556 \cdot {x}^{4} \]
    2. *-commutative97.3%

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot 0.16666666666666666} + -0.005555555555555556 \cdot {x}^{4} \]
    3. *-commutative97.3%

      \[\leadsto \left(x \cdot x\right) \cdot 0.16666666666666666 + \color{blue}{{x}^{4} \cdot -0.005555555555555556} \]
    4. associate-*r*97.3%

      \[\leadsto \color{blue}{x \cdot \left(x \cdot 0.16666666666666666\right)} + {x}^{4} \cdot -0.005555555555555556 \]
    5. fma-def97.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x \cdot 0.16666666666666666, {x}^{4} \cdot -0.005555555555555556\right)} \]
  9. Simplified97.3%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, x \cdot 0.16666666666666666, {x}^{4} \cdot -0.005555555555555556\right)} \]
  10. Final simplification97.3%

    \[\leadsto \mathsf{fma}\left(x, 0.16666666666666666 \cdot x, {x}^{4} \cdot -0.005555555555555556\right) \]

Alternative 5: 96.9% accurate, 1.8× speedup?

\[0.16666666666666666 \cdot \left(x \cdot x\right) + {x}^{4} \cdot -0.005555555555555556 \]
Derivation
  1. Initial program 51.5%

    \[\log \left(\frac{\sinh x}{x}\right) \]
  2. Taylor expanded in x around 0 97.3%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot {x}^{2} + -0.005555555555555556 \cdot {x}^{4}} \]
  3. Step-by-step derivation
    1. fma-def97.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, {x}^{2}, -0.005555555555555556 \cdot {x}^{4}\right)} \]
    2. unpow297.3%

      \[\leadsto \mathsf{fma}\left(0.16666666666666666, \color{blue}{x \cdot x}, -0.005555555555555556 \cdot {x}^{4}\right) \]
  4. Simplified97.3%

    \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, x \cdot x, -0.005555555555555556 \cdot {x}^{4}\right)} \]
  5. Step-by-step derivation
    1. fma-udef97.3%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(x \cdot x\right) + -0.005555555555555556 \cdot {x}^{4}} \]
  6. Applied egg-rr97.3%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(x \cdot x\right) + -0.005555555555555556 \cdot {x}^{4}} \]
  7. Final simplification97.3%

    \[\leadsto 0.16666666666666666 \cdot \left(x \cdot x\right) + {x}^{4} \cdot -0.005555555555555556 \]

Alternative 6: 96.7% accurate, 40.6× speedup?

\[0.16666666666666666 \cdot \left(x \cdot x\right) \]
Derivation
  1. Initial program 51.5%

    \[\log \left(\frac{\sinh x}{x}\right) \]
  2. Taylor expanded in x around 0 97.0%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot {x}^{2}} \]
  3. Step-by-step derivation
    1. unpow297.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(x \cdot x\right)} \]
  4. Simplified97.0%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(x \cdot x\right)} \]
  5. Final simplification97.0%

    \[\leadsto 0.16666666666666666 \cdot \left(x \cdot x\right) \]

Alternative 7: 96.7% accurate, 40.6× speedup?

\[x \cdot \left(0.16666666666666666 \cdot x\right) \]
Derivation
  1. Initial program 51.5%

    \[\log \left(\frac{\sinh x}{x}\right) \]
  2. Taylor expanded in x around 0 97.0%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot {x}^{2}} \]
  3. Step-by-step derivation
    1. unpow297.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{\left(x \cdot x\right)} \]
  4. Simplified97.0%

    \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(x \cdot x\right)} \]
  5. Step-by-step derivation
    1. pow297.0%

      \[\leadsto 0.16666666666666666 \cdot \color{blue}{{x}^{2}} \]
    2. add-sqr-sqrt96.8%

      \[\leadsto \color{blue}{\sqrt{0.16666666666666666 \cdot {x}^{2}} \cdot \sqrt{0.16666666666666666 \cdot {x}^{2}}} \]
    3. sqrt-unprod72.9%

      \[\leadsto \color{blue}{\sqrt{\left(0.16666666666666666 \cdot {x}^{2}\right) \cdot \left(0.16666666666666666 \cdot {x}^{2}\right)}} \]
    4. pow272.9%

      \[\leadsto \sqrt{\left(0.16666666666666666 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(0.16666666666666666 \cdot {x}^{2}\right)} \]
    5. *-commutative72.9%

      \[\leadsto \sqrt{\color{blue}{\left(\left(x \cdot x\right) \cdot 0.16666666666666666\right)} \cdot \left(0.16666666666666666 \cdot {x}^{2}\right)} \]
    6. pow272.9%

      \[\leadsto \sqrt{\left(\left(x \cdot x\right) \cdot 0.16666666666666666\right) \cdot \left(0.16666666666666666 \cdot \color{blue}{\left(x \cdot x\right)}\right)} \]
    7. *-commutative72.9%

      \[\leadsto \sqrt{\left(\left(x \cdot x\right) \cdot 0.16666666666666666\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot 0.16666666666666666\right)}} \]
    8. swap-sqr72.9%

      \[\leadsto \sqrt{\color{blue}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(0.16666666666666666 \cdot 0.16666666666666666\right)}} \]
    9. pow272.9%

      \[\leadsto \sqrt{\left(\color{blue}{{x}^{2}} \cdot \left(x \cdot x\right)\right) \cdot \left(0.16666666666666666 \cdot 0.16666666666666666\right)} \]
    10. pow272.9%

      \[\leadsto \sqrt{\left({x}^{2} \cdot \color{blue}{{x}^{2}}\right) \cdot \left(0.16666666666666666 \cdot 0.16666666666666666\right)} \]
    11. pow-sqr72.9%

      \[\leadsto \sqrt{\color{blue}{{x}^{\left(2 \cdot 2\right)}} \cdot \left(0.16666666666666666 \cdot 0.16666666666666666\right)} \]
    12. metadata-eval72.9%

      \[\leadsto \sqrt{{x}^{\color{blue}{4}} \cdot \left(0.16666666666666666 \cdot 0.16666666666666666\right)} \]
    13. metadata-eval72.9%

      \[\leadsto \sqrt{{x}^{4} \cdot \color{blue}{0.027777777777777776}} \]
  6. Applied egg-rr72.9%

    \[\leadsto \color{blue}{\sqrt{{x}^{4} \cdot 0.027777777777777776}} \]
  7. Step-by-step derivation
    1. *-commutative72.9%

      \[\leadsto \sqrt{\color{blue}{0.027777777777777776 \cdot {x}^{4}}} \]
    2. metadata-eval72.9%

      \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot 0.16666666666666666\right)} \cdot {x}^{4}} \]
    3. sqr-pow72.9%

      \[\leadsto \sqrt{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}\right)}} \]
    4. metadata-eval72.9%

      \[\leadsto \sqrt{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \left({x}^{\color{blue}{2}} \cdot {x}^{\left(\frac{4}{2}\right)}\right)} \]
    5. pow272.9%

      \[\leadsto \sqrt{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot {x}^{\left(\frac{4}{2}\right)}\right)} \]
    6. metadata-eval72.9%

      \[\leadsto \sqrt{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \left(\left(x \cdot x\right) \cdot {x}^{\color{blue}{2}}\right)} \]
    7. pow272.9%

      \[\leadsto \sqrt{\left(0.16666666666666666 \cdot 0.16666666666666666\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)}\right)} \]
    8. swap-sqr72.9%

      \[\leadsto \sqrt{\color{blue}{\left(0.16666666666666666 \cdot \left(x \cdot x\right)\right) \cdot \left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)}} \]
    9. sqrt-unprod96.8%

      \[\leadsto \color{blue}{\sqrt{0.16666666666666666 \cdot \left(x \cdot x\right)} \cdot \sqrt{0.16666666666666666 \cdot \left(x \cdot x\right)}} \]
    10. add-sqr-sqrt97.0%

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(x \cdot x\right)} \]
    11. associate-*r*97.1%

      \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot x\right) \cdot x} \]
  8. Applied egg-rr97.1%

    \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot x\right) \cdot x} \]
  9. Final simplification97.1%

    \[\leadsto x \cdot \left(0.16666666666666666 \cdot x\right) \]

Developer target: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|x\right| < 0.085:\\ \;\;\;\;\left(x \cdot x\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-2.6455026455026456 \cdot 10^{-5}, x \cdot x, 0.0003527336860670194\right), x \cdot x, -0.005555555555555556\right), x \cdot x, 0.16666666666666666\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{\sinh x}{x}\right)\\ \end{array} \]

Reproduce

?
herbie shell --seed 2023167 
(FPCore (x)
  :name "bug500, discussion (missed optimization)"
  :precision binary64

  :herbie-target
  (if (< (fabs x) 0.085) (* (* x x) (fma (fma (fma -2.6455026455026456e-5 (* x x) 0.0003527336860670194) (* x x) -0.005555555555555556) (* x x) 0.16666666666666666)) (log (/ (sinh x) x)))

  (log (/ (sinh x) x)))