Average Error: 30.8 → 0.3
Time: 2.3m
Precision: 64
\[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0}{\log base \cdot \log base + 0 \cdot 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}{\log base \cdot \log base + 0 \cdot 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 r1389524 = im;
        double r1389525 = re;
        double r1389526 = atan2(r1389524, r1389525);
        double r1389527 = base;
        double r1389528 = log(r1389527);
        double r1389529 = r1389526 * r1389528;
        double r1389530 = r1389525 * r1389525;
        double r1389531 = r1389524 * r1389524;
        double r1389532 = r1389530 + r1389531;
        double r1389533 = sqrt(r1389532);
        double r1389534 = log(r1389533);
        double r1389535 = 0.0;
        double r1389536 = r1389534 * r1389535;
        double r1389537 = r1389529 - r1389536;
        double r1389538 = r1389528 * r1389528;
        double r1389539 = r1389535 * r1389535;
        double r1389540 = r1389538 + r1389539;
        double r1389541 = r1389537 / r1389540;
        return r1389541;
}

double f(double re, double im, double base) {
        double r1389542 = im;
        double r1389543 = re;
        double r1389544 = atan2(r1389542, r1389543);
        double r1389545 = base;
        double r1389546 = log(r1389545);
        double r1389547 = r1389544 / r1389546;
        double r1389548 = expm1(r1389547);
        double r1389549 = log1p(r1389548);
        return r1389549;
}

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 30.8

    \[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
  2. Simplified0.3

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

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

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

Reproduce

herbie shell --seed 2019149 +o rules:numerics
(FPCore (re im base)
  :name "math.log/2 on complex, imaginary part"
  (/ (- (* (atan2 im re) (log base)) (* (log (sqrt (+ (* re re) (* im im)))) 0)) (+ (* (log base) (log base)) (* 0 0))))