Average Error: 29.0 → 8.7
Time: 4.5s
Precision: 64
\[e^{a \cdot x} - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot x \le -1.97221861134718174 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{\sqrt[3]{{\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}^{3}}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\\ \mathbf{elif}\;a \cdot x \le 6.8409562196091337 \cdot 10^{-13}:\\ \;\;\;\;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]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{\left(\sqrt{e^{\left(a \cdot x\right) \cdot 3}} + {\left(\sqrt{1}\right)}^{3}\right) \cdot \left(\sqrt{e^{\left(a \cdot x\right) \cdot 3}} - {\left(\sqrt{1}\right)}^{3}\right)}}{\sqrt[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 -1.97221861134718174 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{\sqrt[3]{{\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}^{3}}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\\

\mathbf{elif}\;a \cdot x \le 6.8409562196091337 \cdot 10^{-13}:\\
\;\;\;\;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]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{\left(\sqrt{e^{\left(a \cdot x\right) \cdot 3}} + {\left(\sqrt{1}\right)}^{3}\right) \cdot \left(\sqrt{e^{\left(a \cdot x\right) \cdot 3}} - {\left(\sqrt{1}\right)}^{3}\right)}}{\sqrt[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) <= -1.9722186113471817e-05)) {
		temp = (((cbrt((exp(((a * x) * 3.0)) - pow(1.0, 3.0))) * cbrt(cbrt(pow((exp(((a * x) * 3.0)) - pow(1.0, 3.0)), 3.0)))) / (cbrt(((exp((a * x)) * (exp((a * x)) + 1.0)) + (1.0 * 1.0))) * cbrt(((exp((a * x)) * (exp((a * x)) + 1.0)) + (1.0 * 1.0))))) * (cbrt((exp(((a * x) * 3.0)) - pow(1.0, 3.0))) / cbrt(((exp((a * x)) * (exp((a * x)) + 1.0)) + (1.0 * 1.0)))));
	} else {
		double temp_1;
		if (((a * x) <= 6.840956219609134e-13)) {
			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((exp(((a * x) * 3.0)) - pow(1.0, 3.0))) * cbrt((exp(((a * x) * 3.0)) - pow(1.0, 3.0)))) / (cbrt(((exp((a * x)) * (exp((a * x)) + 1.0)) + (1.0 * 1.0))) * cbrt(((exp((a * x)) * (exp((a * x)) + 1.0)) + (1.0 * 1.0))))) * (cbrt(((sqrt(exp(((a * x) * 3.0))) + pow(sqrt(1.0), 3.0)) * (sqrt(exp(((a * x) * 3.0))) - pow(sqrt(1.0), 3.0)))) / cbrt(((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.0
Target0.2
Herbie8.7
\[\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) < -1.9722186113471817e-05

    1. Initial program 0.1

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

      \[\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.1

      \[\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.1

      \[\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-cube-cbrt0.1

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

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

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

      \[\leadsto \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{\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)}}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\]
    13. Simplified0.1

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

    if -1.9722186113471817e-05 < (* a x) < 6.840956219609134e-13

    1. Initial program 44.8

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

      \[\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.1

      \[\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 6.840956219609134e-13 < (* a x)

    1. Initial program 14.9

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

      \[\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. Simplified15.8

      \[\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-exp14.9

      \[\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-cube-cbrt15.0

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

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}\right) \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}}{\left(\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}\right) \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\]
    10. Applied times-frac15.0

      \[\leadsto \color{blue}{\frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}}\]
    11. Using strategy rm
    12. Applied add-sqr-sqrt15.0

      \[\leadsto \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {\color{blue}{\left(\sqrt{1} \cdot \sqrt{1}\right)}}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\]
    13. Applied unpow-prod-down15.0

      \[\leadsto \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - \color{blue}{{\left(\sqrt{1}\right)}^{3} \cdot {\left(\sqrt{1}\right)}^{3}}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\]
    14. Applied add-sqr-sqrt15.1

      \[\leadsto \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{\color{blue}{\sqrt{e^{\left(a \cdot x\right) \cdot 3}} \cdot \sqrt{e^{\left(a \cdot x\right) \cdot 3}}} - {\left(\sqrt{1}\right)}^{3} \cdot {\left(\sqrt{1}\right)}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\]
    15. Applied difference-of-squares15.2

      \[\leadsto \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{\color{blue}{\left(\sqrt{e^{\left(a \cdot x\right) \cdot 3}} + {\left(\sqrt{1}\right)}^{3}\right) \cdot \left(\sqrt{e^{\left(a \cdot x\right) \cdot 3}} - {\left(\sqrt{1}\right)}^{3}\right)}}}{\sqrt[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 simplification8.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \le -1.97221861134718174 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{\sqrt[3]{{\left(e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}\right)}^{3}}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\\ \mathbf{elif}\;a \cdot x \le 6.8409562196091337 \cdot 10^{-13}:\\ \;\;\;\;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]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}} \cdot \sqrt[3]{e^{\left(a \cdot x\right) \cdot 3} - {1}^{3}}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1} \cdot \sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}} \cdot \frac{\sqrt[3]{\left(\sqrt{e^{\left(a \cdot x\right) \cdot 3}} + {\left(\sqrt{1}\right)}^{3}\right) \cdot \left(\sqrt{e^{\left(a \cdot x\right) \cdot 3}} - {\left(\sqrt{1}\right)}^{3}\right)}}{\sqrt[3]{e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right) + 1 \cdot 1}}\\ \end{array}\]

Reproduce

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