Average Error: 32.3 → 0.3
Time: 7.8s
Precision: 64
\[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
\[-1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}\]
\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}
-1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}
double f(double re, double im, double base) {
        double r57007 = im;
        double r57008 = re;
        double r57009 = atan2(r57007, r57008);
        double r57010 = base;
        double r57011 = log(r57010);
        double r57012 = r57009 * r57011;
        double r57013 = r57008 * r57008;
        double r57014 = r57007 * r57007;
        double r57015 = r57013 + r57014;
        double r57016 = sqrt(r57015);
        double r57017 = log(r57016);
        double r57018 = 0.0;
        double r57019 = r57017 * r57018;
        double r57020 = r57012 - r57019;
        double r57021 = r57011 * r57011;
        double r57022 = r57018 * r57018;
        double r57023 = r57021 + r57022;
        double r57024 = r57020 / r57023;
        return r57024;
}

double f(double re, double im, double base) {
        double r57025 = -1.0;
        double r57026 = im;
        double r57027 = re;
        double r57028 = atan2(r57026, r57027);
        double r57029 = 1.0;
        double r57030 = base;
        double r57031 = r57029 / r57030;
        double r57032 = log(r57031);
        double r57033 = r57028 / r57032;
        double r57034 = r57025 * r57033;
        return r57034;
}

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 32.3

    \[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  2. Taylor expanded around inf 0.3

    \[\leadsto \color{blue}{-1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}}\]
  3. Final simplification0.3

    \[\leadsto -1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}\]

Reproduce

herbie shell --seed 2019322 
(FPCore (re im base)
  :name "math.log/2 on complex, imaginary part"
  :precision binary64
  (/ (- (* (atan2 im re) (log base)) (* (log (sqrt (+ (* re re) (* im im)))) 0.0)) (+ (* (log base) (log base)) (* 0.0 0.0))))