Average Error: 29.2 → 9.2
Time: 3.6s
Precision: 64
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot x \le -3.56979547989466417 \cdot 10^{-7}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{{\left(e^{\left(a \cdot x\right) \cdot 3 + \left(a \cdot x\right) \cdot 3} + \left(-{1}^{6}\right)\right)}^{3}}{{\left(e^{\left(a \cdot x\right) \cdot 3} + {1}^{3}\right)}^{3}}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\\ \mathbf{elif}\;a \cdot x \le 2.97473326445349939 \cdot 10^{-19}:\\ \;\;\;\;x \cdot \left(a + \left(\frac{1}{2} \cdot {a}^{2}\right) \cdot x\right) + \frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{{\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}^{3}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\\ \end{array}\]
e^{a \cdot x} - 1
\begin{array}{l}
\mathbf{if}\;a \cdot x \le -3.56979547989466417 \cdot 10^{-7}:\\
\;\;\;\;\frac{\sqrt[3]{\frac{{\left(e^{\left(a \cdot x\right) \cdot 3 + \left(a \cdot x\right) \cdot 3} + \left(-{1}^{6}\right)\right)}^{3}}{{\left(e^{\left(a \cdot x\right) \cdot 3} + {1}^{3}\right)}^{3}}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\\

\mathbf{elif}\;a \cdot x \le 2.97473326445349939 \cdot 10^{-19}:\\
\;\;\;\;x \cdot \left(a + \left(\frac{1}{2} \cdot {a}^{2}\right) \cdot x\right) + \frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{{\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}^{3}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\\

\end{array}
double code(double a, double x) {
	return (exp((a * x)) - 1.0);
}
double code(double a, double x) {
	double temp;
	if (((a * x) <= -3.569795479894664e-07)) {
		temp = (cbrt((pow((exp((((a * x) * 3.0) + ((a * x) * 3.0))) + -pow(1.0, 6.0)), 3.0) / pow((exp(((a * x) * 3.0)) + pow(1.0, 3.0)), 3.0))) / ((exp((a * x)) * (exp((a * x)) + 1.0)) + (1.0 * 1.0)));
	} else {
		double temp_1;
		if (((a * x) <= 2.9747332644534994e-19)) {
			temp_1 = ((x * (a + ((0.5 * pow(a, 2.0)) * x))) + (0.16666666666666666 * (pow(a, 3.0) * pow(x, 3.0))));
		} else {
			temp_1 = (cbrt(pow((exp(((a * x) * 3.0)) - pow(1.0, 3.0)), 3.0)) / ((exp((a * x)) * (exp((a * x)) + 1.0)) + (1.0 * 1.0)));
		}
		temp = temp_1;
	}
	return temp;
}

Error

Bits error versus a

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.2
Target0.2
Herbie9.2
\[\begin{array}{l} \mathbf{if}\;\left|a \cdot x\right| \lt 0.10000000000000001:\\ \;\;\;\;\left(a \cdot x\right) \cdot \left(1 + \left(\frac{a \cdot x}{2} + \frac{{\left(a \cdot x\right)}^{2}}{6}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{a \cdot x} - 1\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (* a x) < -3.569795479894664e-07

    1. Initial program 0.2

      \[e^{a \cdot x} - 1\]
    2. Using strategy rm
    3. Applied flip3--0.2

      \[\leadsto \color{blue}{\frac{{\left(e^{a \cdot x}\right)}^{3} - {1}^{3}}{e^{a \cdot x} \cdot e^{a \cdot x} + \left(1 \cdot 1 + e^{a \cdot x} \cdot 1\right)}}\]
    4. Simplified0.2

      \[\leadsto \frac{{\left(e^{a \cdot x}\right)}^{3} - {1}^{3}}{\color{blue}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\]
    5. Using strategy rm
    6. Applied pow-exp0.2

      \[\leadsto \frac{\color{blue}{e^{\left(a \cdot x\right) \cdot 3}} - {1}^{3}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\]
    7. Using strategy rm
    8. Applied add-cbrt-cube0.2

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right) \cdot \left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)\right) \cdot \left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\]
    9. Simplified0.2

      \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}^{3}}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\]
    10. Using strategy rm
    11. Applied flip--0.2

      \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(\frac{e^{\left(a \cdot x\right) \cdot 3} \cdot e^{\left(a \cdot x\right) \cdot 3} - {1}^{3} \cdot {1}^{3}}{e^{\left(a \cdot x\right) \cdot 3} + {1}^{3}}\right)}}^{3}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\]
    12. Applied cube-div0.2

      \[\leadsto \frac{\sqrt[3]{\color{blue}{\frac{{\left(e^{\left(a \cdot x\right) \cdot 3} \cdot e^{\left(a \cdot x\right) \cdot 3} - {1}^{3} \cdot {1}^{3}\right)}^{3}}{{\left(e^{\left(a \cdot x\right) \cdot 3} + {1}^{3}\right)}^{3}}}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\]
    13. Simplified0.2

      \[\leadsto \frac{\sqrt[3]{\frac{\color{blue}{{\left(e^{\left(a \cdot x\right) \cdot 3 + \left(a \cdot x\right) \cdot 3} + \left(-{1}^{6}\right)\right)}^{3}}}{{\left(e^{\left(a \cdot x\right) \cdot 3} + {1}^{3}\right)}^{3}}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\]

    if -3.569795479894664e-07 < (* a x) < 2.9747332644534994e-19

    1. Initial program 45.1

      \[e^{a \cdot x} - 1\]
    2. Taylor expanded around 0 13.5

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left({a}^{2} \cdot {x}^{2}\right) + \left(\frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right) + a \cdot x\right)}\]
    3. Simplified13.5

      \[\leadsto \color{blue}{x \cdot \left(a + \left(\frac{1}{2} \cdot {a}^{2}\right) \cdot x\right) + \frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right)}\]

    if 2.9747332644534994e-19 < (* a x)

    1. Initial program 25.4

      \[e^{a \cdot x} - 1\]
    2. Using strategy rm
    3. Applied flip3--26.4

      \[\leadsto \color{blue}{\frac{{\left(e^{a \cdot x}\right)}^{3} - {1}^{3}}{e^{a \cdot x} \cdot e^{a \cdot x} + \left(1 \cdot 1 + e^{a \cdot x} \cdot 1\right)}}\]
    4. Simplified26.4

      \[\leadsto \frac{{\left(e^{a \cdot x}\right)}^{3} - {1}^{3}}{\color{blue}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\]
    5. Using strategy rm
    6. Applied pow-exp25.0

      \[\leadsto \frac{\color{blue}{e^{\left(a \cdot x\right) \cdot 3}} - {1}^{3}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\]
    7. Using strategy rm
    8. Applied add-cbrt-cube26.9

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right) \cdot \left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)\right) \cdot \left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\]
    9. Simplified26.9

      \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}^{3}}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \le -3.56979547989466417 \cdot 10^{-7}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{{\left(e^{\left(a \cdot x\right) \cdot 3 + \left(a \cdot x\right) \cdot 3} + \left(-{1}^{6}\right)\right)}^{3}}{{\left(e^{\left(a \cdot x\right) \cdot 3} + {1}^{3}\right)}^{3}}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\\ \mathbf{elif}\;a \cdot x \le 2.97473326445349939 \cdot 10^{-19}:\\ \;\;\;\;x \cdot \left(a + \left(\frac{1}{2} \cdot {a}^{2}\right) \cdot x\right) + \frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{{\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}^{3}}}{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2020060 
(FPCore (a x)
  :name "expax (section 3.5)"
  :precision binary64
  :herbie-expected 14

  :herbie-target
  (if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1 (+ (/ (* a x) 2) (/ (pow (* a x) 2) 6)))) (- (exp (* a x)) 1))

  (- (exp (* a x)) 1))