Average Error: 31.8 → 0.3
Time: 19.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}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\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{log1p}\left(\mathsf{expm1}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log base}\right)\right)
double f(double re, double im, double base) {
        double r26473 = im;
        double r26474 = re;
        double r26475 = atan2(r26473, r26474);
        double r26476 = base;
        double r26477 = log(r26476);
        double r26478 = r26475 * r26477;
        double r26479 = r26474 * r26474;
        double r26480 = r26473 * r26473;
        double r26481 = r26479 + r26480;
        double r26482 = sqrt(r26481);
        double r26483 = log(r26482);
        double r26484 = 0.0;
        double r26485 = r26483 * r26484;
        double r26486 = r26478 - r26485;
        double r26487 = r26477 * r26477;
        double r26488 = r26484 * r26484;
        double r26489 = r26487 + r26488;
        double r26490 = r26486 / r26489;
        return r26490;
}

double f(double re, double im, double base) {
        double r26491 = im;
        double r26492 = re;
        double r26493 = atan2(r26491, r26492);
        double r26494 = base;
        double r26495 = log(r26494);
        double r26496 = r26493 / r26495;
        double r26497 = expm1(r26496);
        double r26498 = log1p(r26497);
        return r26498;
}

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

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

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

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

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

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

Reproduce

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