Average Error: 31.8 → 0.3
Time: 2.4m
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 r1302789 = im;
        double r1302790 = re;
        double r1302791 = atan2(r1302789, r1302790);
        double r1302792 = base;
        double r1302793 = log(r1302792);
        double r1302794 = r1302791 * r1302793;
        double r1302795 = r1302790 * r1302790;
        double r1302796 = r1302789 * r1302789;
        double r1302797 = r1302795 + r1302796;
        double r1302798 = sqrt(r1302797);
        double r1302799 = log(r1302798);
        double r1302800 = 0.0;
        double r1302801 = r1302799 * r1302800;
        double r1302802 = r1302794 - r1302801;
        double r1302803 = r1302793 * r1302793;
        double r1302804 = r1302800 * r1302800;
        double r1302805 = r1302803 + r1302804;
        double r1302806 = r1302802 / r1302805;
        return r1302806;
}

double f(double re, double im, double base) {
        double r1302807 = im;
        double r1302808 = re;
        double r1302809 = atan2(r1302807, r1302808);
        double r1302810 = base;
        double r1302811 = log(r1302810);
        double r1302812 = r1302809 / r1302811;
        double r1302813 = expm1(r1302812);
        double r1302814 = log1p(r1302813);
        return r1302814;
}

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}{\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 2019144 +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))))