Average Error: 31.9 → 0.3
Time: 20.3s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\log \left({\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) \cdot \frac{1}{\sqrt{\log 10}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\log \left({\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) \cdot \frac{1}{\sqrt{\log 10}}
double f(double re, double im) {
        double r37951 = re;
        double r37952 = r37951 * r37951;
        double r37953 = im;
        double r37954 = r37953 * r37953;
        double r37955 = r37952 + r37954;
        double r37956 = sqrt(r37955);
        double r37957 = log(r37956);
        double r37958 = 10.0;
        double r37959 = log(r37958);
        double r37960 = r37957 / r37959;
        return r37960;
}

double f(double re, double im) {
        double r37961 = re;
        double r37962 = im;
        double r37963 = hypot(r37961, r37962);
        double r37964 = sqrt(r37963);
        double r37965 = r37964 * r37964;
        double r37966 = 1.0;
        double r37967 = 10.0;
        double r37968 = log(r37967);
        double r37969 = sqrt(r37968);
        double r37970 = r37966 / r37969;
        double r37971 = pow(r37965, r37970);
        double r37972 = log(r37971);
        double r37973 = r37972 * r37970;
        return r37973;
}

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

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

Reproduce

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