Average Error: 31.9 → 0.4
Time: 4.7s
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 \left(\tan^{-1}_* \frac{im}{re} \cdot \frac{-1}{\log 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 \left(\tan^{-1}_* \frac{im}{re} \cdot \frac{-1}{\log base}\right)
double f(double re, double im, double base) {
        double r29952 = im;
        double r29953 = re;
        double r29954 = atan2(r29952, r29953);
        double r29955 = base;
        double r29956 = log(r29955);
        double r29957 = r29954 * r29956;
        double r29958 = r29953 * r29953;
        double r29959 = r29952 * r29952;
        double r29960 = r29958 + r29959;
        double r29961 = sqrt(r29960);
        double r29962 = log(r29961);
        double r29963 = 0.0;
        double r29964 = r29962 * r29963;
        double r29965 = r29957 - r29964;
        double r29966 = r29956 * r29956;
        double r29967 = r29963 * r29963;
        double r29968 = r29966 + r29967;
        double r29969 = r29965 / r29968;
        return r29969;
}

double f(double re, double im, double base) {
        double r29970 = -1.0;
        double r29971 = im;
        double r29972 = re;
        double r29973 = atan2(r29971, r29972);
        double r29974 = base;
        double r29975 = log(r29974);
        double r29976 = r29970 / r29975;
        double r29977 = r29973 * r29976;
        double r29978 = r29970 * r29977;
        return r29978;
}

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

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

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

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

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

Reproduce

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