Average Error: 31.6 → 0.3
Time: 16.5s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\frac{1}{\sqrt{\log 10}} \cdot \log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\frac{\frac{1}{2}}{\sqrt{\log 10}}\right)} \cdot {\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\frac{\frac{1}{2}}{\sqrt{\log 10}}\right)}\right)\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{1}{\sqrt{\log 10}} \cdot \log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\frac{\frac{1}{2}}{\sqrt{\log 10}}\right)} \cdot {\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\frac{\frac{1}{2}}{\sqrt{\log 10}}\right)}\right)
double f(double re, double im) {
        double r86971 = re;
        double r86972 = r86971 * r86971;
        double r86973 = im;
        double r86974 = r86973 * r86973;
        double r86975 = r86972 + r86974;
        double r86976 = sqrt(r86975);
        double r86977 = log(r86976);
        double r86978 = 10.0;
        double r86979 = log(r86978);
        double r86980 = r86977 / r86979;
        return r86980;
}

double f(double re, double im) {
        double r86981 = 1.0;
        double r86982 = 10.0;
        double r86983 = log(r86982);
        double r86984 = sqrt(r86983);
        double r86985 = r86981 / r86984;
        double r86986 = re;
        double r86987 = im;
        double r86988 = hypot(r86986, r86987);
        double r86989 = 0.5;
        double r86990 = r86989 / r86984;
        double r86991 = pow(r86988, r86990);
        double r86992 = r86991 * r86991;
        double r86993 = log(r86992);
        double r86994 = r86985 * r86993;
        return r86994;
}

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

    \[\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 pow10.6

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

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

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

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

    \[\leadsto \frac{1}{\sqrt{\log 10}} \cdot \log \left({\color{blue}{\left(\sqrt{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt{\mathsf{hypot}\left(re, im\right)}\right)}}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)\]
  15. Applied unpow-prod-down0.3

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

    \[\leadsto \frac{1}{\sqrt{\log 10}} \cdot \log \left(\color{blue}{{\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\frac{\frac{1}{2}}{\sqrt{\log 10}}\right)}} \cdot {\left(\sqrt{\mathsf{hypot}\left(re, im\right)}\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)\]
  17. Simplified0.3

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

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

Reproduce

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