Average Error: 32.8 → 0.3
Time: 13.4s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\frac{1}{\sqrt{\log 10}} \cdot \log \left({\left(\sqrt{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt{\mathsf{hypot}\left(re, im\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(\sqrt{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt{\mathsf{hypot}\left(re, im\right)}\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)
double f(double re, double im) {
        double r50912 = re;
        double r50913 = r50912 * r50912;
        double r50914 = im;
        double r50915 = r50914 * r50914;
        double r50916 = r50913 + r50915;
        double r50917 = sqrt(r50916);
        double r50918 = log(r50917);
        double r50919 = 10.0;
        double r50920 = log(r50919);
        double r50921 = r50918 / r50920;
        return r50921;
}

double f(double re, double im) {
        double r50922 = 1.0;
        double r50923 = 10.0;
        double r50924 = log(r50923);
        double r50925 = sqrt(r50924);
        double r50926 = r50922 / r50925;
        double r50927 = re;
        double r50928 = im;
        double r50929 = hypot(r50927, r50928);
        double r50930 = sqrt(r50929);
        double r50931 = r50930 * r50930;
        double r50932 = pow(r50931, r50926);
        double r50933 = log(r50932);
        double r50934 = r50926 * r50933;
        return r50934;
}

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 32.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.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. Using strategy rm
  11. Applied add-log-exp0.4

    \[\leadsto \frac{1}{\sqrt{\log 10}} \cdot \color{blue}{\log \left(e^{\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \frac{1}{\sqrt{\log 10}}}\right)}\]
  12. 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)}\]
  13. Using strategy rm
  14. Applied add-sqr-sqrt0.3

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

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

Reproduce

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