Average Error: 32.2 → 0.3
Time: 18.2s
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 r44002 = re;
        double r44003 = r44002 * r44002;
        double r44004 = im;
        double r44005 = r44004 * r44004;
        double r44006 = r44003 + r44005;
        double r44007 = sqrt(r44006);
        double r44008 = log(r44007);
        double r44009 = 10.0;
        double r44010 = log(r44009);
        double r44011 = r44008 / r44010;
        return r44011;
}

double f(double re, double im) {
        double r44012 = 1.0;
        double r44013 = 10.0;
        double r44014 = log(r44013);
        double r44015 = sqrt(r44014);
        double r44016 = r44012 / r44015;
        double r44017 = re;
        double r44018 = im;
        double r44019 = hypot(r44017, r44018);
        double r44020 = pow(r44019, r44016);
        double r44021 = log(r44020);
        double r44022 = r44016 * r44021;
        return r44022;
}

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

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

    \[\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. 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 2020043 +o rules:numerics
(FPCore (re im)
  :name "math.log10 on complex, real part"
  :precision binary64
  (/ (log (sqrt (+ (* re re) (* im im)))) (log 10)))