Average Error: 31.1 → 0.4
Time: 2.4m
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}{\log base} \cdot \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}{\log base} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)
double f(double re, double im, double base) {
        double r1131736 = re;
        double r1131737 = r1131736 * r1131736;
        double r1131738 = im;
        double r1131739 = r1131738 * r1131738;
        double r1131740 = r1131737 + r1131739;
        double r1131741 = sqrt(r1131740);
        double r1131742 = log(r1131741);
        double r1131743 = base;
        double r1131744 = log(r1131743);
        double r1131745 = r1131742 * r1131744;
        double r1131746 = atan2(r1131738, r1131736);
        double r1131747 = 0.0;
        double r1131748 = r1131746 * r1131747;
        double r1131749 = r1131745 + r1131748;
        double r1131750 = r1131744 * r1131744;
        double r1131751 = r1131747 * r1131747;
        double r1131752 = r1131750 + r1131751;
        double r1131753 = r1131749 / r1131752;
        return r1131753;
}

double f(double re, double im, double base) {
        double r1131754 = 1.0;
        double r1131755 = base;
        double r1131756 = log(r1131755);
        double r1131757 = r1131754 / r1131756;
        double r1131758 = re;
        double r1131759 = im;
        double r1131760 = hypot(r1131758, r1131759);
        double r1131761 = log(r1131760);
        double r1131762 = r1131757 * r1131761;
        return r1131762;
}

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  7. Using strategy rm
  8. Applied div-inv0.5

    \[\leadsto \frac{1}{\color{blue}{\log base \cdot \frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  9. Using strategy rm
  10. Applied un-div-inv0.4

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

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

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

Reproduce

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