Average Error: 31.2 → 0.4
Time: 51.7s
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 r931639 = re;
        double r931640 = r931639 * r931639;
        double r931641 = im;
        double r931642 = r931641 * r931641;
        double r931643 = r931640 + r931642;
        double r931644 = sqrt(r931643);
        double r931645 = log(r931644);
        double r931646 = base;
        double r931647 = log(r931646);
        double r931648 = r931645 * r931647;
        double r931649 = atan2(r931641, r931639);
        double r931650 = 0.0;
        double r931651 = r931649 * r931650;
        double r931652 = r931648 + r931651;
        double r931653 = r931647 * r931647;
        double r931654 = r931650 * r931650;
        double r931655 = r931653 + r931654;
        double r931656 = r931652 / r931655;
        return r931656;
}

double f(double re, double im, double base) {
        double r931657 = 1.0;
        double r931658 = base;
        double r931659 = log(r931658);
        double r931660 = r931657 / r931659;
        double r931661 = re;
        double r931662 = im;
        double r931663 = hypot(r931661, r931662);
        double r931664 = log(r931663);
        double r931665 = r931660 * r931664;
        return r931665;
}

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 expm1-log1p-u0.4

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

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

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

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

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

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

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

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

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

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

Reproduce

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