Average Error: 32.2 → 0.6
Time: 12.6s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\frac{1}{\sqrt{\log 10}} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\sqrt{\log 10}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{1}{\sqrt{\log 10}} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\sqrt{\log 10}}
double f(double re, double im) {
        double r22291 = re;
        double r22292 = r22291 * r22291;
        double r22293 = im;
        double r22294 = r22293 * r22293;
        double r22295 = r22292 + r22294;
        double r22296 = sqrt(r22295);
        double r22297 = log(r22296);
        double r22298 = 10.0;
        double r22299 = log(r22298);
        double r22300 = r22297 / r22299;
        return r22300;
}

double f(double re, double im) {
        double r22301 = 1.0;
        double r22302 = 10.0;
        double r22303 = log(r22302);
        double r22304 = sqrt(r22303);
        double r22305 = r22301 / r22304;
        double r22306 = re;
        double r22307 = im;
        double r22308 = hypot(r22306, r22307);
        double r22309 = log(r22308);
        double r22310 = r22309 / r22304;
        double r22311 = r22305 * r22310;
        return r22311;
}

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 32.2

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

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

    \[\leadsto \frac{\color{blue}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}{\sqrt{\log 10} \cdot \sqrt{\log 10}}\]
  7. 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}}}\]
  8. Using strategy rm
  9. Applied pow10.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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