Average Error: 30.4 → 0.3
Time: 20.7s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\log \left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{\frac{2}{\sqrt{\log 10}}}{\sqrt{\log 10}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\log \left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{\frac{2}{\sqrt{\log 10}}}{\sqrt{\log 10}}
double f(double re, double im) {
        double r1076775 = re;
        double r1076776 = r1076775 * r1076775;
        double r1076777 = im;
        double r1076778 = r1076777 * r1076777;
        double r1076779 = r1076776 + r1076778;
        double r1076780 = sqrt(r1076779);
        double r1076781 = log(r1076780);
        double r1076782 = 10.0;
        double r1076783 = log(r1076782);
        double r1076784 = r1076781 / r1076783;
        return r1076784;
}

double f(double re, double im) {
        double r1076785 = re;
        double r1076786 = im;
        double r1076787 = hypot(r1076785, r1076786);
        double r1076788 = sqrt(r1076787);
        double r1076789 = log(r1076788);
        double r1076790 = 2.0;
        double r1076791 = 10.0;
        double r1076792 = log(r1076791);
        double r1076793 = sqrt(r1076792);
        double r1076794 = r1076790 / r1076793;
        double r1076795 = r1076794 / r1076793;
        double r1076796 = r1076789 * r1076795;
        return r1076796;
}

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.4

    \[\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 \color{blue}{\left(\sqrt{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt{\mathsf{hypot}\left(re, im\right)}\right)}}{\log 10}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.6

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

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

    \[\leadsto \frac{\log \left(\color{blue}{{\left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)}^{1}} \cdot {\left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)}^{1}\right)}{\sqrt{\log 10} \cdot \sqrt{\log 10}}\]
  9. Applied pow-prod-up0.6

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

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

    \[\leadsto \color{blue}{\frac{1 + 1}{\sqrt{\log 10}} \cdot \frac{\log \left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)}{\sqrt{\log 10}}}\]
  12. Simplified0.6

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

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

    \[\leadsto \color{blue}{\left(\frac{2}{\sqrt{\log 10}} \cdot \log \left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}}\]
  16. Using strategy rm
  17. Applied *-commutative0.4

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

    \[\leadsto \color{blue}{\log \left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right) \cdot \left(\frac{2}{\sqrt{\log 10}} \cdot \frac{1}{\sqrt{\log 10}}\right)}\]
  19. Simplified0.3

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

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

Reproduce

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