Average Error: 30.9 → 0.4
Time: 13.3s
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{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}\]
\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{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}
double f(double re, double im, double base) {
        double r797400 = re;
        double r797401 = r797400 * r797400;
        double r797402 = im;
        double r797403 = r797402 * r797402;
        double r797404 = r797401 + r797403;
        double r797405 = sqrt(r797404);
        double r797406 = log(r797405);
        double r797407 = base;
        double r797408 = log(r797407);
        double r797409 = r797406 * r797408;
        double r797410 = atan2(r797402, r797400);
        double r797411 = 0.0;
        double r797412 = r797410 * r797411;
        double r797413 = r797409 + r797412;
        double r797414 = r797408 * r797408;
        double r797415 = r797411 * r797411;
        double r797416 = r797414 + r797415;
        double r797417 = r797413 / r797416;
        return r797417;
}

double f(double re, double im, double base) {
        double r797418 = re;
        double r797419 = im;
        double r797420 = hypot(r797418, r797419);
        double r797421 = log(r797420);
        double r797422 = base;
        double r797423 = log(r797422);
        double r797424 = r797421 / r797423;
        return r797424;
}

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 30.9

    \[\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 *-un-lft-identity0.4

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

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

Reproduce

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