Average Error: 32.0 → 0.3
Time: 4.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{1}{\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{1}{\sqrt{\log 10}}\right)}\right)
double f(double re, double im) {
        double r45388 = re;
        double r45389 = r45388 * r45388;
        double r45390 = im;
        double r45391 = r45390 * r45390;
        double r45392 = r45389 + r45391;
        double r45393 = sqrt(r45392);
        double r45394 = log(r45393);
        double r45395 = 10.0;
        double r45396 = log(r45395);
        double r45397 = r45394 / r45396;
        return r45397;
}

double f(double re, double im) {
        double r45398 = 1.0;
        double r45399 = 10.0;
        double r45400 = log(r45399);
        double r45401 = sqrt(r45400);
        double r45402 = r45398 / r45401;
        double r45403 = re;
        double r45404 = im;
        double r45405 = hypot(r45403, r45404);
        double r45406 = pow(r45405, r45402);
        double r45407 = log(r45406);
        double r45408 = r45402 * r45407;
        return r45408;
}

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 32.0

    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
  2. Using strategy rm
  3. Applied hypot-def0.6

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

    \[\leadsto \frac{1}{\sqrt{\log 10}} \cdot \color{blue}{\log \left(e^{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\sqrt{\log 10}}}\right)}\]
  11. 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)}\]
  12. Final simplification0.3

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

Reproduce

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