Average Error: 31.7 → 0.4
Time: 21.4s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\frac{1}{\sqrt{\log 10}} \cdot \left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{1}{\sqrt{\log 10}} + \left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\right)\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{1}{\sqrt{\log 10}} \cdot \left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{1}{\sqrt{\log 10}} + \left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\right)
double f(double re, double im) {
        double r705639 = re;
        double r705640 = r705639 * r705639;
        double r705641 = im;
        double r705642 = r705641 * r705641;
        double r705643 = r705640 + r705642;
        double r705644 = sqrt(r705643);
        double r705645 = log(r705644);
        double r705646 = 10.0;
        double r705647 = log(r705646);
        double r705648 = r705645 / r705647;
        return r705648;
}

double f(double re, double im) {
        double r705649 = 1.0;
        double r705650 = 10.0;
        double r705651 = log(r705650);
        double r705652 = sqrt(r705651);
        double r705653 = r705649 / r705652;
        double r705654 = re;
        double r705655 = im;
        double r705656 = hypot(r705654, r705655);
        double r705657 = cbrt(r705656);
        double r705658 = log(r705657);
        double r705659 = r705658 * r705653;
        double r705660 = r705658 + r705658;
        double r705661 = r705660 * r705653;
        double r705662 = r705659 + r705661;
        double r705663 = r705653 * r705662;
        return r705663;
}

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

    \[\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. Applied associate-*r*0.4

    \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{\log 10}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right) \cdot \frac{1}{\sqrt{\log 10}}}\]
  10. Using strategy rm
  11. Applied add-sqr-sqrt0.4

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

    \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)\right)} \cdot \frac{1}{\sqrt{\log 10}}\]
  13. Using strategy rm
  14. Applied add-cube-cbrt0.5

    \[\leadsto \left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \log \color{blue}{\left(\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\]
  15. Applied log-prod0.5

    \[\leadsto \left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \color{blue}{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\]
  16. Applied distribute-lft-in0.5

    \[\leadsto \left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \color{blue}{\left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right)}\right) \cdot \frac{1}{\sqrt{\log 10}}\]
  17. Applied distribute-rgt-in0.6

    \[\leadsto \color{blue}{\left(\left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \sqrt{\frac{1}{\sqrt{\log 10}}} + \left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \sqrt{\frac{1}{\sqrt{\log 10}}}\right)} \cdot \frac{1}{\sqrt{\log 10}}\]
  18. Simplified0.4

    \[\leadsto \left(\color{blue}{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}} + \left(\sqrt{\frac{1}{\sqrt{\log 10}}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \sqrt{\frac{1}{\sqrt{\log 10}}}\right) \cdot \frac{1}{\sqrt{\log 10}}\]
  19. Simplified0.4

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

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

Reproduce

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