Average Error: 32.2 → 0.4
Time: 4.4s
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(\tan^{-1}_* \frac{im}{re} \cdot \frac{1}{\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(\tan^{-1}_* \frac{im}{re} \cdot \frac{1}{\log base}\right)\right)
double f(double re, double im, double base) {
        double r29293 = im;
        double r29294 = re;
        double r29295 = atan2(r29293, r29294);
        double r29296 = base;
        double r29297 = log(r29296);
        double r29298 = r29295 * r29297;
        double r29299 = r29294 * r29294;
        double r29300 = r29293 * r29293;
        double r29301 = r29299 + r29300;
        double r29302 = sqrt(r29301);
        double r29303 = log(r29302);
        double r29304 = 0.0;
        double r29305 = r29303 * r29304;
        double r29306 = r29298 - r29305;
        double r29307 = r29297 * r29297;
        double r29308 = r29304 * r29304;
        double r29309 = r29307 + r29308;
        double r29310 = r29306 / r29309;
        return r29310;
}

double f(double re, double im, double base) {
        double r29311 = im;
        double r29312 = re;
        double r29313 = atan2(r29311, r29312);
        double r29314 = 1.0;
        double r29315 = base;
        double r29316 = log(r29315);
        double r29317 = r29314 / r29316;
        double r29318 = r29313 * r29317;
        double r29319 = expm1(r29318);
        double r29320 = log1p(r29319);
        return r29320;
}

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 log1p-expm1-u0.3

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

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

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

Reproduce

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