Average Error: 31.0 → 0.4
Time: 38.2s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\mathsf{hypot}\left(re, im\right)\right)\right)\right)\right)\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\mathsf{hypot}\left(re, im\right)\right)\right)\right)\right)\right)\right) \cdot \frac{1}{\sqrt{\log 10}}
double f(double re, double im) {
        double r1207540 = re;
        double r1207541 = r1207540 * r1207540;
        double r1207542 = im;
        double r1207543 = r1207542 * r1207542;
        double r1207544 = r1207541 + r1207543;
        double r1207545 = sqrt(r1207544);
        double r1207546 = log(r1207545);
        double r1207547 = 10.0;
        double r1207548 = log(r1207547);
        double r1207549 = r1207546 / r1207548;
        return r1207549;
}

double f(double re, double im) {
        double r1207550 = 1.0;
        double r1207551 = 10.0;
        double r1207552 = log(r1207551);
        double r1207553 = sqrt(r1207552);
        double r1207554 = r1207550 / r1207553;
        double r1207555 = re;
        double r1207556 = im;
        double r1207557 = hypot(r1207555, r1207556);
        double r1207558 = log1p(r1207557);
        double r1207559 = expm1(r1207558);
        double r1207560 = log(r1207559);
        double r1207561 = r1207554 * r1207560;
        double r1207562 = r1207561 * r1207554;
        return r1207562;
}

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

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

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

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

Reproduce

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