Average Error: 31.4 → 0.4
Time: 35.5s
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 r685929 = re;
        double r685930 = r685929 * r685929;
        double r685931 = im;
        double r685932 = r685931 * r685931;
        double r685933 = r685930 + r685932;
        double r685934 = sqrt(r685933);
        double r685935 = log(r685934);
        double r685936 = 10.0;
        double r685937 = log(r685936);
        double r685938 = r685935 / r685937;
        return r685938;
}

double f(double re, double im) {
        double r685939 = 1.0;
        double r685940 = 10.0;
        double r685941 = log(r685940);
        double r685942 = sqrt(r685941);
        double r685943 = r685939 / r685942;
        double r685944 = re;
        double r685945 = im;
        double r685946 = hypot(r685944, r685945);
        double r685947 = log(r685946);
        double r685948 = r685943 * r685947;
        double r685949 = r685943 * r685948;
        return r685949;
}

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 pow10.6

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

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

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

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

    \[\leadsto \frac{1}{\frac{\log 10}{\color{blue}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  10. 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)}}\]
  11. 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)}}}\]
  12. 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)}}}\]
  13. Simplified0.6

    \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{\log 10}}}}{\frac{\sqrt{\log 10}}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}\]
  14. Using strategy rm
  15. Applied *-un-lft-identity0.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)}}}\]
  16. 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)}}\]
  17. 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)}}}\]
  18. Applied associate-/r*0.6

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

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

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

    \[\leadsto \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)}\]
  23. 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)))