Average Error: 32.1 → 0.5
Time: 36.0s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\left(\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\right) \cdot \sqrt{\frac{1}{\sqrt{\log 10}}}\right) \cdot \sqrt{\frac{1}{\sqrt{\log 10}}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\left(\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\right) \cdot \sqrt{\frac{1}{\sqrt{\log 10}}}\right) \cdot \sqrt{\frac{1}{\sqrt{\log 10}}}
double f(double re, double im) {
        double r977383 = re;
        double r977384 = r977383 * r977383;
        double r977385 = im;
        double r977386 = r977385 * r977385;
        double r977387 = r977384 + r977386;
        double r977388 = sqrt(r977387);
        double r977389 = log(r977388);
        double r977390 = 10.0;
        double r977391 = log(r977390);
        double r977392 = r977389 / r977391;
        return r977392;
}

double f(double re, double im) {
        double r977393 = re;
        double r977394 = im;
        double r977395 = hypot(r977393, r977394);
        double r977396 = log(r977395);
        double r977397 = 1.0;
        double r977398 = 10.0;
        double r977399 = log(r977398);
        double r977400 = sqrt(r977399);
        double r977401 = r977397 / r977400;
        double r977402 = r977396 * r977401;
        double r977403 = sqrt(r977401);
        double r977404 = r977402 * r977403;
        double r977405 = r977404 * r977403;
        return r977405;
}

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

    \[\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 div-inv0.4

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

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

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

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

Reproduce

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