| Alternative 1 | |
|---|---|
| Error | 0.8 |
| Cost | 19840 |
\[\tan^{-1}_* \frac{im}{re} \cdot \left(\frac{-0.5}{\log 10} - \frac{-1.5}{\log 10}\right)
\]
(FPCore (re im) :precision binary64 (/ (atan2 im re) (log 10.0)))
(FPCore (re im) :precision binary64 (* (/ -0.5 (log 10.0)) (- (- 0.0 (/ 1.0 (/ 0.3333333333333333 (atan2 im re)))) (- (atan2 im re)))))
double code(double re, double im) {
return atan2(im, re) / log(10.0);
}
double code(double re, double im) {
return (-0.5 / log(10.0)) * ((0.0 - (1.0 / (0.3333333333333333 / atan2(im, re)))) - -atan2(im, re));
}
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 = ((-0.5d0) / log(10.0d0)) * ((0.0d0 - (1.0d0 / (0.3333333333333333d0 / atan2(im, re)))) - -atan2(im, re))
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 (-0.5 / Math.log(10.0)) * ((0.0 - (1.0 / (0.3333333333333333 / Math.atan2(im, re)))) - -Math.atan2(im, re));
}
def code(re, im): return math.atan2(im, re) / math.log(10.0)
def code(re, im): return (-0.5 / math.log(10.0)) * ((0.0 - (1.0 / (0.3333333333333333 / math.atan2(im, re)))) - -math.atan2(im, re))
function code(re, im) return Float64(atan(im, re) / log(10.0)) end
function code(re, im) return Float64(Float64(-0.5 / log(10.0)) * Float64(Float64(0.0 - Float64(1.0 / Float64(0.3333333333333333 / atan(im, re)))) - Float64(-atan(im, re)))) end
function tmp = code(re, im) tmp = atan2(im, re) / log(10.0); end
function tmp = code(re, im) tmp = (-0.5 / log(10.0)) * ((0.0 - (1.0 / (0.3333333333333333 / atan2(im, re)))) - -atan2(im, re)); end
code[re_, im_] := N[(N[ArcTan[im / re], $MachinePrecision] / N[Log[10.0], $MachinePrecision]), $MachinePrecision]
code[re_, im_] := N[(N[(-0.5 / N[Log[10.0], $MachinePrecision]), $MachinePrecision] * N[(N[(0.0 - N[(1.0 / N[(0.3333333333333333 / N[ArcTan[im / re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - (-N[ArcTan[im / re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}
\frac{-0.5}{\log 10} \cdot \left(\left(0 - \frac{1}{\frac{0.3333333333333333}{\tan^{-1}_* \frac{im}{re}}}\right) - \left(-\tan^{-1}_* \frac{im}{re}\right)\right)
Results
Initial program 0.8
Applied egg-rr0.9
Applied egg-rr0.3
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 0.8 |
| Cost | 19840 |
| Alternative 2 | |
|---|---|
| Error | 0.8 |
| Cost | 13056 |
herbie shell --seed 2023066
(FPCore (re im)
:name "math.log10 on complex, imaginary part"
:precision binary64
(/ (atan2 im re) (log 10.0)))