Average Error: 32.5 → 0
Time: 956.0ms
Precision: binary64
\[\log \left(\sqrt{re \cdot re + im \cdot im}\right) \]
\[\log \left(\mathsf{hypot}\left(re, im\right)\right) \]
\log \left(\sqrt{re \cdot re + im \cdot im}\right)
\log \left(\mathsf{hypot}\left(re, im\right)\right)
(FPCore (re im) :precision binary64 (log (sqrt (+ (* re re) (* im im)))))
(FPCore (re im) :precision binary64 (log (hypot re im)))
double code(double re, double im) {
	return log(sqrt((re * re) + (im * im)));
}
double code(double re, double im) {
	return log(hypot(re, im));
}

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 32.5

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

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

    \[\leadsto \log \left(\mathsf{hypot}\left(re, im\right)\right) \]

Reproduce

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