Average Error: 31.1 → 0.5
Time: 25.2s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\left(\left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)\right) \cdot \sqrt{\sqrt{\frac{1}{\sqrt{\log 10}}}}\right) \cdot \sqrt{\sqrt{\frac{1}{\sqrt{\log 10}}}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\left(\left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)\right) \cdot \sqrt{\sqrt{\frac{1}{\sqrt{\log 10}}}}\right) \cdot \sqrt{\sqrt{\frac{1}{\sqrt{\log 10}}}}
double f(double re, double im) {
        double r757042 = re;
        double r757043 = r757042 * r757042;
        double r757044 = im;
        double r757045 = r757044 * r757044;
        double r757046 = r757043 + r757045;
        double r757047 = sqrt(r757046);
        double r757048 = log(r757047);
        double r757049 = 10.0;
        double r757050 = log(r757049);
        double r757051 = r757048 / r757050;
        return r757051;
}

double f(double re, double im) {
        double r757052 = 1.0;
        double r757053 = 10.0;
        double r757054 = log(r757053);
        double r757055 = sqrt(r757054);
        double r757056 = r757052 / r757055;
        double r757057 = sqrt(r757056);
        double r757058 = re;
        double r757059 = im;
        double r757060 = hypot(r757058, r757059);
        double r757061 = log(r757060);
        double r757062 = r757056 * r757061;
        double r757063 = r757057 * r757062;
        double r757064 = sqrt(r757057);
        double r757065 = r757063 * r757064;
        double r757066 = r757065 * r757064;
        return r757066;
}

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.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 *-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. Using strategy rm
  10. 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)\]
  11. 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)}\]
  12. Using strategy rm
  13. Applied add-sqr-sqrt0.5

    \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \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)\]
  14. Applied sqrt-prod0.6

    \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\frac{1}{\sqrt{\log 10}}}} \cdot \sqrt{\sqrt{\frac{1}{\sqrt{\log 10}}}}\right)} \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)\]
  15. Applied associate-*l*0.5

    \[\leadsto \color{blue}{\sqrt{\sqrt{\frac{1}{\sqrt{\log 10}}}} \cdot \left(\sqrt{\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)\right)}\]
  16. Final simplification0.5

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

Reproduce

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