Average Error: 31.0 → 0.4
Time: 13.1s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\frac{1}{\sqrt{\log 10}} \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{1}{\sqrt{\log 10}} \cdot \left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)
double f(double re, double im) {
        double r382930 = re;
        double r382931 = r382930 * r382930;
        double r382932 = im;
        double r382933 = r382932 * r382932;
        double r382934 = r382931 + r382933;
        double r382935 = sqrt(r382934);
        double r382936 = log(r382935);
        double r382937 = 10.0;
        double r382938 = log(r382937);
        double r382939 = r382936 / r382938;
        return r382939;
}

double f(double re, double im) {
        double r382940 = 1.0;
        double r382941 = 10.0;
        double r382942 = log(r382941);
        double r382943 = sqrt(r382942);
        double r382944 = r382940 / r382943;
        double r382945 = re;
        double r382946 = im;
        double r382947 = hypot(r382945, r382946);
        double r382948 = log(r382947);
        double r382949 = r382944 * r382948;
        double r382950 = r382944 * r382949;
        return r382950;
}

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

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

    \[\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. Applied associate-*r*0.4

    \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right) \cdot \frac{1}{\sqrt{\log 10}}}\]
  10. Using strategy rm
  11. Applied *-un-lft-identity0.4

    \[\leadsto \left(\frac{1}{\sqrt{\log 10}} \cdot \color{blue}{\left(1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)}\right) \cdot \frac{1}{\sqrt{\log 10}}\]
  12. Applied associate-*r*0.4

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

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

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

Reproduce

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