Average Error: 2.8 → 1.2
Time: 9.1s
Precision: binary64
\[x \geq 0.5\]
\[\left(\frac{1}{\sqrt{\pi}} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(\frac{1}{\left|x\right|} + \frac{1}{2} \cdot \left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right) + \frac{3}{4} \cdot \left(\left(\left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right) + \frac{15}{8} \cdot \left(\left(\left(\left(\left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right)\]
\[\frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|} + \frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|} \cdot \left(\frac{0.5 + \frac{0.75}{x \cdot x}}{x \cdot x} + \frac{1.875}{{x}^{6}}\right)\]
\left(\frac{1}{\sqrt{\pi}} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(\frac{1}{\left|x\right|} + \frac{1}{2} \cdot \left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right) + \frac{3}{4} \cdot \left(\left(\left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right) + \frac{15}{8} \cdot \left(\left(\left(\left(\left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right)
\frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|} + \frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|} \cdot \left(\frac{0.5 + \frac{0.75}{x \cdot x}}{x \cdot x} + \frac{1.875}{{x}^{6}}\right)
(FPCore (x)
 :precision binary64
 (*
  (* (/ 1.0 (sqrt PI)) (exp (* (fabs x) (fabs x))))
  (+
   (+
    (+
     (/ 1.0 (fabs x))
     (*
      (/ 1.0 2.0)
      (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))
    (*
     (/ 3.0 4.0)
     (*
      (*
       (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))
       (/ 1.0 (fabs x)))
      (/ 1.0 (fabs x)))))
   (*
    (/ 15.0 8.0)
    (*
     (*
      (*
       (*
        (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))
        (/ 1.0 (fabs x)))
       (/ 1.0 (fabs x)))
      (/ 1.0 (fabs x)))
     (/ 1.0 (fabs x)))))))
(FPCore (x)
 :precision binary64
 (+
  (/ (* (pow (exp x) x) (sqrt (/ 1.0 PI))) (fabs x))
  (*
   (/ (* (pow (exp x) x) (sqrt (/ 1.0 PI))) (fabs x))
   (+ (/ (+ 0.5 (/ 0.75 (* x x))) (* x x)) (/ 1.875 (pow x 6.0))))))
double code(double x) {
	return ((1.0 / sqrt((double) M_PI)) * exp(fabs(x) * fabs(x))) * ((((1.0 / fabs(x)) + ((1.0 / 2.0) * (((1.0 / fabs(x)) * (1.0 / fabs(x))) * (1.0 / fabs(x))))) + ((3.0 / 4.0) * (((((1.0 / fabs(x)) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))))) + ((15.0 / 8.0) * (((((((1.0 / fabs(x)) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x)))));
}
double code(double x) {
	return ((pow(exp(x), x) * sqrt(1.0 / ((double) M_PI))) / fabs(x)) + (((pow(exp(x), x) * sqrt(1.0 / ((double) M_PI))) / fabs(x)) * (((0.5 + (0.75 / (x * x))) / (x * x)) + (1.875 / pow(x, 6.0))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 2.8

    \[\left(\frac{1}{\sqrt{\pi}} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(\frac{1}{\left|x\right|} + \frac{1}{2} \cdot \left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right) + \frac{3}{4} \cdot \left(\left(\left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right) + \frac{15}{8} \cdot \left(\left(\left(\left(\left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right)\]
  2. Simplified2.7

    \[\leadsto \color{blue}{\frac{\frac{e^{x \cdot x}}{\sqrt{\pi}}}{\left|x\right|} \cdot \left(1 + \left(\frac{1.875}{{x}^{6}} + \frac{0.5 + \frac{0.75}{x \cdot x}}{x \cdot x}\right)\right)}\]
  3. Taylor expanded around inf 2.6

    \[\leadsto \frac{\color{blue}{e^{{x}^{2}} \cdot \sqrt{\frac{1}{\pi}}}}{\left|x\right|} \cdot \left(1 + \left(\frac{1.875}{{x}^{6}} + \frac{0.5 + \frac{0.75}{x \cdot x}}{x \cdot x}\right)\right)\]
  4. Simplified1.2

    \[\leadsto \frac{\color{blue}{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}}{\left|x\right|} \cdot \left(1 + \left(\frac{1.875}{{x}^{6}} + \frac{0.5 + \frac{0.75}{x \cdot x}}{x \cdot x}\right)\right)\]
  5. Using strategy rm
  6. Applied distribute-rgt-in_binary64_30971.2

    \[\leadsto \color{blue}{1 \cdot \frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|} + \left(\frac{1.875}{{x}^{6}} + \frac{0.5 + \frac{0.75}{x \cdot x}}{x \cdot x}\right) \cdot \frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|}}\]
  7. Simplified1.2

    \[\leadsto \color{blue}{\frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|}} + \left(\frac{1.875}{{x}^{6}} + \frac{0.5 + \frac{0.75}{x \cdot x}}{x \cdot x}\right) \cdot \frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|}\]
  8. Simplified1.2

    \[\leadsto \frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|} + \color{blue}{\frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|} \cdot \left(\frac{0.5 + \frac{0.75}{x \cdot x}}{x \cdot x} + \frac{1.875}{{x}^{6}}\right)}\]
  9. Final simplification1.2

    \[\leadsto \frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|} + \frac{{\left(e^{x}\right)}^{x} \cdot \sqrt{\frac{1}{\pi}}}{\left|x\right|} \cdot \left(\frac{0.5 + \frac{0.75}{x \cdot x}}{x \cdot x} + \frac{1.875}{{x}^{6}}\right)\]

Reproduce

herbie shell --seed 2020352 
(FPCore (x)
  :name "Jmat.Real.erfi, branch x greater than or equal to 5"
  :precision binary64
  :pre (>= x 0.5)
  (* (* (/ 1.0 (sqrt PI)) (exp (* (fabs x) (fabs x)))) (+ (+ (+ (/ 1.0 (fabs x)) (* (/ 1.0 2.0) (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))))) (* (/ 3.0 4.0) (* (* (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))))) (* (/ 15.0 8.0) (* (* (* (* (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))))