Average Error: 14.0 → 14.0
Time: 3.1m
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{\log \left(e^{\frac{\frac{1}{\frac{1 + \left|x\right| \cdot 0.3275911}{1.421413741 + \frac{\frac{1.061405429}{1 + \left|x\right| \cdot 0.3275911} + -1.453152027}{1 + \left|x\right| \cdot 0.3275911}}} + -0.284496736}{1 + \left|x\right| \cdot 0.3275911} + 0.254829592}\right)}{e^{\left|x\right| \cdot \left|x\right|} \cdot \left(1 + \left|x\right| \cdot 0.3275911\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{\log \left(e^{\frac{\frac{1}{\frac{1 + \left|x\right| \cdot 0.3275911}{1.421413741 + \frac{\frac{1.061405429}{1 + \left|x\right| \cdot 0.3275911} + -1.453152027}{1 + \left|x\right| \cdot 0.3275911}}} + -0.284496736}{1 + \left|x\right| \cdot 0.3275911} + 0.254829592}\right)}{e^{\left|x\right| \cdot \left|x\right|} \cdot \left(1 + \left|x\right| \cdot 0.3275911\right)}
double f(double x) {
        double r8717280 = 1.0;
        double r8717281 = 0.3275911;
        double r8717282 = x;
        double r8717283 = fabs(r8717282);
        double r8717284 = r8717281 * r8717283;
        double r8717285 = r8717280 + r8717284;
        double r8717286 = r8717280 / r8717285;
        double r8717287 = 0.254829592;
        double r8717288 = -0.284496736;
        double r8717289 = 1.421413741;
        double r8717290 = -1.453152027;
        double r8717291 = 1.061405429;
        double r8717292 = r8717286 * r8717291;
        double r8717293 = r8717290 + r8717292;
        double r8717294 = r8717286 * r8717293;
        double r8717295 = r8717289 + r8717294;
        double r8717296 = r8717286 * r8717295;
        double r8717297 = r8717288 + r8717296;
        double r8717298 = r8717286 * r8717297;
        double r8717299 = r8717287 + r8717298;
        double r8717300 = r8717286 * r8717299;
        double r8717301 = r8717283 * r8717283;
        double r8717302 = -r8717301;
        double r8717303 = exp(r8717302);
        double r8717304 = r8717300 * r8717303;
        double r8717305 = r8717280 - r8717304;
        return r8717305;
}

double f(double x) {
        double r8717306 = 1.0;
        double r8717307 = x;
        double r8717308 = fabs(r8717307);
        double r8717309 = 0.3275911;
        double r8717310 = r8717308 * r8717309;
        double r8717311 = r8717306 + r8717310;
        double r8717312 = 1.421413741;
        double r8717313 = 1.061405429;
        double r8717314 = r8717313 / r8717311;
        double r8717315 = -1.453152027;
        double r8717316 = r8717314 + r8717315;
        double r8717317 = r8717316 / r8717311;
        double r8717318 = r8717312 + r8717317;
        double r8717319 = r8717311 / r8717318;
        double r8717320 = r8717306 / r8717319;
        double r8717321 = -0.284496736;
        double r8717322 = r8717320 + r8717321;
        double r8717323 = r8717322 / r8717311;
        double r8717324 = 0.254829592;
        double r8717325 = r8717323 + r8717324;
        double r8717326 = exp(r8717325);
        double r8717327 = log(r8717326);
        double r8717328 = r8717308 * r8717308;
        double r8717329 = exp(r8717328);
        double r8717330 = r8717329 * r8717311;
        double r8717331 = r8717327 / r8717330;
        double r8717332 = r8717306 - r8717331;
        return r8717332;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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{\frac{\frac{\frac{1.061405429}{1 + \left|x\right| \cdot 0.3275911} + -1.453152027}{1 + \left|x\right| \cdot 0.3275911} + 1.421413741}{1 + \left|x\right| \cdot 0.3275911} + -0.284496736}{1 + \left|x\right| \cdot 0.3275911} + 0.254829592}{\left(1 + \left|x\right| \cdot 0.3275911\right) \cdot e^{\left|x\right| \cdot \left|x\right|}}}\]
  3. Using strategy rm
  4. Applied clear-num14.0

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

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

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

Reproduce

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