Average Error: 30.9 → 0.5
Time: 33.8s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \sqrt{\frac{1}{\sqrt{\log 10}}}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \sqrt{\frac{1}{\sqrt{\log 10}}}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}
double f(double re, double im) {
        double r782107 = re;
        double r782108 = r782107 * r782107;
        double r782109 = im;
        double r782110 = r782109 * r782109;
        double r782111 = r782108 + r782110;
        double r782112 = sqrt(r782111);
        double r782113 = log(r782112);
        double r782114 = 10.0;
        double r782115 = log(r782114);
        double r782116 = r782113 / r782115;
        return r782116;
}

double f(double re, double im) {
        double r782117 = 1.0;
        double r782118 = 10.0;
        double r782119 = log(r782118);
        double r782120 = sqrt(r782119);
        double r782121 = r782117 / r782120;
        double r782122 = sqrt(r782121);
        double r782123 = re;
        double r782124 = im;
        double r782125 = hypot(r782123, r782124);
        double r782126 = log(r782125);
        double r782127 = r782126 * r782122;
        double r782128 = r782122 * r782127;
        double r782129 = r782128 * r782121;
        return r782129;
}

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 30.9

    \[\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 *-un-lft-identity0.6

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

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

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

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

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

Reproduce

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