Average Error: 13.9 → 13.9
Time: 9.2s
Precision: 64
\[1 - \left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(0.25482959199999999 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(-0.284496735999999972 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(1.42141374100000006 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(-1.45315202700000001 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot 1.0614054289999999\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
\[\log \left(e^{\mathsf{fma}\left(\frac{\sqrt{\mathsf{fma}\left(\left(\sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}} \cdot \sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}}\right) \cdot \sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}}, \frac{1.0614054289999999}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{2}} + 1.42141374100000006, 0.25482959199999999 - \mathsf{fma}\left(0.284496735999999972, \frac{1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, \frac{1 \cdot 1.45315202700000001}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{3}}\right)\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)\]
1 - \left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(0.25482959199999999 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(-0.284496735999999972 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(1.42141374100000006 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(-1.45315202700000001 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot 1.0614054289999999\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
\log \left(e^{\mathsf{fma}\left(\frac{\sqrt{\mathsf{fma}\left(\left(\sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}} \cdot \sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}}\right) \cdot \sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}}, \frac{1.0614054289999999}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{2}} + 1.42141374100000006, 0.25482959199999999 - \mathsf{fma}\left(0.284496735999999972, \frac{1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, \frac{1 \cdot 1.45315202700000001}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{3}}\right)\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)
double f(double x) {
        double r138163 = 1.0;
        double r138164 = 0.3275911;
        double r138165 = x;
        double r138166 = fabs(r138165);
        double r138167 = r138164 * r138166;
        double r138168 = r138163 + r138167;
        double r138169 = r138163 / r138168;
        double r138170 = 0.254829592;
        double r138171 = -0.284496736;
        double r138172 = 1.421413741;
        double r138173 = -1.453152027;
        double r138174 = 1.061405429;
        double r138175 = r138169 * r138174;
        double r138176 = r138173 + r138175;
        double r138177 = r138169 * r138176;
        double r138178 = r138172 + r138177;
        double r138179 = r138169 * r138178;
        double r138180 = r138171 + r138179;
        double r138181 = r138169 * r138180;
        double r138182 = r138170 + r138181;
        double r138183 = r138169 * r138182;
        double r138184 = r138166 * r138166;
        double r138185 = -r138184;
        double r138186 = exp(r138185);
        double r138187 = r138183 * r138186;
        double r138188 = r138163 - r138187;
        return r138188;
}

double f(double x) {
        double r138189 = 1.0;
        double r138190 = 0.3275911;
        double r138191 = x;
        double r138192 = fabs(r138191);
        double r138193 = r138190 * r138192;
        double r138194 = 1.0;
        double r138195 = r138193 + r138194;
        double r138196 = 2.0;
        double r138197 = pow(r138195, r138196);
        double r138198 = r138189 / r138197;
        double r138199 = cbrt(r138198);
        double r138200 = r138199 * r138199;
        double r138201 = r138200 * r138199;
        double r138202 = 1.061405429;
        double r138203 = fma(r138190, r138192, r138194);
        double r138204 = pow(r138203, r138196);
        double r138205 = r138202 / r138204;
        double r138206 = 1.421413741;
        double r138207 = r138205 + r138206;
        double r138208 = 0.254829592;
        double r138209 = 0.284496736;
        double r138210 = r138189 / r138203;
        double r138211 = 1.453152027;
        double r138212 = r138189 * r138211;
        double r138213 = 3.0;
        double r138214 = pow(r138203, r138213);
        double r138215 = r138212 / r138214;
        double r138216 = fma(r138209, r138210, r138215);
        double r138217 = r138208 - r138216;
        double r138218 = fma(r138201, r138207, r138217);
        double r138219 = sqrt(r138218);
        double r138220 = r138194 + r138193;
        double r138221 = r138194 / r138220;
        double r138222 = -1.453152027;
        double r138223 = fma(r138221, r138202, r138222);
        double r138224 = fma(r138221, r138223, r138206);
        double r138225 = -0.284496736;
        double r138226 = fma(r138221, r138224, r138225);
        double r138227 = fma(r138221, r138226, r138208);
        double r138228 = sqrt(r138227);
        double r138229 = r138219 * r138228;
        double r138230 = r138192 * r138192;
        double r138231 = exp(r138230);
        double r138232 = r138229 / r138231;
        double r138233 = -r138194;
        double r138234 = fma(r138192, r138190, r138194);
        double r138235 = r138233 / r138234;
        double r138236 = fma(r138232, r138235, r138194);
        double r138237 = exp(r138236);
        double r138238 = log(r138237);
        return r138238;
}

Error

Bits error versus x

Derivation

  1. Initial program 13.9

    \[1 - \left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(0.25482959199999999 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(-0.284496735999999972 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(1.42141374100000006 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot \left(-1.45315202700000001 + \frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|} \cdot 1.0614054289999999\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}\]
  2. Simplified13.9

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\]
  3. Using strategy rm
  4. Applied add-log-exp13.9

    \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt13.9

    \[\leadsto \log \left(e^{\mathsf{fma}\left(\frac{\color{blue}{\sqrt{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}}}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)\]
  7. Taylor expanded around 0 13.9

    \[\leadsto \log \left(e^{\mathsf{fma}\left(\frac{\sqrt{\color{blue}{\left(1.0614054289999999 \cdot \frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{4}} + \left(1.42141374100000006 \cdot \frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}} + 0.25482959199999999\right)\right) - \left(1.45315202700000001 \cdot \frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{3}} + 0.284496735999999972 \cdot \frac{1}{0.32759110000000002 \cdot \left|x\right| + 1}\right)}} \cdot \sqrt{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)\]
  8. Simplified13.9

    \[\leadsto \log \left(e^{\mathsf{fma}\left(\frac{\sqrt{\color{blue}{\mathsf{fma}\left(\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}, \frac{1.0614054289999999}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{2}} + 1.42141374100000006, 0.25482959199999999 - \mathsf{fma}\left(0.284496735999999972, \frac{1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, \frac{1 \cdot 1.45315202700000001}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{3}}\right)\right)}} \cdot \sqrt{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)\]
  9. Using strategy rm
  10. Applied add-cube-cbrt13.9

    \[\leadsto \log \left(e^{\mathsf{fma}\left(\frac{\sqrt{\mathsf{fma}\left(\color{blue}{\left(\sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}} \cdot \sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}}\right) \cdot \sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}}}, \frac{1.0614054289999999}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{2}} + 1.42141374100000006, 0.25482959199999999 - \mathsf{fma}\left(0.284496735999999972, \frac{1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, \frac{1 \cdot 1.45315202700000001}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{3}}\right)\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)\]
  11. Final simplification13.9

    \[\leadsto \log \left(e^{\mathsf{fma}\left(\frac{\sqrt{\mathsf{fma}\left(\left(\sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}} \cdot \sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}}\right) \cdot \sqrt[3]{\frac{1}{{\left(0.32759110000000002 \cdot \left|x\right| + 1\right)}^{2}}}, \frac{1.0614054289999999}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{2}} + 1.42141374100000006, 0.25482959199999999 - \mathsf{fma}\left(0.284496735999999972, \frac{1}{\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)}, \frac{1 \cdot 1.45315202700000001}{{\left(\mathsf{fma}\left(0.32759110000000002, \left|x\right|, 1\right)\right)}^{3}}\right)\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, \mathsf{fma}\left(\frac{1}{1 + 0.32759110000000002 \cdot \left|x\right|}, 1.0614054289999999, -1.45315202700000001\right), 1.42141374100000006\right), -0.284496735999999972\right), 0.25482959199999999\right)}}{e^{\left|x\right| \cdot \left|x\right|}}, \frac{-1}{\mathsf{fma}\left(\left|x\right|, 0.32759110000000002, 1\right)}, 1\right)}\right)\]

Reproduce

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