Average Error: 30.6 → 0.5
Time: 47.7s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}
double f(double re, double im) {
        double r1323604 = re;
        double r1323605 = r1323604 * r1323604;
        double r1323606 = im;
        double r1323607 = r1323606 * r1323606;
        double r1323608 = r1323605 + r1323607;
        double r1323609 = sqrt(r1323608);
        double r1323610 = log(r1323609);
        double r1323611 = 10.0;
        double r1323612 = log(r1323611);
        double r1323613 = r1323610 / r1323612;
        return r1323613;
}

double f(double re, double im) {
        double r1323614 = 1.0;
        double r1323615 = 10.0;
        double r1323616 = log(r1323615);
        double r1323617 = sqrt(r1323616);
        double r1323618 = r1323614 / r1323617;
        double r1323619 = re;
        double r1323620 = im;
        double r1323621 = hypot(r1323619, r1323620);
        double r1323622 = cbrt(r1323621);
        double r1323623 = log(r1323622);
        double r1323624 = r1323618 * r1323623;
        double r1323625 = r1323622 * r1323622;
        double r1323626 = log(r1323625);
        double r1323627 = r1323618 * r1323626;
        double r1323628 = r1323624 + r1323627;
        double r1323629 = r1323628 * r1323618;
        return r1323629;
}

Error

Bits error versus re

Bits error versus im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 30.6

    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
  2. Simplified0.6

    \[\leadsto \color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 10}}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.6

    \[\leadsto \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\color{blue}{\sqrt{\log 10} \cdot \sqrt{\log 10}}}\]
  5. Applied *-un-lft-identity0.6

    \[\leadsto \frac{\color{blue}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}{\sqrt{\log 10} \cdot \sqrt{\log 10}}\]
  6. Applied times-frac0.6

    \[\leadsto \color{blue}{\frac{1}{\sqrt{\log 10}} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\sqrt{\log 10}}}\]
  7. Using strategy rm
  8. Applied div-inv0.4

    \[\leadsto \frac{1}{\sqrt{\log 10}} \cdot \color{blue}{\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\right)}\]
  9. Applied associate-*r*0.4

    \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right) \cdot \frac{1}{\sqrt{\log 10}}}\]
  10. Using strategy rm
  11. Applied add-cube-cbrt0.4

    \[\leadsto \left(\frac{1}{\sqrt{\log 10}} \cdot \log \color{blue}{\left(\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}\right) \cdot \frac{1}{\sqrt{\log 10}}\]
  12. Applied log-prod0.5

    \[\leadsto \left(\frac{1}{\sqrt{\log 10}} \cdot \color{blue}{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right)}\right) \cdot \frac{1}{\sqrt{\log 10}}\]
  13. Applied distribute-lft-in0.5

    \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right)} \cdot \frac{1}{\sqrt{\log 10}}\]
  14. Final simplification0.5

    \[\leadsto \left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\]

Reproduce

herbie shell --seed 2019125 +o rules:numerics
(FPCore (re im)
  :name "math.log10 on complex, real part"
  (/ (log (sqrt (+ (* re re) (* im im)))) (log 10)))