math.log10 on complex, imaginary part

?

Percentage Accurate: 98.7% → 99.8%
Time: 5.3s
Precision: binary64
Cost: 13120

?

\[\frac{\tan^{-1}_* \frac{im}{re}}{\log 10} \]
\[\frac{-\tan^{-1}_* \frac{im}{re}}{\log 0.1} \]
(FPCore (re im) :precision binary64 (/ (atan2 im re) (log 10.0)))
(FPCore (re im) :precision binary64 (/ (- (atan2 im re)) (log 0.1)))
double code(double re, double im) {
	return atan2(im, re) / log(10.0);
}
double code(double re, double im) {
	return -atan2(im, re) / log(0.1);
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = atan2(im, re) / log(10.0d0)
end function
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = -atan2(im, re) / log(0.1d0)
end function
public static double code(double re, double im) {
	return Math.atan2(im, re) / Math.log(10.0);
}
public static double code(double re, double im) {
	return -Math.atan2(im, re) / Math.log(0.1);
}
def code(re, im):
	return math.atan2(im, re) / math.log(10.0)
def code(re, im):
	return -math.atan2(im, re) / math.log(0.1)
function code(re, im)
	return Float64(atan(im, re) / log(10.0))
end
function code(re, im)
	return Float64(Float64(-atan(im, re)) / log(0.1))
end
function tmp = code(re, im)
	tmp = atan2(im, re) / log(10.0);
end
function tmp = code(re, im)
	tmp = -atan2(im, re) / log(0.1);
end
code[re_, im_] := N[(N[ArcTan[im / re], $MachinePrecision] / N[Log[10.0], $MachinePrecision]), $MachinePrecision]
code[re_, im_] := N[((-N[ArcTan[im / re], $MachinePrecision]) / N[Log[0.1], $MachinePrecision]), $MachinePrecision]
\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}
\frac{-\tan^{-1}_* \frac{im}{re}}{\log 0.1}

Local Percentage Accuracy?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 98.7%

    \[\frac{\tan^{-1}_* \frac{im}{re}}{\log 10} \]
  2. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\left(-\tan^{-1}_* \frac{im}{re}\right) \cdot \frac{1}{\log 0.1}} \]
    Step-by-step derivation

    [Start]98.7

    \[ \frac{\tan^{-1}_* \frac{im}{re}}{\log 10} \]

    frac-2neg [=>]98.7

    \[ \color{blue}{\frac{-\tan^{-1}_* \frac{im}{re}}{-\log 10}} \]

    div-inv [=>]98.5

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

    neg-log [=>]99.8

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

    metadata-eval [=>]99.8

    \[ \left(-\tan^{-1}_* \frac{im}{re}\right) \cdot \frac{1}{\log \color{blue}{0.1}} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\frac{-\tan^{-1}_* \frac{im}{re}}{\log 0.1}} \]
    Step-by-step derivation

    [Start]99.8

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

    associate-*r/ [=>]99.8

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

    *-rgt-identity [=>]99.8

    \[ \frac{\color{blue}{-\tan^{-1}_* \frac{im}{re}}}{\log 0.1} \]
  4. Final simplification99.8%

    \[\leadsto \frac{-\tan^{-1}_* \frac{im}{re}}{\log 0.1} \]

Alternatives

Alternative 1
Accuracy98.7%
Cost13056
\[\frac{\tan^{-1}_* \frac{im}{re}}{\log 10} \]

Error

Reproduce?

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