Average Error: 31.4 → 0.3
Time: 12.7s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\frac{1}{\sqrt{\log 10}} \cdot \log \left({\left(\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{1}{\sqrt{\log 10}} \cdot \log \left({\left(\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)
double f(double re, double im) {
        double r49425 = re;
        double r49426 = r49425 * r49425;
        double r49427 = im;
        double r49428 = r49427 * r49427;
        double r49429 = r49426 + r49428;
        double r49430 = sqrt(r49429);
        double r49431 = log(r49430);
        double r49432 = 10.0;
        double r49433 = log(r49432);
        double r49434 = r49431 / r49433;
        return r49434;
}

double f(double re, double im) {
        double r49435 = 1.0;
        double r49436 = 10.0;
        double r49437 = log(r49436);
        double r49438 = sqrt(r49437);
        double r49439 = r49435 / r49438;
        double r49440 = re;
        double r49441 = im;
        double r49442 = hypot(r49440, r49441);
        double r49443 = cbrt(r49442);
        double r49444 = r49443 * r49443;
        double r49445 = r49444 * r49443;
        double r49446 = pow(r49445, r49439);
        double r49447 = log(r49446);
        double r49448 = r49439 * r49447;
        return r49448;
}

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 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 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-log-exp0.4

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

    \[\leadsto \frac{1}{\sqrt{\log 10}} \cdot \log \color{blue}{\left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)}\]
  13. Using strategy rm
  14. Applied add-cube-cbrt0.3

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

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

Reproduce

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