Average Error: 31.8 → 0.4
Time: 26.3s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\left(\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) + \frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\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(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}
double f(double re, double im) {
        double r4298163 = re;
        double r4298164 = r4298163 * r4298163;
        double r4298165 = im;
        double r4298166 = r4298165 * r4298165;
        double r4298167 = r4298164 + r4298166;
        double r4298168 = sqrt(r4298167);
        double r4298169 = log(r4298168);
        double r4298170 = 10.0;
        double r4298171 = log(r4298170);
        double r4298172 = r4298169 / r4298171;
        return r4298172;
}

double f(double re, double im) {
        double r4298173 = 1.0;
        double r4298174 = 10.0;
        double r4298175 = log(r4298174);
        double r4298176 = sqrt(r4298175);
        double r4298177 = r4298173 / r4298176;
        double r4298178 = re;
        double r4298179 = im;
        double r4298180 = hypot(r4298178, r4298179);
        double r4298181 = cbrt(r4298180);
        double r4298182 = r4298181 * r4298181;
        double r4298183 = log(r4298182);
        double r4298184 = r4298177 * r4298183;
        double r4298185 = log(r4298181);
        double r4298186 = r4298177 * r4298185;
        double r4298187 = r4298184 + r4298186;
        double r4298188 = r4298187 * r4298177;
        return r4298188;
}

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

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

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

    \[\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-lft-in0.4

    \[\leadsto \color{blue}{\left(\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) + \frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right)} \cdot \frac{1}{\sqrt{\log 10}}\]
  15. Final simplification0.4

    \[\leadsto \left(\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) + \frac{1}{\sqrt{\log 10}} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) \cdot \frac{1}{\sqrt{\log 10}}\]

Reproduce

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