Average Error: 0.9 → 0.5
Time: 3.7s
Precision: 64
\[\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\tan^{-1}_* \frac{im}{re}}{\log 10} \le -0.682168966325773507008989327005110681057:\\ \;\;\;\;\sqrt[3]{{\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)\right)\\ \end{array}\]
\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}
\begin{array}{l}
\mathbf{if}\;\frac{\tan^{-1}_* \frac{im}{re}}{\log 10} \le -0.682168966325773507008989327005110681057:\\
\;\;\;\;\sqrt[3]{{\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)}^{3}}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)\right)\\

\end{array}
double f(double re, double im) {
        double r35123 = im;
        double r35124 = re;
        double r35125 = atan2(r35123, r35124);
        double r35126 = 10.0;
        double r35127 = log(r35126);
        double r35128 = r35125 / r35127;
        return r35128;
}

double f(double re, double im) {
        double r35129 = im;
        double r35130 = re;
        double r35131 = atan2(r35129, r35130);
        double r35132 = 10.0;
        double r35133 = log(r35132);
        double r35134 = r35131 / r35133;
        double r35135 = -0.6821689663257735;
        bool r35136 = r35134 <= r35135;
        double r35137 = 3.0;
        double r35138 = pow(r35134, r35137);
        double r35139 = cbrt(r35138);
        double r35140 = log1p(r35134);
        double r35141 = expm1(r35140);
        double r35142 = r35136 ? r35139 : r35141;
        return r35142;
}

Error

Bits error versus re

Bits error versus im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ (atan2 im re) (log 10.0)) < -0.6821689663257735

    1. Initial program 1.0

      \[\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\]
    2. Using strategy rm
    3. Applied add-cbrt-cube1.6

      \[\leadsto \frac{\tan^{-1}_* \frac{im}{re}}{\color{blue}{\sqrt[3]{\left(\log 10 \cdot \log 10\right) \cdot \log 10}}}\]
    4. Applied add-cbrt-cube1.0

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\tan^{-1}_* \frac{im}{re} \cdot \tan^{-1}_* \frac{im}{re}\right) \cdot \tan^{-1}_* \frac{im}{re}}}}{\sqrt[3]{\left(\log 10 \cdot \log 10\right) \cdot \log 10}}\]
    5. Applied cbrt-undiv0.7

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\tan^{-1}_* \frac{im}{re} \cdot \tan^{-1}_* \frac{im}{re}\right) \cdot \tan^{-1}_* \frac{im}{re}}{\left(\log 10 \cdot \log 10\right) \cdot \log 10}}}\]
    6. Simplified0.0

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)}^{3}}}\]

    if -0.6821689663257735 < (/ (atan2 im re) (log 10.0))

    1. Initial program 0.8

      \[\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\]
    2. Using strategy rm
    3. Applied expm1-log1p-u0.8

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\tan^{-1}_* \frac{im}{re}}{\log 10} \le -0.682168966325773507008989327005110681057:\\ \;\;\;\;\sqrt[3]{{\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019347 +o rules:numerics
(FPCore (re im)
  :name "math.log10 on complex, imaginary part"
  :precision binary64
  (/ (atan2 im re) (log 10)))