Average Error: 31.2 → 0.4
Time: 22.5s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
\[\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}
\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}
double f(double re, double im, double base) {
        double r1148971 = re;
        double r1148972 = r1148971 * r1148971;
        double r1148973 = im;
        double r1148974 = r1148973 * r1148973;
        double r1148975 = r1148972 + r1148974;
        double r1148976 = sqrt(r1148975);
        double r1148977 = log(r1148976);
        double r1148978 = base;
        double r1148979 = log(r1148978);
        double r1148980 = r1148977 * r1148979;
        double r1148981 = atan2(r1148973, r1148971);
        double r1148982 = 0.0;
        double r1148983 = r1148981 * r1148982;
        double r1148984 = r1148980 + r1148983;
        double r1148985 = r1148979 * r1148979;
        double r1148986 = r1148982 * r1148982;
        double r1148987 = r1148985 + r1148986;
        double r1148988 = r1148984 / r1148987;
        return r1148988;
}

double f(double re, double im, double base) {
        double r1148989 = re;
        double r1148990 = im;
        double r1148991 = hypot(r1148989, r1148990);
        double r1148992 = log(r1148991);
        double r1148993 = base;
        double r1148994 = log(r1148993);
        double r1148995 = r1148992 / r1148994;
        return r1148995;
}

Error

Bits error versus re

Bits error versus im

Bits error versus base

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 31.2

    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
  2. Simplified0.4

    \[\leadsto \color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}}\]
  3. Using strategy rm
  4. Applied clear-num0.4

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  5. Using strategy rm
  6. Applied pow10.4

    \[\leadsto \frac{1}{\frac{\log base}{\log \color{blue}{\left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{1}\right)}}}\]
  7. Applied log-pow0.4

    \[\leadsto \frac{1}{\frac{\log base}{\color{blue}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  8. Applied pow10.4

    \[\leadsto \frac{1}{\frac{\log \color{blue}{\left({base}^{1}\right)}}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}\]
  9. Applied log-pow0.4

    \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot \log base}}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}\]
  10. Applied times-frac0.4

    \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  11. Applied add-cube-cbrt0.4

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}\]
  12. Applied times-frac0.4

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

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

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

    \[\leadsto \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}\]

Reproduce

herbie shell --seed 2019168 +o rules:numerics
(FPCore (re im base)
  :name "math.log/2 on complex, real part"
  (/ (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0)) (+ (* (log base) (log base)) (* 0 0))))