Average Error: 31.4 → 0.4
Time: 17.3s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\frac{1}{\sqrt{\log 10}} \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{1}{\sqrt{\log 10}} \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)
double f(double re, double im) {
        double r624897 = re;
        double r624898 = r624897 * r624897;
        double r624899 = im;
        double r624900 = r624899 * r624899;
        double r624901 = r624898 + r624900;
        double r624902 = sqrt(r624901);
        double r624903 = log(r624902);
        double r624904 = 10.0;
        double r624905 = log(r624904);
        double r624906 = r624903 / r624905;
        return r624906;
}

double f(double re, double im) {
        double r624907 = 1.0;
        double r624908 = 10.0;
        double r624909 = log(r624908);
        double r624910 = sqrt(r624909);
        double r624911 = r624907 / r624910;
        double r624912 = re;
        double r624913 = im;
        double r624914 = hypot(r624912, r624913);
        double r624915 = log(r624914);
        double r624916 = r624911 * r624915;
        double r624917 = r624911 * r624916;
        return r624917;
}

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 31.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 clear-num0.6

    \[\leadsto \color{blue}{\frac{1}{\frac{\log 10}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  5. Using strategy rm
  6. Applied pow10.6

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

    \[\leadsto \frac{1}{\frac{\log 10}{\color{blue}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  8. Applied add-sqr-sqrt0.6

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{\log 10}}}}{\frac{\sqrt{\log 10}}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}\]
  12. Using strategy rm
  13. Applied pow10.6

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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