?

Average Error: 32.4 → 6.8
Time: 19.5s
Precision: binary64
Cost: 33360

?

\[ \begin{array}{c}[re, im] = \mathsf{sort}([re, im])\\ \end{array} \]
\[\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} \]
\[\begin{array}{l} t_0 := \log \left(\sqrt{re \cdot re + im \cdot im}\right)\\ t_1 := \log \left(-re\right)\\ \mathbf{if}\;im \leq 6.1 \cdot 10^{-158}:\\ \;\;\;\;\frac{t_1}{\log base}\\ \mathbf{elif}\;im \leq 5 \cdot 10^{-86}:\\ \;\;\;\;\frac{1}{\log base} \cdot t_0\\ \mathbf{elif}\;im \leq 2.6 \cdot 10^{-81}:\\ \;\;\;\;\frac{\frac{2}{\log base}}{\frac{2}{t_1}}\\ \mathbf{elif}\;im \leq 0.2:\\ \;\;\;\;\frac{t_0}{\log base \cdot \log base} \cdot \log base\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+129}:\\ \;\;\;\;\frac{t_0}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
(FPCore (re im base)
 :precision binary64
 (/
  (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0.0))
  (+ (* (log base) (log base)) (* 0.0 0.0))))
(FPCore (re im base)
 :precision binary64
 (let* ((t_0 (log (sqrt (+ (* re re) (* im im))))) (t_1 (log (- re))))
   (if (<= im 6.1e-158)
     (/ t_1 (log base))
     (if (<= im 5e-86)
       (* (/ 1.0 (log base)) t_0)
       (if (<= im 2.6e-81)
         (/ (/ 2.0 (log base)) (/ 2.0 t_1))
         (if (<= im 0.2)
           (* (/ t_0 (* (log base) (log base))) (log base))
           (if (<= im 1.35e+129)
             (/ t_0 (log base))
             (/ (log im) (log base)))))))))
double code(double re, double im, double base) {
	return ((log(sqrt(((re * re) + (im * im)))) * log(base)) + (atan2(im, re) * 0.0)) / ((log(base) * log(base)) + (0.0 * 0.0));
}
double code(double re, double im, double base) {
	double t_0 = log(sqrt(((re * re) + (im * im))));
	double t_1 = log(-re);
	double tmp;
	if (im <= 6.1e-158) {
		tmp = t_1 / log(base);
	} else if (im <= 5e-86) {
		tmp = (1.0 / log(base)) * t_0;
	} else if (im <= 2.6e-81) {
		tmp = (2.0 / log(base)) / (2.0 / t_1);
	} else if (im <= 0.2) {
		tmp = (t_0 / (log(base) * log(base))) * log(base);
	} else if (im <= 1.35e+129) {
		tmp = t_0 / log(base);
	} else {
		tmp = log(im) / log(base);
	}
	return tmp;
}
real(8) function code(re, im, base)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8), intent (in) :: base
    code = ((log(sqrt(((re * re) + (im * im)))) * log(base)) + (atan2(im, re) * 0.0d0)) / ((log(base) * log(base)) + (0.0d0 * 0.0d0))
end function
real(8) function code(re, im, base)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8), intent (in) :: base
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = log(sqrt(((re * re) + (im * im))))
    t_1 = log(-re)
    if (im <= 6.1d-158) then
        tmp = t_1 / log(base)
    else if (im <= 5d-86) then
        tmp = (1.0d0 / log(base)) * t_0
    else if (im <= 2.6d-81) then
        tmp = (2.0d0 / log(base)) / (2.0d0 / t_1)
    else if (im <= 0.2d0) then
        tmp = (t_0 / (log(base) * log(base))) * log(base)
    else if (im <= 1.35d+129) then
        tmp = t_0 / log(base)
    else
        tmp = log(im) / log(base)
    end if
    code = tmp
end function
public static double code(double re, double im, double base) {
	return ((Math.log(Math.sqrt(((re * re) + (im * im)))) * Math.log(base)) + (Math.atan2(im, re) * 0.0)) / ((Math.log(base) * Math.log(base)) + (0.0 * 0.0));
}
public static double code(double re, double im, double base) {
	double t_0 = Math.log(Math.sqrt(((re * re) + (im * im))));
	double t_1 = Math.log(-re);
	double tmp;
	if (im <= 6.1e-158) {
		tmp = t_1 / Math.log(base);
	} else if (im <= 5e-86) {
		tmp = (1.0 / Math.log(base)) * t_0;
	} else if (im <= 2.6e-81) {
		tmp = (2.0 / Math.log(base)) / (2.0 / t_1);
	} else if (im <= 0.2) {
		tmp = (t_0 / (Math.log(base) * Math.log(base))) * Math.log(base);
	} else if (im <= 1.35e+129) {
		tmp = t_0 / Math.log(base);
	} else {
		tmp = Math.log(im) / Math.log(base);
	}
	return tmp;
}
def code(re, im, base):
	return ((math.log(math.sqrt(((re * re) + (im * im)))) * math.log(base)) + (math.atan2(im, re) * 0.0)) / ((math.log(base) * math.log(base)) + (0.0 * 0.0))
def code(re, im, base):
	t_0 = math.log(math.sqrt(((re * re) + (im * im))))
	t_1 = math.log(-re)
	tmp = 0
	if im <= 6.1e-158:
		tmp = t_1 / math.log(base)
	elif im <= 5e-86:
		tmp = (1.0 / math.log(base)) * t_0
	elif im <= 2.6e-81:
		tmp = (2.0 / math.log(base)) / (2.0 / t_1)
	elif im <= 0.2:
		tmp = (t_0 / (math.log(base) * math.log(base))) * math.log(base)
	elif im <= 1.35e+129:
		tmp = t_0 / math.log(base)
	else:
		tmp = math.log(im) / math.log(base)
	return tmp
function code(re, im, base)
	return Float64(Float64(Float64(log(sqrt(Float64(Float64(re * re) + Float64(im * im)))) * log(base)) + Float64(atan(im, re) * 0.0)) / Float64(Float64(log(base) * log(base)) + Float64(0.0 * 0.0)))
end
function code(re, im, base)
	t_0 = log(sqrt(Float64(Float64(re * re) + Float64(im * im))))
	t_1 = log(Float64(-re))
	tmp = 0.0
	if (im <= 6.1e-158)
		tmp = Float64(t_1 / log(base));
	elseif (im <= 5e-86)
		tmp = Float64(Float64(1.0 / log(base)) * t_0);
	elseif (im <= 2.6e-81)
		tmp = Float64(Float64(2.0 / log(base)) / Float64(2.0 / t_1));
	elseif (im <= 0.2)
		tmp = Float64(Float64(t_0 / Float64(log(base) * log(base))) * log(base));
	elseif (im <= 1.35e+129)
		tmp = Float64(t_0 / log(base));
	else
		tmp = Float64(log(im) / log(base));
	end
	return tmp
end
function tmp = code(re, im, base)
	tmp = ((log(sqrt(((re * re) + (im * im)))) * log(base)) + (atan2(im, re) * 0.0)) / ((log(base) * log(base)) + (0.0 * 0.0));
end
function tmp_2 = code(re, im, base)
	t_0 = log(sqrt(((re * re) + (im * im))));
	t_1 = log(-re);
	tmp = 0.0;
	if (im <= 6.1e-158)
		tmp = t_1 / log(base);
	elseif (im <= 5e-86)
		tmp = (1.0 / log(base)) * t_0;
	elseif (im <= 2.6e-81)
		tmp = (2.0 / log(base)) / (2.0 / t_1);
	elseif (im <= 0.2)
		tmp = (t_0 / (log(base) * log(base))) * log(base);
	elseif (im <= 1.35e+129)
		tmp = t_0 / log(base);
	else
		tmp = log(im) / log(base);
	end
	tmp_2 = tmp;
end
code[re_, im_, base_] := N[(N[(N[(N[Log[N[Sqrt[N[(N[(re * re), $MachinePrecision] + N[(im * im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Log[base], $MachinePrecision]), $MachinePrecision] + N[(N[ArcTan[im / re], $MachinePrecision] * 0.0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Log[base], $MachinePrecision] * N[Log[base], $MachinePrecision]), $MachinePrecision] + N[(0.0 * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[re_, im_, base_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(re * re), $MachinePrecision] + N[(im * im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Log[(-re)], $MachinePrecision]}, If[LessEqual[im, 6.1e-158], N[(t$95$1 / N[Log[base], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5e-86], N[(N[(1.0 / N[Log[base], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[im, 2.6e-81], N[(N[(2.0 / N[Log[base], $MachinePrecision]), $MachinePrecision] / N[(2.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 0.2], N[(N[(t$95$0 / N[(N[Log[base], $MachinePrecision] * N[Log[base], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Log[base], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+129], N[(t$95$0 / N[Log[base], $MachinePrecision]), $MachinePrecision], N[(N[Log[im], $MachinePrecision] / N[Log[base], $MachinePrecision]), $MachinePrecision]]]]]]]]
\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}
\begin{array}{l}
t_0 := \log \left(\sqrt{re \cdot re + im \cdot im}\right)\\
t_1 := \log \left(-re\right)\\
\mathbf{if}\;im \leq 6.1 \cdot 10^{-158}:\\
\;\;\;\;\frac{t_1}{\log base}\\

\mathbf{elif}\;im \leq 5 \cdot 10^{-86}:\\
\;\;\;\;\frac{1}{\log base} \cdot t_0\\

\mathbf{elif}\;im \leq 2.6 \cdot 10^{-81}:\\
\;\;\;\;\frac{\frac{2}{\log base}}{\frac{2}{t_1}}\\

\mathbf{elif}\;im \leq 0.2:\\
\;\;\;\;\frac{t_0}{\log base \cdot \log base} \cdot \log base\\

\mathbf{elif}\;im \leq 1.35 \cdot 10^{+129}:\\
\;\;\;\;\frac{t_0}{\log base}\\

\mathbf{else}:\\
\;\;\;\;\frac{\log im}{\log base}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 6 regimes
  2. if im < 6.0999999999999998e-158

    1. Initial program 33.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. Simplified33.2

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}} \]
      Proof

      [Start]33.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} \]

      rational.json-simplify-14 [=>]33.2

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \color{blue}{0}}{\log base \cdot \log base + 0 \cdot 0} \]

      rational.json-simplify-4 [=>]33.2

      \[ \frac{\color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base + 0 \cdot 0} \]

      metadata-eval [=>]33.2

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base + \color{blue}{0}} \]

      rational.json-simplify-4 [=>]33.2

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\color{blue}{\log base \cdot \log base}} \]
    3. Taylor expanded in re around -inf 4.8

      \[\leadsto \frac{\log \color{blue}{\left(-1 \cdot re\right)} \cdot \log base}{\log base \cdot \log base} \]
    4. Simplified4.8

      \[\leadsto \frac{\log \color{blue}{\left(-re\right)} \cdot \log base}{\log base \cdot \log base} \]
      Proof

      [Start]4.8

      \[ \frac{\log \left(-1 \cdot re\right) \cdot \log base}{\log base \cdot \log base} \]

      rational.json-simplify-2 [=>]4.8

      \[ \frac{\log \color{blue}{\left(re \cdot -1\right)} \cdot \log base}{\log base \cdot \log base} \]

      rational.json-simplify-9 [=>]4.8

      \[ \frac{\log \color{blue}{\left(-re\right)} \cdot \log base}{\log base \cdot \log base} \]
    5. Taylor expanded in base around 0 4.7

      \[\leadsto \color{blue}{\frac{\log \left(-re\right)}{\log base}} \]

    if 6.0999999999999998e-158 < im < 4.9999999999999999e-86

    1. Initial program 11.7

      \[\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. Simplified11.7

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}} \]
      Proof

      [Start]11.7

      \[ \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} \]

      rational.json-simplify-14 [=>]11.7

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \color{blue}{0}}{\log base \cdot \log base + 0 \cdot 0} \]

      rational.json-simplify-4 [=>]11.7

      \[ \frac{\color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base + 0 \cdot 0} \]

      metadata-eval [=>]11.7

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base + \color{blue}{0}} \]

      rational.json-simplify-4 [=>]11.7

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\color{blue}{\log base \cdot \log base}} \]
    3. Applied egg-rr11.7

      \[\leadsto \color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \frac{1}{\log base}} \]
    4. Simplified11.7

      \[\leadsto \color{blue}{\frac{1}{\log base} \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)} \]
      Proof

      [Start]11.7

      \[ \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \frac{1}{\log base} \]

      rational.json-simplify-2 [<=]11.7

      \[ \color{blue}{\frac{1}{\log base} \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)} \]

    if 4.9999999999999999e-86 < im < 2.5999999999999999e-81

    1. Initial program 10.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. Simplified10.0

      \[\leadsto \color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \frac{\frac{\log base}{\log base}}{\log base}} \]
      Proof

      [Start]10.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} \]

      rational.json-simplify-14 [=>]10.2

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \color{blue}{0}}{\log base \cdot \log base + 0 \cdot 0} \]

      rational.json-simplify-4 [=>]10.2

      \[ \frac{\color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base + 0 \cdot 0} \]

      rational.json-simplify-2 [=>]10.2

      \[ \frac{\color{blue}{\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}}{\log base \cdot \log base + 0 \cdot 0} \]

      metadata-eval [=>]10.2

      \[ \frac{\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base \cdot \log base + \color{blue}{0}} \]

      rational.json-simplify-4 [=>]10.2

      \[ \frac{\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\color{blue}{\log base \cdot \log base}} \]

      rational.json-simplify-49 [=>]10.1

      \[ \color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \frac{\log base}{\log base \cdot \log base}} \]

      rational.json-simplify-46 [=>]10.0

      \[ \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \color{blue}{\frac{\frac{\log base}{\log base}}{\log base}} \]
    3. Applied egg-rr10.1

      \[\leadsto \color{blue}{\frac{\frac{2}{\log base}}{\frac{2}{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}}} \]
    4. Taylor expanded in re around -inf 33.0

      \[\leadsto \frac{\frac{2}{\log base}}{\frac{2}{\log \color{blue}{\left(-1 \cdot re\right)}}} \]
    5. Simplified33.0

      \[\leadsto \frac{\frac{2}{\log base}}{\frac{2}{\log \color{blue}{\left(-re\right)}}} \]
      Proof

      [Start]33.0

      \[ \frac{\frac{2}{\log base}}{\frac{2}{\log \left(-1 \cdot re\right)}} \]

      rational.json-simplify-2 [=>]33.0

      \[ \frac{\frac{2}{\log base}}{\frac{2}{\log \color{blue}{\left(re \cdot -1\right)}}} \]

      rational.json-simplify-9 [=>]33.0

      \[ \frac{\frac{2}{\log base}}{\frac{2}{\log \color{blue}{\left(-re\right)}}} \]

    if 2.5999999999999999e-81 < im < 0.20000000000000001

    1. Initial program 11.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. Simplified11.2

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}} \]
      Proof

      [Start]11.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} \]

      rational.json-simplify-14 [=>]11.2

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \color{blue}{0}}{\log base \cdot \log base + 0 \cdot 0} \]

      rational.json-simplify-4 [=>]11.2

      \[ \frac{\color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base + 0 \cdot 0} \]

      metadata-eval [=>]11.2

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base + \color{blue}{0}} \]

      rational.json-simplify-4 [=>]11.2

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\color{blue}{\log base \cdot \log base}} \]
    3. Applied egg-rr11.2

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base \cdot \log base} \cdot \log base} \]

    if 0.20000000000000001 < im < 1.35e129

    1. Initial program 10.1

      \[\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. Simplified10.1

      \[\leadsto \color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \frac{\frac{\log base}{\log base}}{\log base}} \]
      Proof

      [Start]10.1

      \[ \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} \]

      rational.json-simplify-14 [=>]10.1

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \color{blue}{0}}{\log base \cdot \log base + 0 \cdot 0} \]

      rational.json-simplify-4 [=>]10.1

      \[ \frac{\color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base + 0 \cdot 0} \]

      rational.json-simplify-2 [=>]10.1

      \[ \frac{\color{blue}{\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}}{\log base \cdot \log base + 0 \cdot 0} \]

      metadata-eval [=>]10.1

      \[ \frac{\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base \cdot \log base + \color{blue}{0}} \]

      rational.json-simplify-4 [=>]10.1

      \[ \frac{\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\color{blue}{\log base \cdot \log base}} \]

      rational.json-simplify-49 [=>]10.1

      \[ \color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \frac{\log base}{\log base \cdot \log base}} \]

      rational.json-simplify-46 [=>]10.1

      \[ \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \color{blue}{\frac{\frac{\log base}{\log base}}{\log base}} \]
    3. Applied egg-rr10.0

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} + 0} \]
    4. Simplified10.0

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base}} \]
      Proof

      [Start]10.0

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} + 0 \]

      rational.json-simplify-4 [=>]10.0

      \[ \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base}} \]

    if 1.35e129 < im

    1. Initial program 57.6

      \[\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. Simplified57.6

      \[\leadsto \color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \frac{\frac{\log base}{\log base}}{\log base}} \]
      Proof

      [Start]57.6

      \[ \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} \]

      rational.json-simplify-14 [=>]57.6

      \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \color{blue}{0}}{\log base \cdot \log base + 0 \cdot 0} \]

      rational.json-simplify-4 [=>]57.6

      \[ \frac{\color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base + 0 \cdot 0} \]

      rational.json-simplify-2 [=>]57.6

      \[ \frac{\color{blue}{\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}}{\log base \cdot \log base + 0 \cdot 0} \]

      metadata-eval [=>]57.6

      \[ \frac{\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base \cdot \log base + \color{blue}{0}} \]

      rational.json-simplify-4 [=>]57.6

      \[ \frac{\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\color{blue}{\log base \cdot \log base}} \]

      rational.json-simplify-49 [=>]57.6

      \[ \color{blue}{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \frac{\log base}{\log base \cdot \log base}} \]

      rational.json-simplify-46 [=>]57.6

      \[ \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \color{blue}{\frac{\frac{\log base}{\log base}}{\log base}} \]
    3. Taylor expanded in re around 0 4.9

      \[\leadsto \color{blue}{\frac{\log im}{\log base}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification6.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 6.1 \cdot 10^{-158}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;im \leq 5 \cdot 10^{-86}:\\ \;\;\;\;\frac{1}{\log base} \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\\ \mathbf{elif}\;im \leq 2.6 \cdot 10^{-81}:\\ \;\;\;\;\frac{\frac{2}{\log base}}{\frac{2}{\log \left(-re\right)}}\\ \mathbf{elif}\;im \leq 0.2:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base \cdot \log base} \cdot \log base\\ \mathbf{elif}\;im \leq 1.35 \cdot 10^{+129}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]

Alternatives

Alternative 1
Error6.7
Cost20040
\[\begin{array}{l} \mathbf{if}\;im \leq 8.8 \cdot 10^{-158}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;im \leq 4.8 \cdot 10^{+128}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 2
Error9.9
Cost13188
\[\begin{array}{l} \mathbf{if}\;im \leq 7.5 \cdot 10^{-61}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 3
Error30.7
Cost12992
\[\frac{\log im}{\log base} \]

Error

Reproduce?

herbie shell --seed 2023065 
(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))))