Average Error: 0.0 → 0.1
Time: 1.8s
Precision: 64
\[0.707110000000000016 \cdot \left(\frac{2.30753 + x \cdot 0.27061000000000002}{1 + x \cdot \left(0.992290000000000005 + x \cdot 0.044810000000000003\right)} - x\right)\]
\[\mathsf{fma}\left(-x, 0.707110000000000016, \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{0.707110000000000016 \cdot \mathsf{fma}\left(0.27061000000000002, x, 2.30753\right)}{\mathsf{fma}\left(x, \mathsf{fma}\left(0.044810000000000003, x, 0.992290000000000005\right), 1\right)}\right)\right)\right)\]
0.707110000000000016 \cdot \left(\frac{2.30753 + x \cdot 0.27061000000000002}{1 + x \cdot \left(0.992290000000000005 + x \cdot 0.044810000000000003\right)} - x\right)
\mathsf{fma}\left(-x, 0.707110000000000016, \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{0.707110000000000016 \cdot \mathsf{fma}\left(0.27061000000000002, x, 2.30753\right)}{\mathsf{fma}\left(x, \mathsf{fma}\left(0.044810000000000003, x, 0.992290000000000005\right), 1\right)}\right)\right)\right)
double f(double x) {
        double r114752 = 0.70711;
        double r114753 = 2.30753;
        double r114754 = x;
        double r114755 = 0.27061;
        double r114756 = r114754 * r114755;
        double r114757 = r114753 + r114756;
        double r114758 = 1.0;
        double r114759 = 0.99229;
        double r114760 = 0.04481;
        double r114761 = r114754 * r114760;
        double r114762 = r114759 + r114761;
        double r114763 = r114754 * r114762;
        double r114764 = r114758 + r114763;
        double r114765 = r114757 / r114764;
        double r114766 = r114765 - r114754;
        double r114767 = r114752 * r114766;
        return r114767;
}

double f(double x) {
        double r114768 = x;
        double r114769 = -r114768;
        double r114770 = 0.70711;
        double r114771 = 0.27061;
        double r114772 = 2.30753;
        double r114773 = fma(r114771, r114768, r114772);
        double r114774 = r114770 * r114773;
        double r114775 = 0.04481;
        double r114776 = 0.99229;
        double r114777 = fma(r114775, r114768, r114776);
        double r114778 = 1.0;
        double r114779 = fma(r114768, r114777, r114778);
        double r114780 = r114774 / r114779;
        double r114781 = log1p(r114780);
        double r114782 = expm1(r114781);
        double r114783 = fma(r114769, r114770, r114782);
        return r114783;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

    \[0.707110000000000016 \cdot \left(\frac{2.30753 + x \cdot 0.27061000000000002}{1 + x \cdot \left(0.992290000000000005 + x \cdot 0.044810000000000003\right)} - x\right)\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(-x, 0.707110000000000016, \frac{0.707110000000000016 \cdot \mathsf{fma}\left(0.27061000000000002, x, 2.30753\right)}{\mathsf{fma}\left(x, \mathsf{fma}\left(0.044810000000000003, x, 0.992290000000000005\right), 1\right)}\right)}\]
  3. Using strategy rm
  4. Applied expm1-log1p-u0.1

    \[\leadsto \mathsf{fma}\left(-x, 0.707110000000000016, \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{0.707110000000000016 \cdot \mathsf{fma}\left(0.27061000000000002, x, 2.30753\right)}{\mathsf{fma}\left(x, \mathsf{fma}\left(0.044810000000000003, x, 0.992290000000000005\right), 1\right)}\right)\right)}\right)\]
  5. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(-x, 0.707110000000000016, \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{0.707110000000000016 \cdot \mathsf{fma}\left(0.27061000000000002, x, 2.30753\right)}{\mathsf{fma}\left(x, \mathsf{fma}\left(0.044810000000000003, x, 0.992290000000000005\right), 1\right)}\right)\right)\right)\]

Reproduce

herbie shell --seed 2020064 +o rules:numerics
(FPCore (x)
  :name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, B"
  :precision binary64
  (* 0.70711 (- (/ (+ 2.30753 (* x 0.27061)) (+ 1 (* x (+ 0.99229 (* x 0.04481))))) x)))