Average Error: 13.6 → 13.6
Time: 8.6s
Precision: 64
\[1 - \left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(0.2548295919999999936678136691625695675611 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(-0.2844967359999999723108032867457950487733 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(1.421413741000000063863240029604639858007 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(-1.453152027000000012790792425221297889948 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot 1.061405428999999900341322245367337018251\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
\[\log \left(e^{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right)\right), 1.061405428999999900341322245367337018251, -1.453152027000000012790792425221297889948\right), 1.421413741000000063863240029604639858007\right), -0.2844967359999999723108032867457950487733\right), 0.2548295919999999936678136691625695675611\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.3275911000000000239396058532292954623699, 1\right)}, 1\right)}\right)\]
1 - \left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(0.2548295919999999936678136691625695675611 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(-0.2844967359999999723108032867457950487733 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(1.421413741000000063863240029604639858007 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(-1.453152027000000012790792425221297889948 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot 1.061405428999999900341322245367337018251\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
\log \left(e^{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right)\right), 1.061405428999999900341322245367337018251, -1.453152027000000012790792425221297889948\right), 1.421413741000000063863240029604639858007\right), -0.2844967359999999723108032867457950487733\right), 0.2548295919999999936678136691625695675611\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.3275911000000000239396058532292954623699, 1\right)}, 1\right)}\right)
double f(double x) {
        double r172597 = 1.0;
        double r172598 = 0.3275911;
        double r172599 = x;
        double r172600 = fabs(r172599);
        double r172601 = r172598 * r172600;
        double r172602 = r172597 + r172601;
        double r172603 = r172597 / r172602;
        double r172604 = 0.254829592;
        double r172605 = -0.284496736;
        double r172606 = 1.421413741;
        double r172607 = -1.453152027;
        double r172608 = 1.061405429;
        double r172609 = r172603 * r172608;
        double r172610 = r172607 + r172609;
        double r172611 = r172603 * r172610;
        double r172612 = r172606 + r172611;
        double r172613 = r172603 * r172612;
        double r172614 = r172605 + r172613;
        double r172615 = r172603 * r172614;
        double r172616 = r172604 + r172615;
        double r172617 = r172603 * r172616;
        double r172618 = r172600 * r172600;
        double r172619 = -r172618;
        double r172620 = exp(r172619);
        double r172621 = r172617 * r172620;
        double r172622 = r172597 - r172621;
        return r172622;
}

double f(double x) {
        double r172623 = 1.0;
        double r172624 = 0.3275911;
        double r172625 = x;
        double r172626 = fabs(r172625);
        double r172627 = r172624 * r172626;
        double r172628 = r172623 + r172627;
        double r172629 = r172623 / r172628;
        double r172630 = log1p(r172629);
        double r172631 = expm1(r172630);
        double r172632 = 1.061405429;
        double r172633 = -1.453152027;
        double r172634 = fma(r172631, r172632, r172633);
        double r172635 = 1.421413741;
        double r172636 = fma(r172629, r172634, r172635);
        double r172637 = -0.284496736;
        double r172638 = fma(r172629, r172636, r172637);
        double r172639 = 0.254829592;
        double r172640 = fma(r172629, r172638, r172639);
        double r172641 = r172626 * r172626;
        double r172642 = exp(r172641);
        double r172643 = r172640 / r172642;
        double r172644 = -r172623;
        double r172645 = fma(r172626, r172624, r172623);
        double r172646 = r172644 / r172645;
        double r172647 = fma(r172643, r172646, r172623);
        double r172648 = exp(r172647);
        double r172649 = log(r172648);
        return r172649;
}

Error

Bits error versus x

Derivation

  1. Initial program 13.6

    \[1 - \left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(0.2548295919999999936678136691625695675611 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(-0.2844967359999999723108032867457950487733 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(1.421413741000000063863240029604639858007 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(-1.453152027000000012790792425221297889948 + \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot 1.061405428999999900341322245367337018251\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
  2. Simplified13.6

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, 1.061405428999999900341322245367337018251, -1.453152027000000012790792425221297889948\right), 1.421413741000000063863240029604639858007\right), -0.2844967359999999723108032867457950487733\right), 0.2548295919999999936678136691625695675611\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.3275911000000000239396058532292954623699, 1\right)}, 1\right)}\]
  3. Using strategy rm
  4. Applied expm1-log1p-u13.6

    \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right)\right)}, 1.061405428999999900341322245367337018251, -1.453152027000000012790792425221297889948\right), 1.421413741000000063863240029604639858007\right), -0.2844967359999999723108032867457950487733\right), 0.2548295919999999936678136691625695675611\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.3275911000000000239396058532292954623699, 1\right)}, 1\right)\]
  5. Using strategy rm
  6. Applied add-log-exp13.6

    \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right)\right), 1.061405428999999900341322245367337018251, -1.453152027000000012790792425221297889948\right), 1.421413741000000063863240029604639858007\right), -0.2844967359999999723108032867457950487733\right), 0.2548295919999999936678136691625695675611\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.3275911000000000239396058532292954623699, 1\right)}, 1\right)}\right)}\]
  7. Final simplification13.6

    \[\leadsto \log \left(e^{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}, \mathsf{fma}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right)\right), 1.061405428999999900341322245367337018251, -1.453152027000000012790792425221297889948\right), 1.421413741000000063863240029604639858007\right), -0.2844967359999999723108032867457950487733\right), 0.2548295919999999936678136691625695675611\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.3275911000000000239396058532292954623699, 1\right)}, 1\right)}\right)\]

Reproduce

herbie shell --seed 2019344 +o rules:numerics
(FPCore (x)
  :name "Jmat.Real.erf"
  :precision binary64
  (- 1 (* (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) (+ 0.254829592 (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) (+ -0.284496736 (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) (+ 1.421413741 (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) (+ -1.453152027 (* (/ 1 (+ 1 (* 0.3275911 (fabs x)))) 1.061405429))))))))) (exp (- (* (fabs x) (fabs x)))))))