Average Error: 31.9 → 0.4
Time: 24.6s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{1}{\sqrt{\log 10}} + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{1}{\sqrt{\log 10}}\right) \cdot \frac{1}{\sqrt{\log 10}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{1}{\sqrt{\log 10}} + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{1}{\sqrt{\log 10}}\right) \cdot \frac{1}{\sqrt{\log 10}}
double f(double re, double im) {
        double r881816 = re;
        double r881817 = r881816 * r881816;
        double r881818 = im;
        double r881819 = r881818 * r881818;
        double r881820 = r881817 + r881819;
        double r881821 = sqrt(r881820);
        double r881822 = log(r881821);
        double r881823 = 10.0;
        double r881824 = log(r881823);
        double r881825 = r881822 / r881824;
        return r881825;
}

double f(double re, double im) {
        double r881826 = re;
        double r881827 = im;
        double r881828 = hypot(r881826, r881827);
        double r881829 = cbrt(r881828);
        double r881830 = log(r881829);
        double r881831 = 1.0;
        double r881832 = 10.0;
        double r881833 = log(r881832);
        double r881834 = sqrt(r881833);
        double r881835 = r881831 / r881834;
        double r881836 = r881830 * r881835;
        double r881837 = r881829 * r881829;
        double r881838 = log(r881837);
        double r881839 = r881838 * r881835;
        double r881840 = r881836 + r881839;
        double r881841 = r881840 * r881835;
        return r881841;
}

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

    \[\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. 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}}}\]
  11. Using strategy rm
  12. Applied add-cube-cbrt0.4

    \[\leadsto \left(\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) \cdot \frac{1}{\sqrt{\log 10}}\]
  13. Applied log-prod0.5

    \[\leadsto \left(\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) \cdot \frac{1}{\sqrt{\log 10}}\]
  14. Applied distribute-rgt-in0.4

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

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

Reproduce

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