Average Error: 13.9 → 13.9
Time: 30.0s
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|}\]
\[1 - \mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, \mathsf{fma}\left(-0.2844967359999999723108032867457950487733, \frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, 0.2548295919999999936678136691625695675611\right), \mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, \mathsf{fma}\left(1.061405428999999900341322245367337018251, \frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, -1.453152027000000012790792425221297889948\right), 1.421413741000000063863240029604639858007\right) \cdot {\left(\frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}\right)}^{3}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\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|}
1 - \mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, \mathsf{fma}\left(-0.2844967359999999723108032867457950487733, \frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, 0.2548295919999999936678136691625695675611\right), \mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, \mathsf{fma}\left(1.061405428999999900341322245367337018251, \frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, -1.453152027000000012790792425221297889948\right), 1.421413741000000063863240029604639858007\right) \cdot {\left(\frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}\right)}^{3}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
double f(double x) {
        double r123156 = 1.0;
        double r123157 = 0.3275911;
        double r123158 = x;
        double r123159 = fabs(r123158);
        double r123160 = r123157 * r123159;
        double r123161 = r123156 + r123160;
        double r123162 = r123156 / r123161;
        double r123163 = 0.254829592;
        double r123164 = -0.284496736;
        double r123165 = 1.421413741;
        double r123166 = -1.453152027;
        double r123167 = 1.061405429;
        double r123168 = r123162 * r123167;
        double r123169 = r123166 + r123168;
        double r123170 = r123162 * r123169;
        double r123171 = r123165 + r123170;
        double r123172 = r123162 * r123171;
        double r123173 = r123164 + r123172;
        double r123174 = r123162 * r123173;
        double r123175 = r123163 + r123174;
        double r123176 = r123162 * r123175;
        double r123177 = r123159 * r123159;
        double r123178 = -r123177;
        double r123179 = exp(r123178);
        double r123180 = r123176 * r123179;
        double r123181 = r123156 - r123180;
        return r123181;
}

double f(double x) {
        double r123182 = 1.0;
        double r123183 = 0.3275911;
        double r123184 = x;
        double r123185 = fabs(r123184);
        double r123186 = fma(r123183, r123185, r123182);
        double r123187 = r123182 / r123186;
        double r123188 = -0.284496736;
        double r123189 = 0.254829592;
        double r123190 = fma(r123188, r123187, r123189);
        double r123191 = 1.061405429;
        double r123192 = -1.453152027;
        double r123193 = fma(r123191, r123187, r123192);
        double r123194 = 1.421413741;
        double r123195 = fma(r123187, r123193, r123194);
        double r123196 = 3.0;
        double r123197 = pow(r123187, r123196);
        double r123198 = r123195 * r123197;
        double r123199 = fma(r123187, r123190, r123198);
        double r123200 = log1p(r123199);
        double r123201 = expm1(r123200);
        double r123202 = r123185 * r123185;
        double r123203 = -r123202;
        double r123204 = exp(r123203);
        double r123205 = r123201 * r123204;
        double r123206 = r123182 - r123205;
        return r123206;
}

Error

Bits error versus x

Derivation

  1. Initial program 13.9

    \[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. Using strategy rm
  3. Applied distribute-rgt-in13.9

    \[\leadsto 1 - \left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(0.2548295919999999936678136691625695675611 + \color{blue}{\left(-0.2844967359999999723108032867457950487733 \cdot \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} + \left(\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) \cdot \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right)}\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
  4. Applied associate-+r+13.9

    \[\leadsto 1 - \left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \color{blue}{\left(\left(0.2548295919999999936678136691625695675611 + -0.2844967359999999723108032867457950487733 \cdot \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right) + \left(\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) \cdot \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right)}\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
  5. Simplified13.9

    \[\leadsto 1 - \left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(\color{blue}{\mathsf{fma}\left(-0.2844967359999999723108032867457950487733, \frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, 0.2548295919999999936678136691625695675611\right)} + \left(\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) \cdot \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
  6. Using strategy rm
  7. Applied expm1-log1p-u13.9

    \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|} \cdot \left(\mathsf{fma}\left(-0.2844967359999999723108032867457950487733, \frac{1}{\mathsf{fma}\left(0.3275911000000000239396058532292954623699, \left|x\right|, 1\right)}, 0.2548295919999999936678136691625695675611\right) + \left(\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) \cdot \frac{1}{1 + 0.3275911000000000239396058532292954623699 \cdot \left|x\right|}\right)\right)\right)} \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
  8. Simplified13.9

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

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

Reproduce

herbie shell --seed 2019306 +o rules:numerics
(FPCore (x)
  :name "Jmat.Real.erf"
  :precision binary64
  (- 1 (* (* (/ 1 (+ 1 (* 0.32759110000000002 (fabs x)))) (+ 0.25482959199999999 (* (/ 1 (+ 1 (* 0.32759110000000002 (fabs x)))) (+ -0.284496735999999972 (* (/ 1 (+ 1 (* 0.32759110000000002 (fabs x)))) (+ 1.42141374100000006 (* (/ 1 (+ 1 (* 0.32759110000000002 (fabs x)))) (+ -1.45315202700000001 (* (/ 1 (+ 1 (* 0.32759110000000002 (fabs x)))) 1.0614054289999999))))))))) (exp (- (* (fabs x) (fabs x)))))))