Average Error: 31.5 → 0.3
Time: 4.8s
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{expm1}\left(\mathsf{log1p}\left(\mathsf{hypot}\left(re, im\right)\right)\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{expm1}\left(\mathsf{log1p}\left(\mathsf{hypot}\left(re, im\right)\right)\right)\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)
double f(double re, double im) {
        double r47366 = re;
        double r47367 = r47366 * r47366;
        double r47368 = im;
        double r47369 = r47368 * r47368;
        double r47370 = r47367 + r47369;
        double r47371 = sqrt(r47370);
        double r47372 = log(r47371);
        double r47373 = 10.0;
        double r47374 = log(r47373);
        double r47375 = r47372 / r47374;
        return r47375;
}

double f(double re, double im) {
        double r47376 = 1.0;
        double r47377 = 10.0;
        double r47378 = log(r47377);
        double r47379 = sqrt(r47378);
        double r47380 = r47376 / r47379;
        double r47381 = re;
        double r47382 = im;
        double r47383 = hypot(r47381, r47382);
        double r47384 = log1p(r47383);
        double r47385 = expm1(r47384);
        double r47386 = pow(r47385, r47380);
        double r47387 = log(r47386);
        double r47388 = r47380 * r47387;
        return r47388;
}

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

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

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

    \[\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. Using strategy rm
  13. Applied expm1-log1p-u0.3

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

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

Reproduce

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