Average Error: 0.8 → 0.5
Time: 2.9s
Precision: binary64
\[\frac{\tan^{-1}_* \frac{im}{re}}{\log 10} \]
\[\mathsf{log1p}\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)\right)\right)\right) \]
\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}
\mathsf{log1p}\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)\right)\right)\right)
(FPCore (re im) :precision binary64 (/ (atan2 im re) (log 10.0)))
(FPCore (re im)
 :precision binary64
 (log1p (log1p (expm1 (expm1 (/ (atan2 im re) (log 10.0)))))))
double code(double re, double im) {
	return atan2(im, re) / log(10.0);
}
double code(double re, double im) {
	return log1p(log1p(expm1(expm1(atan2(im, re) / 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 0.8

    \[\frac{\tan^{-1}_* \frac{im}{re}}{\log 10} \]
  2. Applied log1p-expm1-u_binary640.7

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)\right)} \]
  3. Applied log1p-expm1-u_binary640.5

    \[\leadsto \mathsf{log1p}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)\right)\right)}\right) \]
  4. Final simplification0.5

    \[\leadsto \mathsf{log1p}\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\right)\right)\right)\right) \]

Reproduce

herbie shell --seed 2021340 
(FPCore (re im)
  :name "math.log10 on complex, imaginary part"
  :precision binary64
  (/ (atan2 im re) (log 10.0)))