
(FPCore (re im) :precision binary64 (/ (atan2 im re) (log 10.0)))
double code(double re, double im) {
return atan2(im, re) / log(10.0);
}
real(8) function code(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = atan2(im, re) / log(10.0d0)
end function
public static double code(double re, double im) {
return Math.atan2(im, re) / Math.log(10.0);
}
def code(re, im): return math.atan2(im, re) / math.log(10.0)
function code(re, im) return Float64(atan(im, re) / log(10.0)) end
function tmp = code(re, im) tmp = atan2(im, re) / log(10.0); end
code[re_, im_] := N[(N[ArcTan[im / re], $MachinePrecision] / N[Log[10.0], $MachinePrecision]), $MachinePrecision]
\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}
Herbie found 3 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (/ (atan2 im re) (log 10.0)))
double code(double re, double im) {
return atan2(im, re) / log(10.0);
}
real(8) function code(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = atan2(im, re) / log(10.0d0)
end function
public static double code(double re, double im) {
return Math.atan2(im, re) / Math.log(10.0);
}
def code(re, im): return math.atan2(im, re) / math.log(10.0)
function code(re, im) return Float64(atan(im, re) / log(10.0)) end
function tmp = code(re, im) tmp = atan2(im, re) / log(10.0); end
code[re_, im_] := N[(N[ArcTan[im / re], $MachinePrecision] / N[Log[10.0], $MachinePrecision]), $MachinePrecision]
\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}
(FPCore (re im) :precision binary64 (/ (atan2 im re) (- (log 0.1))))
double code(double re, double im) {
return atan2(im, re) / -log(0.1);
}
real(8) function code(re, im)
use fmin_fmax_functions
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(0.1);
}
def code(re, im): return math.atan2(im, re) / -math.log(0.1)
function code(re, im) return Float64(atan(im, re) / Float64(-log(0.1))) 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[0.1], $MachinePrecision])), $MachinePrecision]
\frac{\tan^{-1}_* \frac{im}{re}}{-\log 0.1}
Initial program 98.7%
remove-double-negN/A
lower-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lower-log.f64N/A
metadata-eval99.8%
Applied rewrites99.8%
(FPCore (re im) :precision binary64 (/ (atan2 im re) 2.302585092994046))
double code(double re, double im) {
return atan2(im, re) / 2.302585092994046;
}
real(8) function code(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = atan2(im, re) / 2.302585092994046d0
end function
public static double code(double re, double im) {
return Math.atan2(im, re) / 2.302585092994046;
}
def code(re, im): return math.atan2(im, re) / 2.302585092994046
function code(re, im) return Float64(atan(im, re) / 2.302585092994046) end
function tmp = code(re, im) tmp = atan2(im, re) / 2.302585092994046; end
code[re_, im_] := N[(N[ArcTan[im / re], $MachinePrecision] / 2.302585092994046), $MachinePrecision]
\frac{\tan^{-1}_* \frac{im}{re}}{2.302585092994046}
Initial program 98.7%
Evaluated real constant98.7%
(FPCore (re im) :precision binary64 (* 0.43429448190325176 (atan2 im re)))
double code(double re, double im) {
return 0.43429448190325176 * atan2(im, re);
}
real(8) function code(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.43429448190325176d0 * atan2(im, re)
end function
public static double code(double re, double im) {
return 0.43429448190325176 * Math.atan2(im, re);
}
def code(re, im): return 0.43429448190325176 * math.atan2(im, re)
function code(re, im) return Float64(0.43429448190325176 * atan(im, re)) end
function tmp = code(re, im) tmp = 0.43429448190325176 * atan2(im, re); end
code[re_, im_] := N[(0.43429448190325176 * N[ArcTan[im / re], $MachinePrecision]), $MachinePrecision]
0.43429448190325176 \cdot \tan^{-1}_* \frac{im}{re}
Initial program 98.7%
Evaluated real constant98.7%
Taylor expanded in re around 0
lower-*.f64N/A
lower-atan2.f6498.6%
Applied rewrites98.6%
herbie shell --seed 2025313 -o setup:search
(FPCore (re im)
:name "math.log10 on complex, imaginary part"
:precision binary64
(/ (atan2 im re) (log 10.0)))