Average Error: 32.0 → 0.3
Time: 5.1s
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 r38913 = im;
        double r38914 = re;
        double r38915 = atan2(r38913, r38914);
        double r38916 = base;
        double r38917 = log(r38916);
        double r38918 = r38915 * r38917;
        double r38919 = r38914 * r38914;
        double r38920 = r38913 * r38913;
        double r38921 = r38919 + r38920;
        double r38922 = sqrt(r38921);
        double r38923 = log(r38922);
        double r38924 = 0.0;
        double r38925 = r38923 * r38924;
        double r38926 = r38918 - r38925;
        double r38927 = r38917 * r38917;
        double r38928 = r38924 * r38924;
        double r38929 = r38927 + r38928;
        double r38930 = r38926 / r38929;
        return r38930;
}

double f(double re, double im, double base) {
        double r38931 = -1.0;
        double r38932 = im;
        double r38933 = re;
        double r38934 = atan2(r38932, r38933);
        double r38935 = 1.0;
        double r38936 = base;
        double r38937 = r38935 / r38936;
        double r38938 = log(r38937);
        double r38939 = r38934 / r38938;
        double r38940 = r38931 * r38939;
        return r38940;
}

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

    \[\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 2020089 +o rules:numerics
(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))))