Average Error: 31.9 → 0.6
Time: 6.2s
Precision: binary64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10} \]
\[\frac{\log \left({\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}^{3}\right)}{\log 10} \]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{\log \left({\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}^{3}\right)}{\log 10}
(FPCore (re im)
 :precision binary64
 (/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))
(FPCore (re im)
 :precision binary64
 (/ (log (pow (cbrt (hypot re im)) 3.0)) (log 10.0)))
double code(double re, double im) {
	return log(sqrt((re * re) + (im * im))) / log(10.0);
}
double code(double re, double im) {
	return log(pow(cbrt(hypot(re, im)), 3.0)) / log(10.0);
}

Error

Bits error versus re

Bits error versus im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 31.9

    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10} \]
  2. Simplified0.6

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

    \[\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 10} \]
  5. Applied pow3_binary640.6

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

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

Reproduce

herbie shell --seed 2021211 
(FPCore (re im)
  :name "math.log10 on complex, real part"
  :precision binary64
  (/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))