Average Error: 32.2 → 0.3
Time: 4.3s
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 r85018 = im;
        double r85019 = re;
        double r85020 = atan2(r85018, r85019);
        double r85021 = base;
        double r85022 = log(r85021);
        double r85023 = r85020 * r85022;
        double r85024 = r85019 * r85019;
        double r85025 = r85018 * r85018;
        double r85026 = r85024 + r85025;
        double r85027 = sqrt(r85026);
        double r85028 = log(r85027);
        double r85029 = 0.0;
        double r85030 = r85028 * r85029;
        double r85031 = r85023 - r85030;
        double r85032 = r85022 * r85022;
        double r85033 = r85029 * r85029;
        double r85034 = r85032 + r85033;
        double r85035 = r85031 / r85034;
        return r85035;
}

double f(double re, double im, double base) {
        double r85036 = -1.0;
        double r85037 = im;
        double r85038 = re;
        double r85039 = atan2(r85037, r85038);
        double r85040 = 1.0;
        double r85041 = base;
        double r85042 = r85040 / r85041;
        double r85043 = log(r85042);
        double r85044 = r85039 / r85043;
        double r85045 = r85036 * r85044;
        return r85045;
}

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

    \[\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. Using strategy rm
  4. Applied clear-num0.5

    \[\leadsto -1 \cdot \color{blue}{\frac{1}{\frac{\log \left(\frac{1}{base}\right)}{\tan^{-1}_* \frac{im}{re}}}}\]
  5. Taylor expanded around 0 0.3

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

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

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

Reproduce

herbie shell --seed 2020027 
(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))))