(FPCore (re im) :precision binary64 (/ (atan2 im re) (log 10.0)))
(FPCore (re im) :precision binary64 (- (log1p (expm1 (/ (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 -log1p(expm1((atan2(im, re) / log(0.1))));
}
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.log1p(Math.expm1((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.log1p(math.expm1((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(-log1p(expm1(Float64(atan(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[Log[1 + N[(Exp[N[(N[ArcTan[im / re], $MachinePrecision] / N[Log[0.1], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision])
\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}
-\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log 0.1}\right)\right)



Bits error versus re



Bits error versus im
Results
Initial program 0.8
Applied egg-rr0.1
Applied egg-rr0.3
Applied egg-rr0.1
Final simplification0.1
herbie shell --seed 2022150
(FPCore (re im)
:name "math.log10 on complex, imaginary part"
:precision binary64
(/ (atan2 im re) (log 10.0)))