
(FPCore (angle esp phi0) :precision binary64 (* esp (- angle phi0)))
double code(double angle, double esp, double phi0) {
return esp * (angle - phi0);
}
real(8) function code(angle, esp, phi0)
use fmin_fmax_functions
real(8), intent (in) :: angle
real(8), intent (in) :: esp
real(8), intent (in) :: phi0
code = esp * (angle - phi0)
end function
public static double code(double angle, double esp, double phi0) {
return esp * (angle - phi0);
}
def code(angle, esp, phi0): return esp * (angle - phi0)
function code(angle, esp, phi0) return Float64(esp * Float64(angle - phi0)) end
function tmp = code(angle, esp, phi0) tmp = esp * (angle - phi0); end
code[angle_, esp_, phi0_] := N[(esp * N[(angle - phi0), $MachinePrecision]), $MachinePrecision]
esp \cdot \left(angle - phi0\right)
Herbie found 2 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (angle esp phi0) :precision binary64 (* esp (- angle phi0)))
double code(double angle, double esp, double phi0) {
return esp * (angle - phi0);
}
real(8) function code(angle, esp, phi0)
use fmin_fmax_functions
real(8), intent (in) :: angle
real(8), intent (in) :: esp
real(8), intent (in) :: phi0
code = esp * (angle - phi0)
end function
public static double code(double angle, double esp, double phi0) {
return esp * (angle - phi0);
}
def code(angle, esp, phi0): return esp * (angle - phi0)
function code(angle, esp, phi0) return Float64(esp * Float64(angle - phi0)) end
function tmp = code(angle, esp, phi0) tmp = esp * (angle - phi0); end
code[angle_, esp_, phi0_] := N[(esp * N[(angle - phi0), $MachinePrecision]), $MachinePrecision]
esp \cdot \left(angle - phi0\right)
(FPCore (angle esp phi0) :precision binary64 (* angle esp))
double code(double angle, double esp, double phi0) {
return angle * esp;
}
real(8) function code(angle, esp, phi0)
use fmin_fmax_functions
real(8), intent (in) :: angle
real(8), intent (in) :: esp
real(8), intent (in) :: phi0
code = angle * esp
end function
public static double code(double angle, double esp, double phi0) {
return angle * esp;
}
def code(angle, esp, phi0): return angle * esp
function code(angle, esp, phi0) return Float64(angle * esp) end
function tmp = code(angle, esp, phi0) tmp = angle * esp; end
code[angle_, esp_, phi0_] := N[(angle * esp), $MachinePrecision]
angle \cdot esp
Initial program 100.0%
Taylor expanded in angle around inf
lower-*.f6453.5%
Applied rewrites53.5%
herbie shell --seed 2025315
(FPCore (angle esp phi0)
:name "spherical-y-scale-shift"
:precision binary64
:pre (> esp 0.0)
(* esp (- angle phi0)))