| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 26304 |
\[\frac{4}{\frac{\frac{4}{\frac{\tan^{-1}_* \frac{im}{re}}{{\log 10}^{2}}}}{\log 10}}
\]
(FPCore (re im) :precision binary64 (/ (atan2 im re) (log 10.0)))
(FPCore (re im) :precision binary64 (/ 4.0 (* (/ 4.0 (/ (atan2 im re) (pow (log 10.0) 2.0))) (/ 1.0 (log 10.0)))))
double code(double re, double im) {
return atan2(im, re) / log(10.0);
}
double code(double re, double im) {
return 4.0 / ((4.0 / (atan2(im, re) / pow(log(10.0), 2.0))) * (1.0 / log(10.0)));
}
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 = 4.0d0 / ((4.0d0 / (atan2(im, re) / (log(10.0d0) ** 2.0d0))) * (1.0d0 / log(10.0d0)))
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 4.0 / ((4.0 / (Math.atan2(im, re) / Math.pow(Math.log(10.0), 2.0))) * (1.0 / Math.log(10.0)));
}
def code(re, im): return math.atan2(im, re) / math.log(10.0)
def code(re, im): return 4.0 / ((4.0 / (math.atan2(im, re) / math.pow(math.log(10.0), 2.0))) * (1.0 / math.log(10.0)))
function code(re, im) return Float64(atan(im, re) / log(10.0)) end
function code(re, im) return Float64(4.0 / Float64(Float64(4.0 / Float64(atan(im, re) / (log(10.0) ^ 2.0))) * Float64(1.0 / log(10.0)))) end
function tmp = code(re, im) tmp = atan2(im, re) / log(10.0); end
function tmp = code(re, im) tmp = 4.0 / ((4.0 / (atan2(im, re) / (log(10.0) ^ 2.0))) * (1.0 / log(10.0))); end
code[re_, im_] := N[(N[ArcTan[im / re], $MachinePrecision] / N[Log[10.0], $MachinePrecision]), $MachinePrecision]
code[re_, im_] := N[(4.0 / N[(N[(4.0 / N[(N[ArcTan[im / re], $MachinePrecision] / N[Power[N[Log[10.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Log[10.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}
\frac{4}{\frac{4}{\frac{\tan^{-1}_* \frac{im}{re}}{{\log 10}^{2}}} \cdot \frac{1}{\log 10}}
Results
Initial program 0.8
Applied egg-rr9.9
Taylor expanded in im around 0 0.9
Applied egg-rr0.4
Final simplification0.4
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 26304 |
| Alternative 2 | |
|---|---|
| Error | 0.8 |
| Cost | 26240 |
| Alternative 3 | |
|---|---|
| Error | 0.8 |
| Cost | 26176 |
| Alternative 4 | |
|---|---|
| Error | 0.8 |
| Cost | 13056 |
herbie shell --seed 2023065
(FPCore (re im)
:name "math.log10 on complex, imaginary part"
:precision binary64
(/ (atan2 im re) (log 10.0)))