
(FPCore (y esp phi0 g) :precision binary64 (let* ((t_0 (cos (+ phi0 (/ y esp))))) (if (or (> (fabs g) 0) (> (fabs t_0) 0)) (atan2 g t_0) 0)))
double code(double y, double esp, double phi0, double g) {
double t_0 = cos((phi0 + (y / esp)));
double tmp;
if ((fabs(g) > 0.0) || (fabs(t_0) > 0.0)) {
tmp = atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(y, esp, phi0, g)
use fmin_fmax_functions
real(8), intent (in) :: y
real(8), intent (in) :: esp
real(8), intent (in) :: phi0
real(8), intent (in) :: g
real(8) :: t_0
real(8) :: tmp
t_0 = cos((phi0 + (y / esp)))
if ((abs(g) > 0.0d0) .or. (abs(t_0) > 0.0d0)) then
tmp = atan2(g, t_0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double y, double esp, double phi0, double g) {
double t_0 = Math.cos((phi0 + (y / esp)));
double tmp;
if ((Math.abs(g) > 0.0) || (Math.abs(t_0) > 0.0)) {
tmp = Math.atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(y, esp, phi0, g): t_0 = math.cos((phi0 + (y / esp))) tmp = 0 if (math.fabs(g) > 0.0) or (math.fabs(t_0) > 0.0): tmp = math.atan2(g, t_0) else: tmp = 0.0 return tmp
function code(y, esp, phi0, g) t_0 = cos(Float64(phi0 + Float64(y / esp))) tmp = 0.0 if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan(g, t_0); else tmp = 0.0; end return tmp end
function tmp_2 = code(y, esp, phi0, g) t_0 = cos((phi0 + (y / esp))); tmp = 0.0; if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan2(g, t_0); else tmp = 0.0; end tmp_2 = tmp; end
code[y_, esp_, phi0_, g_] := Block[{t$95$0 = N[Cos[N[(phi0 + N[(y / esp), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[Greater[N[Abs[g], $MachinePrecision], 0], Greater[N[Abs[t$95$0], $MachinePrecision], 0]], N[ArcTan[g / t$95$0], $MachinePrecision], 0]]
\begin{array}{l}
t_0 := \cos \left(phi0 + \frac{y}{esp}\right)\\
\mathbf{if}\;\left|g\right| > 0 \lor \left|t\_0\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (y esp phi0 g) :precision binary64 (let* ((t_0 (cos (+ phi0 (/ y esp))))) (if (or (> (fabs g) 0) (> (fabs t_0) 0)) (atan2 g t_0) 0)))
double code(double y, double esp, double phi0, double g) {
double t_0 = cos((phi0 + (y / esp)));
double tmp;
if ((fabs(g) > 0.0) || (fabs(t_0) > 0.0)) {
tmp = atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(y, esp, phi0, g)
use fmin_fmax_functions
real(8), intent (in) :: y
real(8), intent (in) :: esp
real(8), intent (in) :: phi0
real(8), intent (in) :: g
real(8) :: t_0
real(8) :: tmp
t_0 = cos((phi0 + (y / esp)))
if ((abs(g) > 0.0d0) .or. (abs(t_0) > 0.0d0)) then
tmp = atan2(g, t_0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double y, double esp, double phi0, double g) {
double t_0 = Math.cos((phi0 + (y / esp)));
double tmp;
if ((Math.abs(g) > 0.0) || (Math.abs(t_0) > 0.0)) {
tmp = Math.atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(y, esp, phi0, g): t_0 = math.cos((phi0 + (y / esp))) tmp = 0 if (math.fabs(g) > 0.0) or (math.fabs(t_0) > 0.0): tmp = math.atan2(g, t_0) else: tmp = 0.0 return tmp
function code(y, esp, phi0, g) t_0 = cos(Float64(phi0 + Float64(y / esp))) tmp = 0.0 if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan(g, t_0); else tmp = 0.0; end return tmp end
function tmp_2 = code(y, esp, phi0, g) t_0 = cos((phi0 + (y / esp))); tmp = 0.0; if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan2(g, t_0); else tmp = 0.0; end tmp_2 = tmp; end
code[y_, esp_, phi0_, g_] := Block[{t$95$0 = N[Cos[N[(phi0 + N[(y / esp), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[Greater[N[Abs[g], $MachinePrecision], 0], Greater[N[Abs[t$95$0], $MachinePrecision], 0]], N[ArcTan[g / t$95$0], $MachinePrecision], 0]]
\begin{array}{l}
t_0 := \cos \left(phi0 + \frac{y}{esp}\right)\\
\mathbf{if}\;\left|g\right| > 0 \lor \left|t\_0\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
(FPCore (y esp phi0 g)
:precision binary64
(let* ((t_0
(-
(* -1 (cos (- (- PI (/ y esp)) phi0)))
(* (sin (- (+ (/ y esp) phi0) PI)) 0)))
(t_1
(-
(* (cos (/ y esp)) (cos phi0))
(* (sin (/ y esp)) (sin phi0))))
(t_2 (> (fabs g) 0)))
(if (<=
(/ y esp)
-100000000000000007629769841091887003294964970946560)
(if (or t_2 (> (fabs t_0) 0)) (atan2 g t_0) 0)
(if (<= (/ y esp) 5000000000)
(if (or t_2 (> (fabs t_1) 0)) (atan2 g t_1) 0)
(if (or t_2
(> (fabs (sin (+ (- phi0 (* 1/2 PI)) (/ y esp)))) 0))
(atan2 g (sin (- (- (/ (- y) esp) phi0) (* -1/2 PI))))
0)))))double code(double y, double esp, double phi0, double g) {
double t_0 = (-1.0 * cos(((((double) M_PI) - (y / esp)) - phi0))) - (sin((((y / esp) + phi0) - ((double) M_PI))) * 0.0);
double t_1 = (cos((y / esp)) * cos(phi0)) - (sin((y / esp)) * sin(phi0));
int t_2 = fabs(g) > 0.0;
double tmp_1;
if ((y / esp) <= -1e+50) {
double tmp_2;
if (t_2 || (fabs(t_0) > 0.0)) {
tmp_2 = atan2(g, t_0);
} else {
tmp_2 = 0.0;
}
tmp_1 = tmp_2;
} else if ((y / esp) <= 5000000000.0) {
double tmp_3;
if (t_2 || (fabs(t_1) > 0.0)) {
tmp_3 = atan2(g, t_1);
} else {
tmp_3 = 0.0;
}
tmp_1 = tmp_3;
} else if (t_2 || (fabs(sin(((phi0 - (0.5 * ((double) M_PI))) + (y / esp)))) > 0.0)) {
tmp_1 = atan2(g, sin((((-y / esp) - phi0) - (-0.5 * ((double) M_PI)))));
} else {
tmp_1 = 0.0;
}
return tmp_1;
}
public static double code(double y, double esp, double phi0, double g) {
double t_0 = (-1.0 * Math.cos(((Math.PI - (y / esp)) - phi0))) - (Math.sin((((y / esp) + phi0) - Math.PI)) * 0.0);
double t_1 = (Math.cos((y / esp)) * Math.cos(phi0)) - (Math.sin((y / esp)) * Math.sin(phi0));
boolean t_2 = Math.abs(g) > 0.0;
double tmp_1;
if ((y / esp) <= -1e+50) {
double tmp_2;
if (t_2 || (Math.abs(t_0) > 0.0)) {
tmp_2 = Math.atan2(g, t_0);
} else {
tmp_2 = 0.0;
}
tmp_1 = tmp_2;
} else if ((y / esp) <= 5000000000.0) {
double tmp_3;
if (t_2 || (Math.abs(t_1) > 0.0)) {
tmp_3 = Math.atan2(g, t_1);
} else {
tmp_3 = 0.0;
}
tmp_1 = tmp_3;
} else if (t_2 || (Math.abs(Math.sin(((phi0 - (0.5 * Math.PI)) + (y / esp)))) > 0.0)) {
tmp_1 = Math.atan2(g, Math.sin((((-y / esp) - phi0) - (-0.5 * Math.PI))));
} else {
tmp_1 = 0.0;
}
return tmp_1;
}
def code(y, esp, phi0, g): t_0 = (-1.0 * math.cos(((math.pi - (y / esp)) - phi0))) - (math.sin((((y / esp) + phi0) - math.pi)) * 0.0) t_1 = (math.cos((y / esp)) * math.cos(phi0)) - (math.sin((y / esp)) * math.sin(phi0)) t_2 = math.fabs(g) > 0.0 tmp_1 = 0 if (y / esp) <= -1e+50: tmp_2 = 0 if t_2 or (math.fabs(t_0) > 0.0): tmp_2 = math.atan2(g, t_0) else: tmp_2 = 0.0 tmp_1 = tmp_2 elif (y / esp) <= 5000000000.0: tmp_3 = 0 if t_2 or (math.fabs(t_1) > 0.0): tmp_3 = math.atan2(g, t_1) else: tmp_3 = 0.0 tmp_1 = tmp_3 elif t_2 or (math.fabs(math.sin(((phi0 - (0.5 * math.pi)) + (y / esp)))) > 0.0): tmp_1 = math.atan2(g, math.sin((((-y / esp) - phi0) - (-0.5 * math.pi)))) else: tmp_1 = 0.0 return tmp_1
function code(y, esp, phi0, g) t_0 = Float64(Float64(-1.0 * cos(Float64(Float64(pi - Float64(y / esp)) - phi0))) - Float64(sin(Float64(Float64(Float64(y / esp) + phi0) - pi)) * 0.0)) t_1 = Float64(Float64(cos(Float64(y / esp)) * cos(phi0)) - Float64(sin(Float64(y / esp)) * sin(phi0))) t_2 = abs(g) > 0.0 tmp_1 = 0.0 if (Float64(y / esp) <= -1e+50) tmp_2 = 0.0 if (t_2 || (abs(t_0) > 0.0)) tmp_2 = atan(g, t_0); else tmp_2 = 0.0; end tmp_1 = tmp_2; elseif (Float64(y / esp) <= 5000000000.0) tmp_3 = 0.0 if (t_2 || (abs(t_1) > 0.0)) tmp_3 = atan(g, t_1); else tmp_3 = 0.0; end tmp_1 = tmp_3; elseif (t_2 || (abs(sin(Float64(Float64(phi0 - Float64(0.5 * pi)) + Float64(y / esp)))) > 0.0)) tmp_1 = atan(g, sin(Float64(Float64(Float64(Float64(-y) / esp) - phi0) - Float64(-0.5 * pi)))); else tmp_1 = 0.0; end return tmp_1 end
function tmp_5 = code(y, esp, phi0, g) t_0 = (-1.0 * cos(((pi - (y / esp)) - phi0))) - (sin((((y / esp) + phi0) - pi)) * 0.0); t_1 = (cos((y / esp)) * cos(phi0)) - (sin((y / esp)) * sin(phi0)); t_2 = abs(g) > 0.0; tmp_2 = 0.0; if ((y / esp) <= -1e+50) tmp_3 = 0.0; if (t_2 || (abs(t_0) > 0.0)) tmp_3 = atan2(g, t_0); else tmp_3 = 0.0; end tmp_2 = tmp_3; elseif ((y / esp) <= 5000000000.0) tmp_4 = 0.0; if (t_2 || (abs(t_1) > 0.0)) tmp_4 = atan2(g, t_1); else tmp_4 = 0.0; end tmp_2 = tmp_4; elseif (t_2 || (abs(sin(((phi0 - (0.5 * pi)) + (y / esp)))) > 0.0)) tmp_2 = atan2(g, sin((((-y / esp) - phi0) - (-0.5 * pi)))); else tmp_2 = 0.0; end tmp_5 = tmp_2; end
code[y_, esp_, phi0_, g_] := Block[{t$95$0 = N[(N[(-1 * N[Cos[N[(N[(Pi - N[(y / esp), $MachinePrecision]), $MachinePrecision] - phi0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[(N[(N[(y / esp), $MachinePrecision] + phi0), $MachinePrecision] - Pi), $MachinePrecision]], $MachinePrecision] * 0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Cos[N[(y / esp), $MachinePrecision]], $MachinePrecision] * N[Cos[phi0], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[(y / esp), $MachinePrecision]], $MachinePrecision] * N[Sin[phi0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = Greater[N[Abs[g], $MachinePrecision], 0]}, If[LessEqual[N[(y / esp), $MachinePrecision], -100000000000000007629769841091887003294964970946560], If[Or[t$95$2, Greater[N[Abs[t$95$0], $MachinePrecision], 0]], N[ArcTan[g / t$95$0], $MachinePrecision], 0], If[LessEqual[N[(y / esp), $MachinePrecision], 5000000000], If[Or[t$95$2, Greater[N[Abs[t$95$1], $MachinePrecision], 0]], N[ArcTan[g / t$95$1], $MachinePrecision], 0], If[Or[t$95$2, Greater[N[Abs[N[Sin[N[(N[(phi0 - N[(1/2 * Pi), $MachinePrecision]), $MachinePrecision] + N[(y / esp), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 0]], N[ArcTan[g / N[Sin[N[(N[(N[((-y) / esp), $MachinePrecision] - phi0), $MachinePrecision] - N[(-1/2 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 0]]]]]]
\begin{array}{l}
t_0 := -1 \cdot \cos \left(\left(\pi - \frac{y}{esp}\right) - phi0\right) - \sin \left(\left(\frac{y}{esp} + phi0\right) - \pi\right) \cdot 0\\
t_1 := \cos \left(\frac{y}{esp}\right) \cdot \cos phi0 - \sin \left(\frac{y}{esp}\right) \cdot \sin phi0\\
t_2 := \left|g\right| > 0\\
\mathbf{if}\;\frac{y}{esp} \leq -100000000000000007629769841091887003294964970946560:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_2 \lor \left|t\_0\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}\\
\mathbf{elif}\;\frac{y}{esp} \leq 5000000000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_2 \lor \left|t\_1\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}\\
\mathbf{elif}\;t\_2 \lor \left|\sin \left(\left(phi0 - \frac{1}{2} \cdot \pi\right) + \frac{y}{esp}\right)\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{\sin \left(\left(\frac{-y}{esp} - phi0\right) - \frac{-1}{2} \cdot \pi\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
if (/.f64 y esp) < -1.0000000000000001e50Initial program 74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval74.4%
Applied rewrites74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval66.3%
Applied rewrites66.3%
Applied rewrites66.3%
Applied rewrites74.3%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
lift-PI.f64N/A
sin-PIN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
sin-PIN/A
lift-PI.f64N/A
lower--.f64N/A
Applied rewrites74.3%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
lift-PI.f64N/A
sin-PIN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
sin-PIN/A
lift-PI.f64N/A
lower--.f64N/A
Applied rewrites62.7%
if -1.0000000000000001e50 < (/.f64 y esp) < 5e9Initial program 74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval74.4%
Applied rewrites74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval66.3%
Applied rewrites66.3%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6466.3%
Applied rewrites66.3%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6466.1%
Applied rewrites66.1%
lift-sin.f64N/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
mult-flipN/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
cos-sumN/A
cos-neg-revN/A
lift-neg.f64N/A
Applied rewrites66.1%
lift-sin.f64N/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
mult-flipN/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
cos-sumN/A
cos-neg-revN/A
lift-neg.f64N/A
Applied rewrites74.7%
if 5e9 < (/.f64 y esp) Initial program 74.4%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
add-sound-/N/A
lower-/.f64N/A
lower-neg.f64N/A
lower--.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6474.4%
Applied rewrites74.4%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
add-sound-/N/A
lower-/.f64N/A
lower-neg.f64N/A
lower--.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6465.8%
Applied rewrites65.8%
Applied rewrites65.8%
(FPCore (y esp phi0 g)
:precision binary64
(let* ((t_0
(-
(* (sin phi0) (sin (+ (/ y esp) PI)))
(* (cos phi0) (sin (- (/ -1 (/ esp y)) (* 1/2 PI)))))))
(if (or (> (fabs g) 0) (> (fabs t_0) 0)) (atan2 g t_0) 0)))double code(double y, double esp, double phi0, double g) {
double t_0 = (sin(phi0) * sin(((y / esp) + ((double) M_PI)))) - (cos(phi0) * sin(((-1.0 / (esp / y)) - (0.5 * ((double) M_PI)))));
double tmp;
if ((fabs(g) > 0.0) || (fabs(t_0) > 0.0)) {
tmp = atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double y, double esp, double phi0, double g) {
double t_0 = (Math.sin(phi0) * Math.sin(((y / esp) + Math.PI))) - (Math.cos(phi0) * Math.sin(((-1.0 / (esp / y)) - (0.5 * Math.PI))));
double tmp;
if ((Math.abs(g) > 0.0) || (Math.abs(t_0) > 0.0)) {
tmp = Math.atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(y, esp, phi0, g): t_0 = (math.sin(phi0) * math.sin(((y / esp) + math.pi))) - (math.cos(phi0) * math.sin(((-1.0 / (esp / y)) - (0.5 * math.pi)))) tmp = 0 if (math.fabs(g) > 0.0) or (math.fabs(t_0) > 0.0): tmp = math.atan2(g, t_0) else: tmp = 0.0 return tmp
function code(y, esp, phi0, g) t_0 = Float64(Float64(sin(phi0) * sin(Float64(Float64(y / esp) + pi))) - Float64(cos(phi0) * sin(Float64(Float64(-1.0 / Float64(esp / y)) - Float64(0.5 * pi))))) tmp = 0.0 if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan(g, t_0); else tmp = 0.0; end return tmp end
function tmp_2 = code(y, esp, phi0, g) t_0 = (sin(phi0) * sin(((y / esp) + pi))) - (cos(phi0) * sin(((-1.0 / (esp / y)) - (0.5 * pi)))); tmp = 0.0; if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan2(g, t_0); else tmp = 0.0; end tmp_2 = tmp; end
code[y_, esp_, phi0_, g_] := Block[{t$95$0 = N[(N[(N[Sin[phi0], $MachinePrecision] * N[Sin[N[(N[(y / esp), $MachinePrecision] + Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi0], $MachinePrecision] * N[Sin[N[(N[(-1 / N[(esp / y), $MachinePrecision]), $MachinePrecision] - N[(1/2 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[Greater[N[Abs[g], $MachinePrecision], 0], Greater[N[Abs[t$95$0], $MachinePrecision], 0]], N[ArcTan[g / t$95$0], $MachinePrecision], 0]]
\begin{array}{l}
t_0 := \sin phi0 \cdot \sin \left(\frac{y}{esp} + \pi\right) - \cos phi0 \cdot \sin \left(\frac{-1}{\frac{esp}{y}} - \frac{1}{2} \cdot \pi\right)\\
\mathbf{if}\;\left|g\right| > 0 \lor \left|t\_0\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
Initial program 74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lift-+.f64N/A
add-flipN/A
associate-+l-N/A
sin-diffN/A
lower--.f64N/A
Applied rewrites74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lift-+.f64N/A
add-flipN/A
associate-+l-N/A
sin-diffN/A
lower--.f64N/A
Applied rewrites74.8%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-/.f64N/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6474.8%
Applied rewrites74.8%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-/.f64N/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6474.8%
Applied rewrites74.8%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-/.f64N/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6474.8%
Applied rewrites74.8%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-/.f64N/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6474.7%
Applied rewrites74.7%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
add-sound-/N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
add-sound-/N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
add-sound-/N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
add-sound-/N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-cos.f64N/A
lift--.f64N/A
sub-negate-revN/A
cos-negN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mul-1-negN/A
add-flip-revN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-PI.f64N/A
cos-+PI/2-revN/A
sin-+PI-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lower-+.f6474.7%
Applied rewrites74.7%
lift-cos.f64N/A
lift--.f64N/A
sub-negate-revN/A
cos-negN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mul-1-negN/A
add-flip-revN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lift-PI.f64N/A
cos-+PI/2-revN/A
sin-+PI-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lower-+.f6474.7%
Applied rewrites74.7%
(FPCore (y esp phi0 g)
:precision binary64
(let* ((t_0
(-
(* -1 (cos (- (- PI (/ y esp)) phi0)))
(* (sin (- (+ (/ y esp) phi0) PI)) 0)))
(t_1 (cos (+ phi0 (* (/ 1 esp) y))))
(t_2 (> (fabs g) 0)))
(if (<=
(/ y esp)
-100000000000000007629769841091887003294964970946560)
(if (or t_2 (> (fabs t_0) 0)) (atan2 g t_0) 0)
(if (or t_2 (> (fabs t_1) 0)) (atan2 g t_1) 0))))double code(double y, double esp, double phi0, double g) {
double t_0 = (-1.0 * cos(((((double) M_PI) - (y / esp)) - phi0))) - (sin((((y / esp) + phi0) - ((double) M_PI))) * 0.0);
double t_1 = cos((phi0 + ((1.0 / esp) * y)));
int t_2 = fabs(g) > 0.0;
double tmp_1;
if ((y / esp) <= -1e+50) {
double tmp_2;
if (t_2 || (fabs(t_0) > 0.0)) {
tmp_2 = atan2(g, t_0);
} else {
tmp_2 = 0.0;
}
tmp_1 = tmp_2;
} else if (t_2 || (fabs(t_1) > 0.0)) {
tmp_1 = atan2(g, t_1);
} else {
tmp_1 = 0.0;
}
return tmp_1;
}
public static double code(double y, double esp, double phi0, double g) {
double t_0 = (-1.0 * Math.cos(((Math.PI - (y / esp)) - phi0))) - (Math.sin((((y / esp) + phi0) - Math.PI)) * 0.0);
double t_1 = Math.cos((phi0 + ((1.0 / esp) * y)));
boolean t_2 = Math.abs(g) > 0.0;
double tmp_1;
if ((y / esp) <= -1e+50) {
double tmp_2;
if (t_2 || (Math.abs(t_0) > 0.0)) {
tmp_2 = Math.atan2(g, t_0);
} else {
tmp_2 = 0.0;
}
tmp_1 = tmp_2;
} else if (t_2 || (Math.abs(t_1) > 0.0)) {
tmp_1 = Math.atan2(g, t_1);
} else {
tmp_1 = 0.0;
}
return tmp_1;
}
def code(y, esp, phi0, g): t_0 = (-1.0 * math.cos(((math.pi - (y / esp)) - phi0))) - (math.sin((((y / esp) + phi0) - math.pi)) * 0.0) t_1 = math.cos((phi0 + ((1.0 / esp) * y))) t_2 = math.fabs(g) > 0.0 tmp_1 = 0 if (y / esp) <= -1e+50: tmp_2 = 0 if t_2 or (math.fabs(t_0) > 0.0): tmp_2 = math.atan2(g, t_0) else: tmp_2 = 0.0 tmp_1 = tmp_2 elif t_2 or (math.fabs(t_1) > 0.0): tmp_1 = math.atan2(g, t_1) else: tmp_1 = 0.0 return tmp_1
function code(y, esp, phi0, g) t_0 = Float64(Float64(-1.0 * cos(Float64(Float64(pi - Float64(y / esp)) - phi0))) - Float64(sin(Float64(Float64(Float64(y / esp) + phi0) - pi)) * 0.0)) t_1 = cos(Float64(phi0 + Float64(Float64(1.0 / esp) * y))) t_2 = abs(g) > 0.0 tmp_1 = 0.0 if (Float64(y / esp) <= -1e+50) tmp_2 = 0.0 if (t_2 || (abs(t_0) > 0.0)) tmp_2 = atan(g, t_0); else tmp_2 = 0.0; end tmp_1 = tmp_2; elseif (t_2 || (abs(t_1) > 0.0)) tmp_1 = atan(g, t_1); else tmp_1 = 0.0; end return tmp_1 end
function tmp_4 = code(y, esp, phi0, g) t_0 = (-1.0 * cos(((pi - (y / esp)) - phi0))) - (sin((((y / esp) + phi0) - pi)) * 0.0); t_1 = cos((phi0 + ((1.0 / esp) * y))); t_2 = abs(g) > 0.0; tmp_2 = 0.0; if ((y / esp) <= -1e+50) tmp_3 = 0.0; if (t_2 || (abs(t_0) > 0.0)) tmp_3 = atan2(g, t_0); else tmp_3 = 0.0; end tmp_2 = tmp_3; elseif (t_2 || (abs(t_1) > 0.0)) tmp_2 = atan2(g, t_1); else tmp_2 = 0.0; end tmp_4 = tmp_2; end
code[y_, esp_, phi0_, g_] := Block[{t$95$0 = N[(N[(-1 * N[Cos[N[(N[(Pi - N[(y / esp), $MachinePrecision]), $MachinePrecision] - phi0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[(N[(N[(y / esp), $MachinePrecision] + phi0), $MachinePrecision] - Pi), $MachinePrecision]], $MachinePrecision] * 0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(phi0 + N[(N[(1 / esp), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = Greater[N[Abs[g], $MachinePrecision], 0]}, If[LessEqual[N[(y / esp), $MachinePrecision], -100000000000000007629769841091887003294964970946560], If[Or[t$95$2, Greater[N[Abs[t$95$0], $MachinePrecision], 0]], N[ArcTan[g / t$95$0], $MachinePrecision], 0], If[Or[t$95$2, Greater[N[Abs[t$95$1], $MachinePrecision], 0]], N[ArcTan[g / t$95$1], $MachinePrecision], 0]]]]]
\begin{array}{l}
t_0 := -1 \cdot \cos \left(\left(\pi - \frac{y}{esp}\right) - phi0\right) - \sin \left(\left(\frac{y}{esp} + phi0\right) - \pi\right) \cdot 0\\
t_1 := \cos \left(phi0 + \frac{1}{esp} \cdot y\right)\\
t_2 := \left|g\right| > 0\\
\mathbf{if}\;\frac{y}{esp} \leq -100000000000000007629769841091887003294964970946560:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_2 \lor \left|t\_0\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}\\
\mathbf{elif}\;t\_2 \lor \left|t\_1\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
if (/.f64 y esp) < -1.0000000000000001e50Initial program 74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval74.4%
Applied rewrites74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval66.3%
Applied rewrites66.3%
Applied rewrites66.3%
Applied rewrites74.3%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
lift-PI.f64N/A
sin-PIN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
sin-PIN/A
lift-PI.f64N/A
lower--.f64N/A
Applied rewrites74.3%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
lift-PI.f64N/A
sin-PIN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
sin-PIN/A
lift-PI.f64N/A
lower--.f64N/A
Applied rewrites62.7%
if -1.0000000000000001e50 < (/.f64 y esp) Initial program 74.4%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
add-sound-/N/A
lower-/.f6474.4%
Applied rewrites74.4%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
add-sound-/N/A
lower-/.f6474.4%
Applied rewrites74.4%
(FPCore (y esp phi0 g)
:precision binary64
(let* ((t_0 (cos (+ phi0 (* (/ 1 esp) y))))
(t_1 (sin (- (+ (/ 1 (/ esp y)) phi0) (* PI -1/2))))
(t_2 (> (fabs g) 0)))
(if (<=
(/ y esp)
-100000000000000007629769841091887003294964970946560)
(if (or t_2 (> (fabs t_1) 0)) (atan2 g t_1) 0)
(if (or t_2 (> (fabs t_0) 0)) (atan2 g t_0) 0))))double code(double y, double esp, double phi0, double g) {
double t_0 = cos((phi0 + ((1.0 / esp) * y)));
double t_1 = sin((((1.0 / (esp / y)) + phi0) - (((double) M_PI) * -0.5)));
int t_2 = fabs(g) > 0.0;
double tmp_1;
if ((y / esp) <= -1e+50) {
double tmp_2;
if (t_2 || (fabs(t_1) > 0.0)) {
tmp_2 = atan2(g, t_1);
} else {
tmp_2 = 0.0;
}
tmp_1 = tmp_2;
} else if (t_2 || (fabs(t_0) > 0.0)) {
tmp_1 = atan2(g, t_0);
} else {
tmp_1 = 0.0;
}
return tmp_1;
}
public static double code(double y, double esp, double phi0, double g) {
double t_0 = Math.cos((phi0 + ((1.0 / esp) * y)));
double t_1 = Math.sin((((1.0 / (esp / y)) + phi0) - (Math.PI * -0.5)));
boolean t_2 = Math.abs(g) > 0.0;
double tmp_1;
if ((y / esp) <= -1e+50) {
double tmp_2;
if (t_2 || (Math.abs(t_1) > 0.0)) {
tmp_2 = Math.atan2(g, t_1);
} else {
tmp_2 = 0.0;
}
tmp_1 = tmp_2;
} else if (t_2 || (Math.abs(t_0) > 0.0)) {
tmp_1 = Math.atan2(g, t_0);
} else {
tmp_1 = 0.0;
}
return tmp_1;
}
def code(y, esp, phi0, g): t_0 = math.cos((phi0 + ((1.0 / esp) * y))) t_1 = math.sin((((1.0 / (esp / y)) + phi0) - (math.pi * -0.5))) t_2 = math.fabs(g) > 0.0 tmp_1 = 0 if (y / esp) <= -1e+50: tmp_2 = 0 if t_2 or (math.fabs(t_1) > 0.0): tmp_2 = math.atan2(g, t_1) else: tmp_2 = 0.0 tmp_1 = tmp_2 elif t_2 or (math.fabs(t_0) > 0.0): tmp_1 = math.atan2(g, t_0) else: tmp_1 = 0.0 return tmp_1
function code(y, esp, phi0, g) t_0 = cos(Float64(phi0 + Float64(Float64(1.0 / esp) * y))) t_1 = sin(Float64(Float64(Float64(1.0 / Float64(esp / y)) + phi0) - Float64(pi * -0.5))) t_2 = abs(g) > 0.0 tmp_1 = 0.0 if (Float64(y / esp) <= -1e+50) tmp_2 = 0.0 if (t_2 || (abs(t_1) > 0.0)) tmp_2 = atan(g, t_1); else tmp_2 = 0.0; end tmp_1 = tmp_2; elseif (t_2 || (abs(t_0) > 0.0)) tmp_1 = atan(g, t_0); else tmp_1 = 0.0; end return tmp_1 end
function tmp_4 = code(y, esp, phi0, g) t_0 = cos((phi0 + ((1.0 / esp) * y))); t_1 = sin((((1.0 / (esp / y)) + phi0) - (pi * -0.5))); t_2 = abs(g) > 0.0; tmp_2 = 0.0; if ((y / esp) <= -1e+50) tmp_3 = 0.0; if (t_2 || (abs(t_1) > 0.0)) tmp_3 = atan2(g, t_1); else tmp_3 = 0.0; end tmp_2 = tmp_3; elseif (t_2 || (abs(t_0) > 0.0)) tmp_2 = atan2(g, t_0); else tmp_2 = 0.0; end tmp_4 = tmp_2; end
code[y_, esp_, phi0_, g_] := Block[{t$95$0 = N[Cos[N[(phi0 + N[(N[(1 / esp), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(N[(1 / N[(esp / y), $MachinePrecision]), $MachinePrecision] + phi0), $MachinePrecision] - N[(Pi * -1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = Greater[N[Abs[g], $MachinePrecision], 0]}, If[LessEqual[N[(y / esp), $MachinePrecision], -100000000000000007629769841091887003294964970946560], If[Or[t$95$2, Greater[N[Abs[t$95$1], $MachinePrecision], 0]], N[ArcTan[g / t$95$1], $MachinePrecision], 0], If[Or[t$95$2, Greater[N[Abs[t$95$0], $MachinePrecision], 0]], N[ArcTan[g / t$95$0], $MachinePrecision], 0]]]]]
\begin{array}{l}
t_0 := \cos \left(phi0 + \frac{1}{esp} \cdot y\right)\\
t_1 := \sin \left(\left(\frac{1}{\frac{esp}{y}} + phi0\right) - \pi \cdot \frac{-1}{2}\right)\\
t_2 := \left|g\right| > 0\\
\mathbf{if}\;\frac{y}{esp} \leq -100000000000000007629769841091887003294964970946560:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_2 \lor \left|t\_1\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}\\
\mathbf{elif}\;t\_2 \lor \left|t\_0\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
if (/.f64 y esp) < -1.0000000000000001e50Initial program 74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval74.4%
Applied rewrites74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval66.3%
Applied rewrites66.3%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6466.3%
Applied rewrites66.3%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6466.1%
Applied rewrites66.1%
if -1.0000000000000001e50 < (/.f64 y esp) Initial program 74.4%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
add-sound-/N/A
lower-/.f6474.4%
Applied rewrites74.4%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
add-sound-/N/A
lower-/.f6474.4%
Applied rewrites74.4%
(FPCore (y esp phi0 g)
:precision binary64
(let* ((t_0 (- (* -1/2 PI) (/ y esp)))
(t_1 (- (* (sin phi0) (cos t_0)) (* (cos phi0) (sin t_0)))))
(if (or (> (fabs g) 0) (> (fabs t_1) 0)) (atan2 g t_1) 0)))double code(double y, double esp, double phi0, double g) {
double t_0 = (-0.5 * ((double) M_PI)) - (y / esp);
double t_1 = (sin(phi0) * cos(t_0)) - (cos(phi0) * sin(t_0));
double tmp;
if ((fabs(g) > 0.0) || (fabs(t_1) > 0.0)) {
tmp = atan2(g, t_1);
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double y, double esp, double phi0, double g) {
double t_0 = (-0.5 * Math.PI) - (y / esp);
double t_1 = (Math.sin(phi0) * Math.cos(t_0)) - (Math.cos(phi0) * Math.sin(t_0));
double tmp;
if ((Math.abs(g) > 0.0) || (Math.abs(t_1) > 0.0)) {
tmp = Math.atan2(g, t_1);
} else {
tmp = 0.0;
}
return tmp;
}
def code(y, esp, phi0, g): t_0 = (-0.5 * math.pi) - (y / esp) t_1 = (math.sin(phi0) * math.cos(t_0)) - (math.cos(phi0) * math.sin(t_0)) tmp = 0 if (math.fabs(g) > 0.0) or (math.fabs(t_1) > 0.0): tmp = math.atan2(g, t_1) else: tmp = 0.0 return tmp
function code(y, esp, phi0, g) t_0 = Float64(Float64(-0.5 * pi) - Float64(y / esp)) t_1 = Float64(Float64(sin(phi0) * cos(t_0)) - Float64(cos(phi0) * sin(t_0))) tmp = 0.0 if ((abs(g) > 0.0) || (abs(t_1) > 0.0)) tmp = atan(g, t_1); else tmp = 0.0; end return tmp end
function tmp_2 = code(y, esp, phi0, g) t_0 = (-0.5 * pi) - (y / esp); t_1 = (sin(phi0) * cos(t_0)) - (cos(phi0) * sin(t_0)); tmp = 0.0; if ((abs(g) > 0.0) || (abs(t_1) > 0.0)) tmp = atan2(g, t_1); else tmp = 0.0; end tmp_2 = tmp; end
code[y_, esp_, phi0_, g_] := Block[{t$95$0 = N[(N[(-1/2 * Pi), $MachinePrecision] - N[(y / esp), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sin[phi0], $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi0], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[Greater[N[Abs[g], $MachinePrecision], 0], Greater[N[Abs[t$95$1], $MachinePrecision], 0]], N[ArcTan[g / t$95$1], $MachinePrecision], 0]]]
\begin{array}{l}
t_0 := \frac{-1}{2} \cdot \pi - \frac{y}{esp}\\
t_1 := \sin phi0 \cdot \cos t\_0 - \cos phi0 \cdot \sin t\_0\\
\mathbf{if}\;\left|g\right| > 0 \lor \left|t\_1\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
Initial program 74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lift-+.f64N/A
add-flipN/A
associate-+l-N/A
sin-diffN/A
lower--.f64N/A
Applied rewrites74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lift-+.f64N/A
add-flipN/A
associate-+l-N/A
sin-diffN/A
lower--.f64N/A
Applied rewrites74.8%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-/.f64N/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6474.8%
Applied rewrites74.8%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-/.f64N/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6474.8%
Applied rewrites74.8%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-/.f64N/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6474.8%
Applied rewrites74.8%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-/.f64N/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6474.7%
Applied rewrites74.7%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
add-sound-/N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
add-sound-/N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
add-sound-/N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
add-sound-/N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift--.f64N/A
sub-flipN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mul-1-negN/A
distribute-neg-outN/A
lift-*.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
sub-negate-revN/A
lower--.f6474.7%
Applied rewrites74.7%
lift--.f64N/A
sub-flipN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mul-1-negN/A
distribute-neg-outN/A
lift-*.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
sub-negate-revN/A
lower--.f6474.7%
Applied rewrites74.7%
lift--.f64N/A
sub-flipN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mul-1-negN/A
distribute-neg-outN/A
lift-*.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
sub-negate-revN/A
lower--.f6474.7%
Applied rewrites74.7%
lift--.f64N/A
sub-flipN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mul-1-negN/A
distribute-neg-outN/A
lift-*.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
sub-negate-revN/A
lower--.f6474.8%
Applied rewrites74.8%
(FPCore (y esp phi0 g)
:precision binary64
(let* ((t_0
(-
(* (sin (+ (/ (- y) esp) (* 1/2 PI))) (cos phi0))
(* (sin (/ y esp)) (sin phi0)))))
(if (or (> (fabs g) 0) (> (fabs t_0) 0)) (atan2 g t_0) 0)))double code(double y, double esp, double phi0, double g) {
double t_0 = (sin(((-y / esp) + (0.5 * ((double) M_PI)))) * cos(phi0)) - (sin((y / esp)) * sin(phi0));
double tmp;
if ((fabs(g) > 0.0) || (fabs(t_0) > 0.0)) {
tmp = atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double y, double esp, double phi0, double g) {
double t_0 = (Math.sin(((-y / esp) + (0.5 * Math.PI))) * Math.cos(phi0)) - (Math.sin((y / esp)) * Math.sin(phi0));
double tmp;
if ((Math.abs(g) > 0.0) || (Math.abs(t_0) > 0.0)) {
tmp = Math.atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(y, esp, phi0, g): t_0 = (math.sin(((-y / esp) + (0.5 * math.pi))) * math.cos(phi0)) - (math.sin((y / esp)) * math.sin(phi0)) tmp = 0 if (math.fabs(g) > 0.0) or (math.fabs(t_0) > 0.0): tmp = math.atan2(g, t_0) else: tmp = 0.0 return tmp
function code(y, esp, phi0, g) t_0 = Float64(Float64(sin(Float64(Float64(Float64(-y) / esp) + Float64(0.5 * pi))) * cos(phi0)) - Float64(sin(Float64(y / esp)) * sin(phi0))) tmp = 0.0 if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan(g, t_0); else tmp = 0.0; end return tmp end
function tmp_2 = code(y, esp, phi0, g) t_0 = (sin(((-y / esp) + (0.5 * pi))) * cos(phi0)) - (sin((y / esp)) * sin(phi0)); tmp = 0.0; if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan2(g, t_0); else tmp = 0.0; end tmp_2 = tmp; end
code[y_, esp_, phi0_, g_] := Block[{t$95$0 = N[(N[(N[Sin[N[(N[((-y) / esp), $MachinePrecision] + N[(1/2 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[phi0], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[(y / esp), $MachinePrecision]], $MachinePrecision] * N[Sin[phi0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[Greater[N[Abs[g], $MachinePrecision], 0], Greater[N[Abs[t$95$0], $MachinePrecision], 0]], N[ArcTan[g / t$95$0], $MachinePrecision], 0]]
\begin{array}{l}
t_0 := \sin \left(\frac{-y}{esp} + \frac{1}{2} \cdot \pi\right) \cdot \cos phi0 - \sin \left(\frac{y}{esp}\right) \cdot \sin phi0\\
\mathbf{if}\;\left|g\right| > 0 \lor \left|t\_0\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
Initial program 74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval74.4%
Applied rewrites74.4%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-evalN/A
metadata-eval66.3%
Applied rewrites66.3%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6466.3%
Applied rewrites66.3%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6466.1%
Applied rewrites66.1%
lift-sin.f64N/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
mult-flipN/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
cos-sumN/A
cos-neg-revN/A
lift-neg.f64N/A
Applied rewrites66.1%
lift-sin.f64N/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
mult-flipN/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
cos-sumN/A
cos-neg-revN/A
lift-neg.f64N/A
Applied rewrites74.7%
lift-cos.f64N/A
cos-neg-revN/A
mul-1-negN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
sin-+PI/2-revN/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
distribute-frac-neg2N/A
lift-/.f64N/A
div-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
mult-flip-revN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lower-sin.f64N/A
Applied rewrites74.7%
lift-cos.f64N/A
cos-neg-revN/A
mul-1-negN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
sin-+PI/2-revN/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
distribute-frac-neg2N/A
lift-/.f64N/A
div-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
mult-flip-revN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lower-sin.f64N/A
Applied rewrites74.6%
(FPCore (y esp phi0 g) :precision binary64 (let* ((t_0 (cos (+ phi0 (* (/ 1 esp) y))))) (if (or (> (fabs g) 0) (> (fabs t_0) 0)) (atan2 g t_0) 0)))
double code(double y, double esp, double phi0, double g) {
double t_0 = cos((phi0 + ((1.0 / esp) * y)));
double tmp;
if ((fabs(g) > 0.0) || (fabs(t_0) > 0.0)) {
tmp = atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(y, esp, phi0, g)
use fmin_fmax_functions
real(8), intent (in) :: y
real(8), intent (in) :: esp
real(8), intent (in) :: phi0
real(8), intent (in) :: g
real(8) :: t_0
real(8) :: tmp
t_0 = cos((phi0 + ((1.0d0 / esp) * y)))
if ((abs(g) > 0.0d0) .or. (abs(t_0) > 0.0d0)) then
tmp = atan2(g, t_0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double y, double esp, double phi0, double g) {
double t_0 = Math.cos((phi0 + ((1.0 / esp) * y)));
double tmp;
if ((Math.abs(g) > 0.0) || (Math.abs(t_0) > 0.0)) {
tmp = Math.atan2(g, t_0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(y, esp, phi0, g): t_0 = math.cos((phi0 + ((1.0 / esp) * y))) tmp = 0 if (math.fabs(g) > 0.0) or (math.fabs(t_0) > 0.0): tmp = math.atan2(g, t_0) else: tmp = 0.0 return tmp
function code(y, esp, phi0, g) t_0 = cos(Float64(phi0 + Float64(Float64(1.0 / esp) * y))) tmp = 0.0 if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan(g, t_0); else tmp = 0.0; end return tmp end
function tmp_2 = code(y, esp, phi0, g) t_0 = cos((phi0 + ((1.0 / esp) * y))); tmp = 0.0; if ((abs(g) > 0.0) || (abs(t_0) > 0.0)) tmp = atan2(g, t_0); else tmp = 0.0; end tmp_2 = tmp; end
code[y_, esp_, phi0_, g_] := Block[{t$95$0 = N[Cos[N[(phi0 + N[(N[(1 / esp), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[Greater[N[Abs[g], $MachinePrecision], 0], Greater[N[Abs[t$95$0], $MachinePrecision], 0]], N[ArcTan[g / t$95$0], $MachinePrecision], 0]]
\begin{array}{l}
t_0 := \cos \left(phi0 + \frac{1}{esp} \cdot y\right)\\
\mathbf{if}\;\left|g\right| > 0 \lor \left|t\_0\right| > 0:\\
\;\;\;\;\tan^{-1}_* \frac{g}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
Initial program 74.4%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
add-sound-/N/A
lower-/.f6474.4%
Applied rewrites74.4%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
add-sound-/N/A
lower-/.f6474.4%
Applied rewrites74.4%
herbie shell --seed 2025326 -o generate:taylor -o generate:evaluate
(FPCore (y esp phi0 g)
:name "spherical-inv-longitude"
:precision binary64
:pre (> esp 0)
(if (or (> (fabs g) 0) (> (fabs (cos (+ phi0 (/ y esp)))) 0)) (atan2 g (cos (+ phi0 (/ y esp)))) 0))