Average Error: 29.7 → 0.0
Time: 4.7s
Precision: binary64
\[e^{a \cdot x} - 1 \]
\[\mathsf{expm1}\left(a \cdot x\right) \]
e^{a \cdot x} - 1
\mathsf{expm1}\left(a \cdot x\right)
(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x) :precision binary64 (expm1 (* a x)))
double code(double a, double x) {
	return exp(a * x) - 1.0;
}
double code(double a, double x) {
	return expm1(a * x);
}

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.7
Target0.2
Herbie0.0
\[\begin{array}{l} \mathbf{if}\;\left|a \cdot x\right| < 0.1:\\ \;\;\;\;\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. Initial program 29.7

    \[e^{a \cdot x} - 1 \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{expm1}\left(a \cdot x\right)} \]
  3. Applied add-cube-cbrt_binary640.7

    \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)} \cdot \sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right) \cdot \sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}} \]
  4. Applied pow1_binary640.7

    \[\leadsto \left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)} \cdot \sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right) \cdot \color{blue}{{\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right)}^{1}} \]
  5. Applied pow1_binary640.7

    \[\leadsto \left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)} \cdot \color{blue}{{\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right)}^{1}}\right) \cdot {\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right)}^{1} \]
  6. Applied pow1_binary640.7

    \[\leadsto \left(\color{blue}{{\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right)}^{1}} \cdot {\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right)}^{1}\right) \cdot {\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right)}^{1} \]
  7. Applied pow-prod-down_binary640.7

    \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)} \cdot \sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right)}^{1}} \cdot {\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right)}^{1} \]
  8. Applied pow-prod-down_binary640.7

    \[\leadsto \color{blue}{{\left(\left(\sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)} \cdot \sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right) \cdot \sqrt[3]{\mathsf{expm1}\left(a \cdot x\right)}\right)}^{1}} \]
  9. Simplified0.0

    \[\leadsto {\color{blue}{\left(\mathsf{expm1}\left(a \cdot x\right)\right)}}^{1} \]
  10. Final simplification0.0

    \[\leadsto \mathsf{expm1}\left(a \cdot x\right) \]

Reproduce

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

  :herbie-target
  (if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1.0 (+ (/ (* a x) 2.0) (/ (pow (* a x) 2.0) 6.0)))) (- (exp (* a x)) 1.0))

  (- (exp (* a x)) 1.0))