Average Error: 30.4 → 0.4
Time: 18.1s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\frac{2}{\sqrt{\log 10}} \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)\right)\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{2}{\sqrt{\log 10}} \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)\right)
double f(double re, double im) {
        double r1188795 = re;
        double r1188796 = r1188795 * r1188795;
        double r1188797 = im;
        double r1188798 = r1188797 * r1188797;
        double r1188799 = r1188796 + r1188798;
        double r1188800 = sqrt(r1188799);
        double r1188801 = log(r1188800);
        double r1188802 = 10.0;
        double r1188803 = log(r1188802);
        double r1188804 = r1188801 / r1188803;
        return r1188804;
}

double f(double re, double im) {
        double r1188805 = 2.0;
        double r1188806 = 10.0;
        double r1188807 = log(r1188806);
        double r1188808 = sqrt(r1188807);
        double r1188809 = r1188805 / r1188808;
        double r1188810 = 1.0;
        double r1188811 = r1188810 / r1188808;
        double r1188812 = re;
        double r1188813 = im;
        double r1188814 = hypot(r1188812, r1188813);
        double r1188815 = sqrt(r1188814);
        double r1188816 = log(r1188815);
        double r1188817 = r1188811 * r1188816;
        double r1188818 = r1188809 * r1188817;
        return r1188818;
}

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.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 \color{blue}{\left(\sqrt{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt{\mathsf{hypot}\left(re, im\right)}\right)}}{\log 10}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.6

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

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

    \[\leadsto \frac{\log \left(\color{blue}{{\left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)}^{1}} \cdot {\left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)}^{1}\right)}{\sqrt{\log 10} \cdot \sqrt{\log 10}}\]
  9. Applied pow-prod-up0.6

    \[\leadsto \frac{\log \color{blue}{\left({\left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)}^{\left(1 + 1\right)}\right)}}{\sqrt{\log 10} \cdot \sqrt{\log 10}}\]
  10. Applied log-pow0.6

    \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \log \left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)}}{\sqrt{\log 10} \cdot \sqrt{\log 10}}\]
  11. Applied times-frac0.6

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

    \[\leadsto \color{blue}{\frac{2}{\sqrt{\log 10}}} \cdot \frac{\log \left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)}{\sqrt{\log 10}}\]
  13. Using strategy rm
  14. Applied div-inv0.4

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

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

Reproduce

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