Average Error: 30.9 → 0.5
Time: 21.0s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \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)\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \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)
double f(double re, double im) {
        double r632816 = re;
        double r632817 = r632816 * r632816;
        double r632818 = im;
        double r632819 = r632818 * r632818;
        double r632820 = r632817 + r632819;
        double r632821 = sqrt(r632820);
        double r632822 = log(r632821);
        double r632823 = 10.0;
        double r632824 = log(r632823);
        double r632825 = r632822 / r632824;
        return r632825;
}

double f(double re, double im) {
        double r632826 = 1.0;
        double r632827 = 10.0;
        double r632828 = log(r632827);
        double r632829 = sqrt(r632828);
        double r632830 = r632826 / r632829;
        double r632831 = sqrt(r632830);
        double r632832 = re;
        double r632833 = im;
        double r632834 = hypot(r632832, r632833);
        double r632835 = log(r632834);
        double r632836 = r632830 * r632835;
        double r632837 = r632831 * r632836;
        double r632838 = r632831 * r632837;
        return r632838;
}

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. 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. Final simplification0.5

    \[\leadsto \sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \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)\]

Reproduce

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