Average Error: 14.0 → 14.0
Time: 29.4s
Precision: 64
\[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
\[1 - \frac{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{e^{\left|x\right| \cdot \left|x\right|}} \cdot \left(\left(\left(\frac{1.061405429}{\left(\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\right) \cdot \left(\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\right)} + 0.254829592\right) - \left(\frac{\frac{1.453152027}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)} + \frac{0.284496736}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}\right)\right) + \frac{\frac{1.421413741}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}\right)\]
1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
1 - \frac{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{e^{\left|x\right| \cdot \left|x\right|}} \cdot \left(\left(\left(\frac{1.061405429}{\left(\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\right) \cdot \left(\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\right)} + 0.254829592\right) - \left(\frac{\frac{1.453152027}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)} + \frac{0.284496736}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}\right)\right) + \frac{\frac{1.421413741}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}\right)
double f(double x) {
        double r6231084 = 1.0;
        double r6231085 = 0.3275911;
        double r6231086 = x;
        double r6231087 = fabs(r6231086);
        double r6231088 = r6231085 * r6231087;
        double r6231089 = r6231084 + r6231088;
        double r6231090 = r6231084 / r6231089;
        double r6231091 = 0.254829592;
        double r6231092 = -0.284496736;
        double r6231093 = 1.421413741;
        double r6231094 = -1.453152027;
        double r6231095 = 1.061405429;
        double r6231096 = r6231090 * r6231095;
        double r6231097 = r6231094 + r6231096;
        double r6231098 = r6231090 * r6231097;
        double r6231099 = r6231093 + r6231098;
        double r6231100 = r6231090 * r6231099;
        double r6231101 = r6231092 + r6231100;
        double r6231102 = r6231090 * r6231101;
        double r6231103 = r6231091 + r6231102;
        double r6231104 = r6231090 * r6231103;
        double r6231105 = r6231087 * r6231087;
        double r6231106 = -r6231105;
        double r6231107 = exp(r6231106);
        double r6231108 = r6231104 * r6231107;
        double r6231109 = r6231084 - r6231108;
        return r6231109;
}

double f(double x) {
        double r6231110 = 1.0;
        double r6231111 = 0.3275911;
        double r6231112 = x;
        double r6231113 = fabs(r6231112);
        double r6231114 = fma(r6231111, r6231113, r6231110);
        double r6231115 = r6231110 / r6231114;
        double r6231116 = r6231113 * r6231113;
        double r6231117 = exp(r6231116);
        double r6231118 = r6231115 / r6231117;
        double r6231119 = 1.061405429;
        double r6231120 = r6231114 * r6231114;
        double r6231121 = r6231120 * r6231120;
        double r6231122 = r6231119 / r6231121;
        double r6231123 = 0.254829592;
        double r6231124 = r6231122 + r6231123;
        double r6231125 = 1.453152027;
        double r6231126 = r6231125 / r6231120;
        double r6231127 = r6231126 / r6231114;
        double r6231128 = 0.284496736;
        double r6231129 = r6231128 / r6231114;
        double r6231130 = r6231127 + r6231129;
        double r6231131 = r6231124 - r6231130;
        double r6231132 = 1.421413741;
        double r6231133 = r6231132 / r6231114;
        double r6231134 = r6231133 / r6231114;
        double r6231135 = r6231131 + r6231134;
        double r6231136 = r6231118 * r6231135;
        double r6231137 = r6231110 - r6231136;
        return r6231137;
}

Error

Bits error versus x

Derivation

  1. Initial program 14.0

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
  2. Simplified14.0

    \[\leadsto \color{blue}{1 - \frac{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{e^{\left|x\right| \cdot \left|x\right|}} \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}, \mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}, \frac{1.061405429}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)} + -1.453152027, 1.421413741\right), -0.284496736\right), \frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}, 0.254829592\right)}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt14.0

    \[\leadsto 1 - \frac{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{e^{\left|x\right| \cdot \left|x\right|}} \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}, \mathsf{fma}\left(\color{blue}{\left(\sqrt[3]{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}} \cdot \sqrt[3]{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}\right) \cdot \sqrt[3]{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}}, \frac{1.061405429}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)} + -1.453152027, 1.421413741\right), -0.284496736\right), \frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}, 0.254829592\right)\]
  5. Taylor expanded around 0 14.8

    \[\leadsto 1 - \frac{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{e^{\left|x\right| \cdot \left|x\right|}} \cdot \color{blue}{\left(\left(1.061405429 \cdot \frac{1}{{\left(0.3275911 \cdot \left|x\right| + 1\right)}^{4}} + \left(1.421413741 \cdot \frac{1}{{\left(0.3275911 \cdot \left|x\right| + 1\right)}^{2}} + 0.254829592\right)\right) - \left(0.284496736 \cdot \frac{1}{0.3275911 \cdot \left|x\right| + 1} + 1.453152027 \cdot \frac{1}{{\left(0.3275911 \cdot \left|x\right| + 1\right)}^{3}}\right)\right)}\]
  6. Simplified14.0

    \[\leadsto 1 - \frac{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{e^{\left|x\right| \cdot \left|x\right|}} \cdot \color{blue}{\left(\frac{\frac{1.421413741}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)} + \left(\left(0.254829592 + \frac{1.061405429}{\left(\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\right) \cdot \left(\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\right)}\right) - \left(\frac{0.284496736}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)} + \frac{\frac{1.453152027}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}\right)\right)\right)}\]
  7. Final simplification14.0

    \[\leadsto 1 - \frac{\frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{e^{\left|x\right| \cdot \left|x\right|}} \cdot \left(\left(\left(\frac{1.061405429}{\left(\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\right) \cdot \left(\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\right)} + 0.254829592\right) - \left(\frac{\frac{1.453152027}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right) \cdot \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)} + \frac{0.284496736}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}\right)\right) + \frac{\frac{1.421413741}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}\right)\]

Reproduce

herbie shell --seed 2019164 +o rules:numerics
(FPCore (x)
  :name "Jmat.Real.erf"
  (- 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)))))))