Average Error: 31.8 → 0.4
Time: 40.2s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10.0}\]
\[\frac{1}{\sqrt{\log 10.0}} \cdot \left(\frac{1}{\sqrt{\log 10.0}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10.0}
\frac{1}{\sqrt{\log 10.0}} \cdot \left(\frac{1}{\sqrt{\log 10.0}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)
double f(double re, double im) {
        double r970226 = re;
        double r970227 = r970226 * r970226;
        double r970228 = im;
        double r970229 = r970228 * r970228;
        double r970230 = r970227 + r970229;
        double r970231 = sqrt(r970230);
        double r970232 = log(r970231);
        double r970233 = 10.0;
        double r970234 = log(r970233);
        double r970235 = r970232 / r970234;
        return r970235;
}

double f(double re, double im) {
        double r970236 = 1.0;
        double r970237 = 10.0;
        double r970238 = log(r970237);
        double r970239 = sqrt(r970238);
        double r970240 = r970236 / r970239;
        double r970241 = re;
        double r970242 = im;
        double r970243 = hypot(r970241, r970242);
        double r970244 = log(r970243);
        double r970245 = r970240 * r970244;
        double r970246 = r970240 * r970245;
        return r970246;
}

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

    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10.0}\]
  2. Simplified0.6

    \[\leadsto \color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 10.0}}\]
  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.0} \cdot \sqrt{\log 10.0}}}\]
  5. Applied pow10.6

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

    \[\leadsto \frac{\color{blue}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}{\sqrt{\log 10.0} \cdot \sqrt{\log 10.0}}\]
  7. Applied times-frac0.6

    \[\leadsto \color{blue}{\frac{1}{\sqrt{\log 10.0}} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\sqrt{\log 10.0}}}\]
  8. Using strategy rm
  9. Applied div-inv0.4

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

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

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

Reproduce

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