e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -3.98282351915828164 \cdot 10^{-7}:\\
\;\;\;\;\sqrt[3]{e^{a \cdot x} - 1} \cdot \frac{\sqrt[3]{\left(e^{a \cdot x} \cdot e^{a \cdot x} - 1 \cdot 1\right) \cdot \left(e^{a \cdot x} - 1\right)}}{\sqrt[3]{e^{a \cdot x} + 1}}\\
\mathbf{elif}\;a \cdot x \le 2.1553377009136073 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, {a}^{2} \cdot {x}^{2}, \mathsf{fma}\left(\frac{1}{6}, {a}^{3} \cdot {x}^{3}, a \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{e^{a \cdot x} - 1}\right)\\
\end{array}double f(double a, double x) {
double r176743 = a;
double r176744 = x;
double r176745 = r176743 * r176744;
double r176746 = exp(r176745);
double r176747 = 1.0;
double r176748 = r176746 - r176747;
return r176748;
}
double f(double a, double x) {
double r176749 = a;
double r176750 = x;
double r176751 = r176749 * r176750;
double r176752 = -3.9828235191582816e-07;
bool r176753 = r176751 <= r176752;
double r176754 = exp(r176751);
double r176755 = 1.0;
double r176756 = r176754 - r176755;
double r176757 = cbrt(r176756);
double r176758 = r176754 * r176754;
double r176759 = r176755 * r176755;
double r176760 = r176758 - r176759;
double r176761 = r176760 * r176756;
double r176762 = cbrt(r176761);
double r176763 = r176754 + r176755;
double r176764 = cbrt(r176763);
double r176765 = r176762 / r176764;
double r176766 = r176757 * r176765;
double r176767 = 2.1553377009136073e-16;
bool r176768 = r176751 <= r176767;
double r176769 = 0.5;
double r176770 = 2.0;
double r176771 = pow(r176749, r176770);
double r176772 = pow(r176750, r176770);
double r176773 = r176771 * r176772;
double r176774 = 0.16666666666666666;
double r176775 = 3.0;
double r176776 = pow(r176749, r176775);
double r176777 = pow(r176750, r176775);
double r176778 = r176776 * r176777;
double r176779 = fma(r176774, r176778, r176751);
double r176780 = fma(r176769, r176773, r176779);
double r176781 = exp(r176756);
double r176782 = log(r176781);
double r176783 = r176768 ? r176780 : r176782;
double r176784 = r176753 ? r176766 : r176783;
return r176784;
}




Bits error versus a




Bits error versus x
| Original | 28.7 |
|---|---|
| Target | 0.2 |
| Herbie | 8.7 |
if (* a x) < -3.9828235191582816e-07Initial program 0.1
rmApplied add-cbrt-cube0.1
Simplified0.1
rmApplied cube-mult0.1
Applied cbrt-prod0.1
rmApplied flip--0.1
Applied associate-*r/0.1
Applied cbrt-div0.1
Simplified0.1
if -3.9828235191582816e-07 < (* a x) < 2.1553377009136073e-16Initial program 44.9
Taylor expanded around 0 13.0
Simplified13.0
if 2.1553377009136073e-16 < (* a x) Initial program 17.4
rmApplied add-log-exp17.4
Applied add-log-exp24.5
Applied diff-log24.9
Simplified24.5
Final simplification8.7
herbie shell --seed 2020020 +o rules:numerics
(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))