Average Error: 31.2 → 0.5
Time: 1.8m
Precision: 64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
\[\frac{\frac{1}{\log base}}{\frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}
\frac{\frac{1}{\log base}}{\frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}
double f(double re, double im, double base) {
        double r1529194 = re;
        double r1529195 = r1529194 * r1529194;
        double r1529196 = im;
        double r1529197 = r1529196 * r1529196;
        double r1529198 = r1529195 + r1529197;
        double r1529199 = sqrt(r1529198);
        double r1529200 = log(r1529199);
        double r1529201 = base;
        double r1529202 = log(r1529201);
        double r1529203 = r1529200 * r1529202;
        double r1529204 = atan2(r1529196, r1529194);
        double r1529205 = 0.0;
        double r1529206 = r1529204 * r1529205;
        double r1529207 = r1529203 + r1529206;
        double r1529208 = r1529202 * r1529202;
        double r1529209 = r1529205 * r1529205;
        double r1529210 = r1529208 + r1529209;
        double r1529211 = r1529207 / r1529210;
        return r1529211;
}

double f(double re, double im, double base) {
        double r1529212 = 1.0;
        double r1529213 = base;
        double r1529214 = log(r1529213);
        double r1529215 = r1529212 / r1529214;
        double r1529216 = re;
        double r1529217 = im;
        double r1529218 = hypot(r1529216, r1529217);
        double r1529219 = log(r1529218);
        double r1529220 = r1529212 / r1529219;
        double r1529221 = r1529215 / r1529220;
        return r1529221;
}

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

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

    \[\leadsto \color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}}\]
  3. Using strategy rm
  4. Applied pow10.4

    \[\leadsto \frac{\log \color{blue}{\left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{1}\right)}}{\log base}\]
  5. Applied log-pow0.4

    \[\leadsto \frac{\color{blue}{1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}{\log base}\]
  6. Applied associate-/l*0.4

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  7. Using strategy rm
  8. Applied div-inv0.5

    \[\leadsto \frac{1}{\color{blue}{\log base \cdot \frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  9. Applied associate-/r*0.5

    \[\leadsto \color{blue}{\frac{\frac{1}{\log base}}{\frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  10. Final simplification0.5

    \[\leadsto \frac{\frac{1}{\log base}}{\frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}\]

Reproduce

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