?

Average Error: 31.7 → 7.3
Time: 20.0s
Precision: binary64
Cost: 26952

?

\[ \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} \mathbf{if}\;im \leq 6.5 \cdot 10^{-159}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;im \leq 4.6 \cdot 10^{+70}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\frac{-2}{\log base} \cdot \log base}\\ \mathbf{else}:\\ \;\;\;\;\log \left({im}^{\left(\frac{1}{\log base}\right)}\right)\\ \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
 (if (<= im 6.5e-159)
   (/ (log (- re)) (log base))
   (if (<= im 4.6e+70)
     (*
      (/ -1.0 (log base))
      (/ (log (+ (* re re) (* im im))) (* (/ -2.0 (log base)) (log base))))
     (log (pow im (/ 1.0 (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 tmp;
	if (im <= 6.5e-159) {
		tmp = log(-re) / log(base);
	} else if (im <= 4.6e+70) {
		tmp = (-1.0 / log(base)) * (log(((re * re) + (im * im))) / ((-2.0 / log(base)) * log(base)));
	} else {
		tmp = log(pow(im, (1.0 / 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) :: tmp
    if (im <= 6.5d-159) then
        tmp = log(-re) / log(base)
    else if (im <= 4.6d+70) then
        tmp = ((-1.0d0) / log(base)) * (log(((re * re) + (im * im))) / (((-2.0d0) / log(base)) * log(base)))
    else
        tmp = log((im ** (1.0d0 / 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 tmp;
	if (im <= 6.5e-159) {
		tmp = Math.log(-re) / Math.log(base);
	} else if (im <= 4.6e+70) {
		tmp = (-1.0 / Math.log(base)) * (Math.log(((re * re) + (im * im))) / ((-2.0 / Math.log(base)) * Math.log(base)));
	} else {
		tmp = Math.log(Math.pow(im, (1.0 / 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):
	tmp = 0
	if im <= 6.5e-159:
		tmp = math.log(-re) / math.log(base)
	elif im <= 4.6e+70:
		tmp = (-1.0 / math.log(base)) * (math.log(((re * re) + (im * im))) / ((-2.0 / math.log(base)) * math.log(base)))
	else:
		tmp = math.log(math.pow(im, (1.0 / 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)
	tmp = 0.0
	if (im <= 6.5e-159)
		tmp = Float64(log(Float64(-re)) / log(base));
	elseif (im <= 4.6e+70)
		tmp = Float64(Float64(-1.0 / log(base)) * Float64(log(Float64(Float64(re * re) + Float64(im * im))) / Float64(Float64(-2.0 / log(base)) * log(base))));
	else
		tmp = log((im ^ Float64(1.0 / 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)
	tmp = 0.0;
	if (im <= 6.5e-159)
		tmp = log(-re) / log(base);
	elseif (im <= 4.6e+70)
		tmp = (-1.0 / log(base)) * (log(((re * re) + (im * im))) / ((-2.0 / log(base)) * log(base)));
	else
		tmp = log((im ^ (1.0 / 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_] := If[LessEqual[im, 6.5e-159], N[(N[Log[(-re)], $MachinePrecision] / N[Log[base], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.6e+70], N[(N[(-1.0 / N[Log[base], $MachinePrecision]), $MachinePrecision] * N[(N[Log[N[(N[(re * re), $MachinePrecision] + N[(im * im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(-2.0 / N[Log[base], $MachinePrecision]), $MachinePrecision] * N[Log[base], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[Power[im, N[(1.0 / N[Log[base], $MachinePrecision]), $MachinePrecision]], $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}
\mathbf{if}\;im \leq 6.5 \cdot 10^{-159}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log base}\\

\mathbf{elif}\;im \leq 4.6 \cdot 10^{+70}:\\
\;\;\;\;\frac{-1}{\log base} \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\frac{-2}{\log base} \cdot \log base}\\

\mathbf{else}:\\
\;\;\;\;\log \left({im}^{\left(\frac{1}{\log base}\right)}\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 3 regimes
  2. if im < 6.5000000000000001e-159

    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}{\log base \cdot \log base + 0 \cdot 0} \]
    2. Simplified32.3

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

      [Start]32.3

      \[ \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_best-simplify-65 [=>]32.3

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

      rational_best-simplify-17 [=>]32.3

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

      rational_best-simplify-5 [=>]32.3

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

      rational_best-simplify-64 [=>]32.3

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

      trig-simplify-13 [=>]32.3

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

      rational_best-simplify-6 [=>]32.3

      \[ \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 [=>]32.3

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

      rational_best-simplify-3 [=>]32.3

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

      rational_best-simplify-6 [=>]32.3

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

      rational_best-simplify-90 [=>]32.3

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

      rational_best-simplify-64 [=>]32.3

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

      rational_best-simplify-3 [=>]32.3

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

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

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

      [Start]4.6

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

      rational_best-simplify-1 [=>]4.6

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

      rational_best-simplify-11 [<=]4.6

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

    if 6.5000000000000001e-159 < im < 4.59999999999999987e70

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

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

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

      rational_best-simplify-65 [=>]11.9

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

      rational_best-simplify-17 [=>]11.9

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

      rational_best-simplify-5 [=>]11.9

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

      rational_best-simplify-64 [=>]11.9

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

      metadata-eval [=>]11.9

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

      rational_best-simplify-3 [=>]11.9

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

      rational_best-simplify-6 [=>]11.9

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

      \[\leadsto \color{blue}{\left(\frac{1}{\log base} \cdot -1\right) \cdot \frac{-0.5 \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\log base}}{\frac{1}{\log base}}} \]
    4. Applied egg-rr11.8

      \[\leadsto \color{blue}{\frac{\frac{1}{\log base} \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\frac{-2}{\log base}}}{-\log base}} \]
    5. Simplified11.8

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

      [Start]11.8

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

      rational_best-simplify-60 [=>]11.8

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

      rational_best-simplify-13 [=>]11.8

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

      metadata-eval [<=]11.8

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

      rational_best-simplify-54 [<=]11.8

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

      rational_best-simplify-1 [<=]11.8

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

      rational_best-simplify-54 [=>]11.8

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

      rational_best-simplify-49 [<=]11.8

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

      rational_best-simplify-49 [=>]11.8

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

      metadata-eval [=>]11.8

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

      rational_best-simplify-54 [<=]11.8

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

      rational_best-simplify-1 [=>]11.8

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

      rational_best-simplify-54 [=>]11.8

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

      metadata-eval [=>]11.8

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

      rational_best-simplify-53 [=>]11.8

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

    if 4.59999999999999987e70 < im

    1. Initial program 46.4

      \[\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. Simplified46.4

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

      [Start]46.4

      \[ \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_best-simplify-65 [=>]46.4

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

      rational_best-simplify-17 [=>]46.4

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

      rational_best-simplify-5 [=>]46.4

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

      rational_best-simplify-64 [=>]46.4

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

      trig-simplify-13 [=>]46.4

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

      rational_best-simplify-6 [=>]46.4

      \[ \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 [=>]46.4

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

      rational_best-simplify-3 [=>]46.4

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

      rational_best-simplify-6 [=>]46.4

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

      rational_best-simplify-90 [=>]46.4

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

      rational_best-simplify-64 [=>]46.4

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

      rational_best-simplify-3 [=>]46.4

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

      \[\leadsto \frac{\log \color{blue}{im}}{\log base} \]
    4. Applied egg-rr6.7

      \[\leadsto \color{blue}{\log im \cdot \frac{\log base}{\log base \cdot \log base}} \]
    5. Applied egg-rr6.7

      \[\leadsto \color{blue}{\log \left({im}^{\left(\frac{1}{\log base}\right)}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification7.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 6.5 \cdot 10^{-159}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;im \leq 4.6 \cdot 10^{+70}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\frac{-2}{\log base} \cdot \log base}\\ \mathbf{else}:\\ \;\;\;\;\log \left({im}^{\left(\frac{1}{\log base}\right)}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error7.2
Cost20040
\[\begin{array}{l} \mathbf{if}\;im \leq 1.65 \cdot 10^{-161}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;im \leq 3 \cdot 10^{+75}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\log \left({im}^{\left(\frac{1}{\log base}\right)}\right)\\ \end{array} \]
Alternative 2
Error7.3
Cost19720
\[\begin{array}{l} \mathbf{if}\;im \leq 5.5 \cdot 10^{-162}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;im \leq 1.1 \cdot 10^{+70}:\\ \;\;\;\;\frac{0.5}{\log base} \cdot \log \left(re \cdot re + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left({im}^{\left(\frac{1}{\log base}\right)}\right)\\ \end{array} \]
Alternative 3
Error7.2
Cost13768
\[\begin{array}{l} \mathbf{if}\;im \leq 1.5 \cdot 10^{-162}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;im \leq 8.8 \cdot 10^{+70}:\\ \;\;\;\;\frac{0.5}{\log base} \cdot \log \left(re \cdot re + im \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\log base} \cdot \log im\\ \end{array} \]
Alternative 4
Error10.3
Cost13188
\[\begin{array}{l} \mathbf{if}\;im \leq 6.5 \cdot 10^{-50}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 5
Error31.5
Cost12992
\[\frac{\log im}{\log base} \]

Error

Reproduce?

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