Average Error: 14.0 → 13.3
Time: 10.6s
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|} \]
\[\begin{array}{l} t_0 := \frac{1}{1 + \left|x\right| \cdot 0.3275911}\\ t_1 := \mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)\\ t_2 := -0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t_1}}{t_1}}{t_1}\\ t_3 := \sqrt[3]{\mathsf{log1p}\left(\frac{-0.254829592 - \frac{t_2}{t_1}}{t_1 \cdot e^{x \cdot x}}\right)}\\ {\left(e^{t_3 \cdot t_3}\right)}^{\left(\sqrt[3]{\log \log \left(e^{1 - \left(t_0 \cdot \left(0.254829592 + t_2 \cdot t_0\right)\right) \cdot e^{-x \cdot x}}\right)}\right)} \end{array} \]
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|}
\begin{array}{l}
t_0 := \frac{1}{1 + \left|x\right| \cdot 0.3275911}\\
t_1 := \mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)\\
t_2 := -0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t_1}}{t_1}}{t_1}\\
t_3 := \sqrt[3]{\mathsf{log1p}\left(\frac{-0.254829592 - \frac{t_2}{t_1}}{t_1 \cdot e^{x \cdot x}}\right)}\\
{\left(e^{t_3 \cdot t_3}\right)}^{\left(\sqrt[3]{\log \log \left(e^{1 - \left(t_0 \cdot \left(0.254829592 + t_2 \cdot t_0\right)\right) \cdot e^{-x \cdot x}}\right)}\right)}
\end{array}
(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
 (let* ((t_0 (/ 1.0 (+ 1.0 (* (fabs x) 0.3275911))))
        (t_1 (fma (fabs x) 0.3275911 1.0))
        (t_2
         (+
          -0.284496736
          (/
           (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_1)) t_1))
           t_1)))
        (t_3
         (cbrt
          (log1p (/ (- -0.254829592 (/ t_2 t_1)) (* t_1 (exp (* x x))))))))
   (pow
    (exp (* t_3 t_3))
    (cbrt
     (log
      (log
       (exp
        (-
         1.0
         (* (* t_0 (+ 0.254829592 (* t_2 t_0))) (exp (- (* x x))))))))))))
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) {
	double t_0 = 1.0 / (1.0 + (fabs(x) * 0.3275911));
	double t_1 = fma(fabs(x), 0.3275911, 1.0);
	double t_2 = -0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_1)) / t_1)) / t_1);
	double t_3 = cbrt(log1p((-0.254829592 - (t_2 / t_1)) / (t_1 * exp(x * x))));
	return pow(exp(t_3 * t_3), cbrt(log(log(exp(1.0 - ((t_0 * (0.254829592 + (t_2 * t_0))) * exp(-(x * x))))))));
}

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. Applied add-log-exp_binary6414.0

    \[\leadsto \color{blue}{\log \left(e^{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|}}\right)} \]
  3. Taylor expanded in x around 0 14.0

    \[\leadsto \log \left(e^{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 + \color{blue}{\frac{\left(1.421413741 + 1.061405429 \cdot \frac{1}{{\left(1 + 0.3275911 \cdot \left|x\right|\right)}^{2}}\right) - 1.453152027 \cdot \frac{1}{1 + 0.3275911 \cdot \left|x\right|}}{1 + 0.3275911 \cdot \left|x\right|}}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right) \]
  4. Simplified14.0

    \[\leadsto \log \left(e^{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 + \color{blue}{\frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right) \]
  5. Applied add-exp-log_binary6414.0

    \[\leadsto \color{blue}{e^{\log \log \left(e^{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.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right)}} \]
  6. Applied add-cube-cbrt_binary6414.0

    \[\leadsto e^{\color{blue}{\left(\sqrt[3]{\log \log \left(e^{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.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right)} \cdot \sqrt[3]{\log \log \left(e^{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.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right)}\right) \cdot \sqrt[3]{\log \log \left(e^{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.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right)}}} \]
  7. Applied exp-prod_binary6414.0

    \[\leadsto \color{blue}{{\left(e^{\sqrt[3]{\log \log \left(e^{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.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right)} \cdot \sqrt[3]{\log \log \left(e^{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.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right)}}\right)}^{\left(\sqrt[3]{\log \log \left(e^{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.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right)}\right)}} \]
  8. Simplified13.3

    \[\leadsto {\color{blue}{\left(e^{\sqrt[3]{\mathsf{log1p}\left(\frac{-0.254829592 - \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right) \cdot e^{x \cdot x}}\right)} \cdot \sqrt[3]{\mathsf{log1p}\left(\frac{-0.254829592 - \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right) \cdot e^{x \cdot x}}\right)}}\right)}}^{\left(\sqrt[3]{\log \log \left(e^{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.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}}{\mathsf{fma}\left(\left|x\right|, 0.3275911, 1\right)}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}}\right)}\right)} \]
  9. Final simplification13.3

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

Reproduce

herbie shell --seed 2021273 
(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)))))))