Average Error: 30.5 → 0.4
Time: 1.8m
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{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}\]
\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{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}
double f(double re, double im, double base) {
        double r1331929 = re;
        double r1331930 = r1331929 * r1331929;
        double r1331931 = im;
        double r1331932 = r1331931 * r1331931;
        double r1331933 = r1331930 + r1331932;
        double r1331934 = sqrt(r1331933);
        double r1331935 = log(r1331934);
        double r1331936 = base;
        double r1331937 = log(r1331936);
        double r1331938 = r1331935 * r1331937;
        double r1331939 = atan2(r1331931, r1331929);
        double r1331940 = 0.0;
        double r1331941 = r1331939 * r1331940;
        double r1331942 = r1331938 + r1331941;
        double r1331943 = r1331937 * r1331937;
        double r1331944 = r1331940 * r1331940;
        double r1331945 = r1331943 + r1331944;
        double r1331946 = r1331942 / r1331945;
        return r1331946;
}

double f(double re, double im, double base) {
        double r1331947 = 1.0;
        double r1331948 = base;
        double r1331949 = log(r1331948);
        double r1331950 = re;
        double r1331951 = im;
        double r1331952 = hypot(r1331950, r1331951);
        double r1331953 = log(r1331952);
        double r1331954 = r1331949 / r1331953;
        double r1331955 = r1331947 / r1331954;
        return r1331955;
}

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 30.5

    \[\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 *-un-lft-identity0.4

    \[\leadsto \frac{\color{blue}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}{\log base}\]
  5. Applied associate-/l*0.4

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity0.4

    \[\leadsto \frac{1}{\color{blue}{1 \cdot \frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  8. Applied associate-/r*0.4

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

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

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

Reproduce

herbie shell --seed 2019134 +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))))