Average Error: 32.7 → 0.6
Time: 14.3s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\frac{\sqrt{1}}{\sqrt{1}} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 10}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{\sqrt{1}}{\sqrt{1}} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 10}
double f(double re, double im) {
        double r38401 = re;
        double r38402 = r38401 * r38401;
        double r38403 = im;
        double r38404 = r38403 * r38403;
        double r38405 = r38402 + r38404;
        double r38406 = sqrt(r38405);
        double r38407 = log(r38406);
        double r38408 = 10.0;
        double r38409 = log(r38408);
        double r38410 = r38407 / r38409;
        return r38410;
}

double f(double re, double im) {
        double r38411 = 1.0;
        double r38412 = sqrt(r38411);
        double r38413 = r38412 / r38412;
        double r38414 = re;
        double r38415 = im;
        double r38416 = hypot(r38414, r38415);
        double r38417 = log(r38416);
        double r38418 = 10.0;
        double r38419 = log(r38418);
        double r38420 = r38417 / r38419;
        double r38421 = r38413 * r38420;
        return r38421;
}

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

    \[\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.5

    \[\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.5

    \[\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.5

    \[\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.5

    \[\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 add-sqr-sqrt0.5

    \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{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.5

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

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

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

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

Reproduce

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