Average Error: 32.3 → 0.5
Time: 13.4s
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
\[\frac{\log \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{hypot}\left(re, im\right)\right)\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}
\frac{\log \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{hypot}\left(re, im\right)\right)\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}
double f(double re, double im, double base) {
        double r177 = re;
        double r178 = r177 * r177;
        double r179 = im;
        double r180 = r179 * r179;
        double r181 = r178 + r180;
        double r182 = sqrt(r181);
        double r183 = log(r182);
        double r184 = base;
        double r185 = log(r184);
        double r186 = r183 * r185;
        double r187 = atan2(r179, r177);
        double r188 = 0.0;
        double r189 = r187 * r188;
        double r190 = r186 + r189;
        double r191 = r185 * r185;
        double r192 = r188 * r188;
        double r193 = r191 + r192;
        double r194 = r190 / r193;
        return r194;
}

double f(double re, double im, double base) {
        double r195 = re;
        double r196 = im;
        double r197 = hypot(r195, r196);
        double r198 = log1p(r197);
        double r199 = expm1(r198);
        double r200 = log(r199);
        double r201 = base;
        double r202 = log(r201);
        double r203 = r200 * r202;
        double r204 = atan2(r196, r195);
        double r205 = 0.0;
        double r206 = r204 * r205;
        double r207 = r203 + r206;
        double r208 = r202 * r202;
        double r209 = r205 * r205;
        double r210 = r208 + r209;
        double r211 = r207 / r210;
        return r211;
}

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

    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  2. Using strategy rm
  3. Applied hypot-def0.5

    \[\leadsto \frac{\log \color{blue}{\left(\mathsf{hypot}\left(re, im\right)\right)} \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  4. Using strategy rm
  5. Applied expm1-log1p-u0.5

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

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

Reproduce

herbie shell --seed 2020025 +o rules:numerics
(FPCore (re im base)
  :name "math.log/2 on complex, real part"
  :precision binary64
  (/ (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0.0)) (+ (* (log base) (log base)) (* 0.0 0.0))))