Average Error: 31.3 → 0.3
Time: 35.9s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \frac{1}{\sqrt{\log 10}}\right)\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \frac{1}{\sqrt{\log 10}}\right)
double f(double re, double im) {
        double r1014978 = re;
        double r1014979 = r1014978 * r1014978;
        double r1014980 = im;
        double r1014981 = r1014980 * r1014980;
        double r1014982 = r1014979 + r1014981;
        double r1014983 = sqrt(r1014982);
        double r1014984 = log(r1014983);
        double r1014985 = 10.0;
        double r1014986 = log(r1014985);
        double r1014987 = r1014984 / r1014986;
        return r1014987;
}

double f(double re, double im) {
        double r1014988 = re;
        double r1014989 = im;
        double r1014990 = hypot(r1014988, r1014989);
        double r1014991 = log(r1014990);
        double r1014992 = 1.0;
        double r1014993 = 10.0;
        double r1014994 = log(r1014993);
        double r1014995 = sqrt(r1014994);
        double r1014996 = r1014992 / r1014995;
        double r1014997 = r1014996 * r1014996;
        double r1014998 = r1014991 * r1014997;
        return r1014998;
}

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.3

    \[\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 *-commutative0.4

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

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

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

Reproduce

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