Average Error: 13.7 → 13.6
Time: 25.2s
Precision: binary64
\[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|}\]
\[e^{\log \log \left(e^{\left(1 + \frac{e^{-x \cdot x}}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}} \cdot \left(0.284496736 + \frac{1.453152027}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\right) - \left(\frac{1.061405429}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{5} \cdot e^{x \cdot x}} + \frac{e^{-x \cdot x}}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1.421413741}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\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|}
e^{\log \log \left(e^{\left(1 + \frac{e^{-x \cdot x}}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}} \cdot \left(0.284496736 + \frac{1.453152027}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\right) - \left(\frac{1.061405429}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{5} \cdot e^{x \cdot x}} + \frac{e^{-x \cdot x}}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1.421413741}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\right)}\right)}
(FPCore (x)
 :precision binary64
 (-
  1.0
  (*
   (*
    (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))
    (+
     0.254829592
     (*
      (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))
      (+
       -0.284496736
       (*
        (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))
        (+
         1.421413741
         (*
          (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))
          (+
           -1.453152027
           (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) 1.061405429)))))))))
   (exp (- (* (fabs x) (fabs x)))))))
(FPCore (x)
 :precision binary64
 (exp
  (log
   (log
    (exp
     (-
      (+
       1.0
       (*
        (/ (exp (- (* x x))) (pow (+ 1.0 (* 0.3275911 (fabs x))) 2.0))
        (+
         0.284496736
         (/ 1.453152027 (pow (+ 1.0 (* 0.3275911 (fabs x))) 2.0)))))
      (+
       (/
        1.061405429
        (* (pow (+ 1.0 (* 0.3275911 (fabs x))) 5.0) (exp (* x x))))
       (*
        (/ (exp (- (* x x))) (+ 1.0 (* 0.3275911 (fabs x))))
        (+
         0.254829592
         (/ 1.421413741 (pow (+ 1.0 (* 0.3275911 (fabs x))) 2.0)))))))))))
double code(double x) {
	return 1.0 - (((1.0 / (1.0 + (0.3275911 * fabs(x)))) * (0.254829592 + ((1.0 / (1.0 + (0.3275911 * fabs(x)))) * (-0.284496736 + ((1.0 / (1.0 + (0.3275911 * fabs(x)))) * (1.421413741 + ((1.0 / (1.0 + (0.3275911 * fabs(x)))) * (-1.453152027 + ((1.0 / (1.0 + (0.3275911 * fabs(x)))) * 1.061405429))))))))) * exp(-(fabs(x) * fabs(x))));
}
double code(double x) {
	return exp(log(log(exp((1.0 + ((exp(-(x * x)) / pow((1.0 + (0.3275911 * fabs(x))), 2.0)) * (0.284496736 + (1.453152027 / pow((1.0 + (0.3275911 * fabs(x))), 2.0))))) - ((1.061405429 / (pow((1.0 + (0.3275911 * fabs(x))), 5.0) * exp(x * x))) + ((exp(-(x * x)) / (1.0 + (0.3275911 * fabs(x)))) * (0.254829592 + (1.421413741 / pow((1.0 + (0.3275911 * fabs(x))), 2.0)))))))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 13.7

    \[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. Taylor expanded around 0 13.7

    \[\leadsto \color{blue}{\left(1.453152027 \cdot \frac{e^{-{\left(\left|x\right|\right)}^{2}}}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{4}} + \left(0.284496736 \cdot \frac{e^{-{\left(\left|x\right|\right)}^{2}}}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}} + 1\right)\right) - \left(0.254829592 \cdot \frac{e^{-{\left(\left|x\right|\right)}^{2}}}{0.3275911 \cdot \left|x\right| + 1} + \left(1.061405429 \cdot \frac{e^{-{\left(\left|x\right|\right)}^{2}}}{{\left(0.3275911 \cdot \left|x\right| + 1\right)}^{5}} + 1.421413741 \cdot \frac{e^{-{\left(\left|x\right|\right)}^{2}}}{\left(1 + 0.3275911 \cdot \left|x\right|\right) \cdot {\left(0.3275911 \cdot \left|x\right| + 1\right)}^{2}}\right)\right)}\]
  3. Simplified13.7

    \[\leadsto \color{blue}{\left(1 + \frac{e^{-x \cdot x}}{{\left(1 + \left|x\right| \cdot 0.3275911\right)}^{2}} \cdot \left(\frac{1.453152027}{{\left(1 + \left|x\right| \cdot 0.3275911\right)}^{2}} + 0.284496736\right)\right) - \left(\frac{\frac{1.061405429}{e^{x \cdot x}}}{{\left(1 + \left|x\right| \cdot 0.3275911\right)}^{5}} + \frac{e^{-x \cdot x}}{1 + \left|x\right| \cdot 0.3275911} \cdot \left(0.254829592 + \frac{1.421413741}{{\left(1 + \left|x\right| \cdot 0.3275911\right)}^{2}}\right)\right)}\]
  4. Using strategy rm
  5. Applied add-exp-log_binary6413.7

    \[\leadsto \color{blue}{e^{\log \left(\left(1 + \frac{e^{-x \cdot x}}{{\left(1 + \left|x\right| \cdot 0.3275911\right)}^{2}} \cdot \left(\frac{1.453152027}{{\left(1 + \left|x\right| \cdot 0.3275911\right)}^{2}} + 0.284496736\right)\right) - \left(\frac{\frac{1.061405429}{e^{x \cdot x}}}{{\left(1 + \left|x\right| \cdot 0.3275911\right)}^{5}} + \frac{e^{-x \cdot x}}{1 + \left|x\right| \cdot 0.3275911} \cdot \left(0.254829592 + \frac{1.421413741}{{\left(1 + \left|x\right| \cdot 0.3275911\right)}^{2}}\right)\right)\right)}}\]
  6. Simplified13.7

    \[\leadsto e^{\color{blue}{\log \left(\left(1 + \frac{e^{-x \cdot x}}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}} \cdot \left(0.284496736 + \frac{1.453152027}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\right) - \left(\frac{1.061405429}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{5} \cdot e^{x \cdot x}} + \frac{e^{-x \cdot x}}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1.421413741}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\right)\right)}}\]
  7. Using strategy rm
  8. Applied add-log-exp_binary6413.6

    \[\leadsto e^{\log \color{blue}{\log \left(e^{\left(1 + \frac{e^{-x \cdot x}}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}} \cdot \left(0.284496736 + \frac{1.453152027}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\right) - \left(\frac{1.061405429}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{5} \cdot e^{x \cdot x}} + \frac{e^{-x \cdot x}}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1.421413741}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right)\right)}\right)}}\]
  9. Final simplification13.6

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

Reproduce

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