?

Average Error: 31.9 → 17.6
Time: 19.7s
Precision: binary64
Cost: 33484

?

\[\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}^{2} + {im}^{2}}\right)\\ \mathbf{if}\;im \leq -1.4 \cdot 10^{+92}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{elif}\;im \leq 2.5 \cdot 10^{-291}:\\ \;\;\;\;\frac{0.5}{\left(\log base \cdot 0.5\right) \cdot \frac{1}{t_0}}\\ \mathbf{elif}\;im \leq 10^{-224}:\\ \;\;\;\;\frac{\frac{1}{\log base}}{\log base} \cdot \left(\log \left(\frac{-1}{re}\right) \cdot \left(-\log base\right) + \tan^{-1}_* \frac{im}{re} \cdot 0\right)\\ \mathbf{elif}\;im \leq 4.8 \cdot 10^{+55}:\\ \;\;\;\;\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 (+ (pow re 2.0) (pow im 2.0))))))
   (if (<= im -1.4e+92)
     (/ (log (- im)) (log base))
     (if (<= im 2.5e-291)
       (/ 0.5 (* (* (log base) 0.5) (/ 1.0 t_0)))
       (if (<= im 1e-224)
         (*
          (/ (/ 1.0 (log base)) (log base))
          (+ (* (log (/ -1.0 re)) (- (log base))) (* (atan2 im re) 0.0)))
         (if (<= im 4.8e+55) (/ 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((pow(re, 2.0) + pow(im, 2.0))));
	double tmp;
	if (im <= -1.4e+92) {
		tmp = log(-im) / log(base);
	} else if (im <= 2.5e-291) {
		tmp = 0.5 / ((log(base) * 0.5) * (1.0 / t_0));
	} else if (im <= 1e-224) {
		tmp = ((1.0 / log(base)) / log(base)) * ((log((-1.0 / re)) * -log(base)) + (atan2(im, re) * 0.0));
	} else if (im <= 4.8e+55) {
		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) :: tmp
    t_0 = log(sqrt(((re ** 2.0d0) + (im ** 2.0d0))))
    if (im <= (-1.4d+92)) then
        tmp = log(-im) / log(base)
    else if (im <= 2.5d-291) then
        tmp = 0.5d0 / ((log(base) * 0.5d0) * (1.0d0 / t_0))
    else if (im <= 1d-224) then
        tmp = ((1.0d0 / log(base)) / log(base)) * ((log(((-1.0d0) / re)) * -log(base)) + (atan2(im, re) * 0.0d0))
    else if (im <= 4.8d+55) 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((Math.pow(re, 2.0) + Math.pow(im, 2.0))));
	double tmp;
	if (im <= -1.4e+92) {
		tmp = Math.log(-im) / Math.log(base);
	} else if (im <= 2.5e-291) {
		tmp = 0.5 / ((Math.log(base) * 0.5) * (1.0 / t_0));
	} else if (im <= 1e-224) {
		tmp = ((1.0 / Math.log(base)) / Math.log(base)) * ((Math.log((-1.0 / re)) * -Math.log(base)) + (Math.atan2(im, re) * 0.0));
	} else if (im <= 4.8e+55) {
		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((math.pow(re, 2.0) + math.pow(im, 2.0))))
	tmp = 0
	if im <= -1.4e+92:
		tmp = math.log(-im) / math.log(base)
	elif im <= 2.5e-291:
		tmp = 0.5 / ((math.log(base) * 0.5) * (1.0 / t_0))
	elif im <= 1e-224:
		tmp = ((1.0 / math.log(base)) / math.log(base)) * ((math.log((-1.0 / re)) * -math.log(base)) + (math.atan2(im, re) * 0.0))
	elif im <= 4.8e+55:
		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((re ^ 2.0) + (im ^ 2.0))))
	tmp = 0.0
	if (im <= -1.4e+92)
		tmp = Float64(log(Float64(-im)) / log(base));
	elseif (im <= 2.5e-291)
		tmp = Float64(0.5 / Float64(Float64(log(base) * 0.5) * Float64(1.0 / t_0)));
	elseif (im <= 1e-224)
		tmp = Float64(Float64(Float64(1.0 / log(base)) / log(base)) * Float64(Float64(log(Float64(-1.0 / re)) * Float64(-log(base))) + Float64(atan(im, re) * 0.0)));
	elseif (im <= 4.8e+55)
		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 ^ 2.0) + (im ^ 2.0))));
	tmp = 0.0;
	if (im <= -1.4e+92)
		tmp = log(-im) / log(base);
	elseif (im <= 2.5e-291)
		tmp = 0.5 / ((log(base) * 0.5) * (1.0 / t_0));
	elseif (im <= 1e-224)
		tmp = ((1.0 / log(base)) / log(base)) * ((log((-1.0 / re)) * -log(base)) + (atan2(im, re) * 0.0));
	elseif (im <= 4.8e+55)
		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[Power[re, 2.0], $MachinePrecision] + N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[im, -1.4e+92], N[(N[Log[(-im)], $MachinePrecision] / N[Log[base], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.5e-291], N[(0.5 / N[(N[(N[Log[base], $MachinePrecision] * 0.5), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1e-224], N[(N[(N[(1.0 / N[Log[base], $MachinePrecision]), $MachinePrecision] / N[Log[base], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Log[N[(-1.0 / re), $MachinePrecision]], $MachinePrecision] * (-N[Log[base], $MachinePrecision])), $MachinePrecision] + N[(N[ArcTan[im / re], $MachinePrecision] * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.8e+55], 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}^{2} + {im}^{2}}\right)\\
\mathbf{if}\;im \leq -1.4 \cdot 10^{+92}:\\
\;\;\;\;\frac{\log \left(-im\right)}{\log base}\\

\mathbf{elif}\;im \leq 2.5 \cdot 10^{-291}:\\
\;\;\;\;\frac{0.5}{\left(\log base \cdot 0.5\right) \cdot \frac{1}{t_0}}\\

\mathbf{elif}\;im \leq 10^{-224}:\\
\;\;\;\;\frac{\frac{1}{\log base}}{\log base} \cdot \left(\log \left(\frac{-1}{re}\right) \cdot \left(-\log base\right) + \tan^{-1}_* \frac{im}{re} \cdot 0\right)\\

\mathbf{elif}\;im \leq 4.8 \cdot 10^{+55}:\\
\;\;\;\;\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 5 regimes
  2. if im < -1.4e92

    1. Initial program 50.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. Simplified50.2

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

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

      metadata-eval [=>]50.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 + \color{blue}{0}} \]

      rational.json-simplify-65 [=>]50.2

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

      rational.json-simplify-41 [=>]50.2

      \[ \frac{\color{blue}{\tan^{-1}_* \frac{im}{re} \cdot 0 + \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base} \]
    3. Taylor expanded in base around 0 50.2

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

      \[\leadsto \frac{\log \color{blue}{\left(-1 \cdot im\right)}}{\log base} \]
    5. Simplified8.7

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

      [Start]8.7

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

      rational.json-simplify-39 [=>]8.7

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

      rational.json-simplify-72 [=>]8.7

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

    if -1.4e92 < im < 2.5000000000000002e-291

    1. Initial program 21.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. Simplified21.9

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

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

      metadata-eval [=>]21.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 + \color{blue}{0}} \]

      rational.json-simplify-65 [=>]21.9

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

      rational.json-simplify-41 [=>]21.9

      \[ \frac{\color{blue}{\tan^{-1}_* \frac{im}{re} \cdot 0 + \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base} \]
    3. Taylor expanded in base around 0 21.9

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{{re}^{2} + {im}^{2}}\right)}{\log base}} \]
    4. Applied egg-rr21.9

      \[\leadsto \color{blue}{\frac{1}{\log base} \cdot \log \left(\sqrt{{re}^{2} + {im}^{2}}\right)} \]
    5. Applied egg-rr22.0

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

    if 2.5000000000000002e-291 < im < 1e-224

    1. Initial program 30.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. Simplified30.6

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

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

      metadata-eval [=>]30.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 + \color{blue}{0}} \]

      rational.json-simplify-65 [=>]30.6

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

      rational.json-simplify-41 [=>]30.6

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

      \[\leadsto \frac{\tan^{-1}_* \frac{im}{re} \cdot 0 + \color{blue}{\frac{1}{\frac{\frac{1}{\log base}}{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}}}}{\log base \cdot \log base} \]
    4. Taylor expanded in re around -inf 34.5

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

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

      [Start]34.5

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

      rational.json-simplify-15 [=>]34.6

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

      rational.json-simplify-7 [=>]34.5

      \[ \frac{\tan^{-1}_* \frac{im}{re} \cdot 0 + \frac{1}{\color{blue}{\frac{\frac{-1}{\log \left(\frac{-1}{re}\right)}}{\log base}}}}{\log base \cdot \log base} \]
    6. Applied egg-rr34.5

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

    if 1e-224 < im < 4.7999999999999998e55

    1. Initial program 20.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. Simplified20.1

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

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

      metadata-eval [=>]20.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 + \color{blue}{0}} \]

      rational.json-simplify-65 [=>]20.1

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

      rational.json-simplify-41 [=>]20.1

      \[ \frac{\color{blue}{\tan^{-1}_* \frac{im}{re} \cdot 0 + \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base} \]
    3. Taylor expanded in base around 0 20.1

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

    if 4.7999999999999998e55 < im

    1. Initial program 45.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. Simplified45.3

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

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

      metadata-eval [=>]45.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 + \color{blue}{0}} \]

      rational.json-simplify-65 [=>]45.3

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

      rational.json-simplify-41 [=>]45.3

      \[ \frac{\color{blue}{\tan^{-1}_* \frac{im}{re} \cdot 0 + \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}}{\log base \cdot \log base} \]
    3. Taylor expanded in re around 0 11.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.4 \cdot 10^{+92}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{elif}\;im \leq 2.5 \cdot 10^{-291}:\\ \;\;\;\;\frac{0.5}{\left(\log base \cdot 0.5\right) \cdot \frac{1}{\log \left(\sqrt{{re}^{2} + {im}^{2}}\right)}}\\ \mathbf{elif}\;im \leq 10^{-224}:\\ \;\;\;\;\frac{\frac{1}{\log base}}{\log base} \cdot \left(\log \left(\frac{-1}{re}\right) \cdot \left(-\log base\right) + \tan^{-1}_* \frac{im}{re} \cdot 0\right)\\ \mathbf{elif}\;im \leq 4.8 \cdot 10^{+55}:\\ \;\;\;\;\frac{\log \left(\sqrt{{re}^{2} + {im}^{2}}\right)}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]

Alternatives

Alternative 1
Error17.6
Cost33096
\[\begin{array}{l} t_0 := \log \left(\sqrt{{re}^{2} + {im}^{2}}\right)\\ \mathbf{if}\;im \leq -1.1 \cdot 10^{+91}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{elif}\;im \leq 2.5 \cdot 10^{-304}:\\ \;\;\;\;\frac{0.5}{\left(\log base \cdot 0.5\right) \cdot \frac{1}{t_0}}\\ \mathbf{elif}\;im \leq 7.6 \cdot 10^{-221}:\\ \;\;\;\;\frac{1}{\log base} \cdot \log \left(-re\right)\\ \mathbf{elif}\;im \leq 4 \cdot 10^{+54}:\\ \;\;\;\;\frac{t_0}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 2
Error17.5
Cost32976
\[\begin{array}{l} t_0 := \frac{\log \left(\sqrt{{re}^{2} + {im}^{2}}\right)}{\log base}\\ \mathbf{if}\;im \leq -2.5 \cdot 10^{+91}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{elif}\;im \leq 7 \cdot 10^{-304}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 1.3 \cdot 10^{-224}:\\ \;\;\;\;\frac{1}{\log base} \cdot \log \left(-re\right)\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+55}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 3
Error17.6
Cost32976
\[\begin{array}{l} t_0 := \frac{1}{\log base}\\ t_1 := \log \left(\sqrt{{re}^{2} + {im}^{2}}\right)\\ \mathbf{if}\;im \leq -1 \cdot 10^{+80}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{elif}\;im \leq 2 \cdot 10^{-304}:\\ \;\;\;\;t_0 \cdot t_1\\ \mathbf{elif}\;im \leq 7.6 \cdot 10^{-221}:\\ \;\;\;\;t_0 \cdot \log \left(-re\right)\\ \mathbf{elif}\;im \leq 1.4 \cdot 10^{+55}:\\ \;\;\;\;\frac{t_1}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 4
Error26.1
Cost13580
\[\begin{array}{l} t_0 := \frac{1}{\log base}\\ \mathbf{if}\;im \leq -6.6 \cdot 10^{-44}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{elif}\;im \leq 9.5 \cdot 10^{-302}:\\ \;\;\;\;t_0 \cdot \log re\\ \mathbf{elif}\;im \leq 1.7 \cdot 10^{-219}:\\ \;\;\;\;t_0 \cdot \log \left(-re\right)\\ \mathbf{elif}\;im \leq 1.6 \cdot 10^{+27}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 5
Error26.1
Cost13520
\[\begin{array}{l} t_0 := \frac{\log re}{\log base}\\ \mathbf{if}\;im \leq -8.6 \cdot 10^{-44}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{elif}\;im \leq 2 \cdot 10^{-303}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;im \leq 1.36 \cdot 10^{-219}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;im \leq 1.6 \cdot 10^{+27}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 6
Error26.0
Cost13520
\[\begin{array}{l} \mathbf{if}\;im \leq -8.5 \cdot 10^{-44}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{elif}\;im \leq 5.4 \cdot 10^{-301}:\\ \;\;\;\;\frac{1}{\log base} \cdot \log re\\ \mathbf{elif}\;im \leq 2.05 \cdot 10^{-219}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;im \leq 1.6 \cdot 10^{+27}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 7
Error26.0
Cost13256
\[\begin{array}{l} \mathbf{if}\;im \leq -1.9 \cdot 10^{-43}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{elif}\;im \leq 1.6 \cdot 10^{+27}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array} \]
Alternative 8
Error36.2
Cost13124
\[\begin{array}{l} \mathbf{if}\;re \leq 2.45 \cdot 10^{-141}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \end{array} \]
Alternative 9
Error46.7
Cost12992
\[\frac{\log im}{\log base} \]

Error

Reproduce?

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