Average Error: 32.2 → 0.4
Time: 4.6s
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}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log base}\right)\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}
\mathsf{expm1}\left(\mathsf{log1p}\left(1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log base}\right)\right)
double f(double re, double im, double base) {
        double r31278 = im;
        double r31279 = re;
        double r31280 = atan2(r31278, r31279);
        double r31281 = base;
        double r31282 = log(r31281);
        double r31283 = r31280 * r31282;
        double r31284 = r31279 * r31279;
        double r31285 = r31278 * r31278;
        double r31286 = r31284 + r31285;
        double r31287 = sqrt(r31286);
        double r31288 = log(r31287);
        double r31289 = 0.0;
        double r31290 = r31288 * r31289;
        double r31291 = r31283 - r31290;
        double r31292 = r31282 * r31282;
        double r31293 = r31289 * r31289;
        double r31294 = r31292 + r31293;
        double r31295 = r31291 / r31294;
        return r31295;
}

double f(double re, double im, double base) {
        double r31296 = 1.0;
        double r31297 = im;
        double r31298 = re;
        double r31299 = atan2(r31297, r31298);
        double r31300 = base;
        double r31301 = log(r31300);
        double r31302 = r31299 / r31301;
        double r31303 = r31296 * r31302;
        double r31304 = log1p(r31303);
        double r31305 = expm1(r31304);
        return r31305;
}

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

    \[\leadsto \color{blue}{\frac{\tan^{-1}_* \frac{im}{re}}{\log base}}\]
  3. Using strategy rm
  4. Applied expm1-log1p-u0.4

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log base}\right)\right)}\]
  5. Using strategy rm
  6. Applied div-inv0.5

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\tan^{-1}_* \frac{im}{re} \cdot \frac{1}{\log base}}\right)\right)\]
  7. Using strategy rm
  8. Applied *-un-lft-identity0.5

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(1 \cdot \tan^{-1}_* \frac{im}{re}\right)} \cdot \frac{1}{\log base}\right)\right)\]
  9. Applied associate-*l*0.5

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

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

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

Reproduce

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