Average Error: 32.0 → 0.4
Time: 10.1s
Precision: binary64
\[\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 := \sqrt[3]{\mathsf{hypot}\left(im, re\right)}\\ \frac{\log \left(t_0 \cdot \left(t_0 \cdot t_0\right)\right)}{\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 (cbrt (hypot im re)))) (/ (log (* t_0 (* t_0 t_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 t_0 = cbrt(hypot(im, re));
	return log((t_0 * (t_0 * t_0))) / log(base);
}
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.cbrt(Math.hypot(im, re));
	return Math.log((t_0 * (t_0 * t_0))) / Math.log(base);
}
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 = cbrt(hypot(im, re))
	return Float64(log(Float64(t_0 * Float64(t_0 * t_0))) / log(base))
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[Power[N[Sqrt[im ^ 2 + re ^ 2], $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Log[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $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 := \sqrt[3]{\mathsf{hypot}\left(im, re\right)}\\
\frac{\log \left(t_0 \cdot \left(t_0 \cdot t_0\right)\right)}{\log base}
\end{array}

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 32.0

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

    \[\leadsto \color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}} \]
  3. Applied add-cube-cbrt_binary640.4

    \[\leadsto \frac{\log \color{blue}{\left(\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}}{\log base} \]
  4. Simplified0.4

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

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

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

Reproduce

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