
(FPCore (r a b) :precision binary64 (* r (/ (sin b) (cos (+ a b)))))
double code(double r, double a, double b) {
return r * (sin(b) / cos((a + b)));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * (sin(b) / cos((a + b)))
end function
public static double code(double r, double a, double b) {
return r * (Math.sin(b) / Math.cos((a + b)));
}
def code(r, a, b): return r * (math.sin(b) / math.cos((a + b)))
function code(r, a, b) return Float64(r * Float64(sin(b) / cos(Float64(a + b)))) end
function tmp = code(r, a, b) tmp = r * (sin(b) / cos((a + b))); end
code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\cos \left(a + b\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (r a b) :precision binary64 (* r (/ (sin b) (cos (+ a b)))))
double code(double r, double a, double b) {
return r * (sin(b) / cos((a + b)));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * (sin(b) / cos((a + b)))
end function
public static double code(double r, double a, double b) {
return r * (Math.sin(b) / Math.cos((a + b)));
}
def code(r, a, b): return r * (math.sin(b) / math.cos((a + b)))
function code(r, a, b) return Float64(r * Float64(sin(b) / cos(Float64(a + b)))) end
function tmp = code(r, a, b) tmp = r * (sin(b) / cos((a + b))); end
code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\cos \left(a + b\right)}
\end{array}
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (fma (cos b) (cos a) (* (sin b) (- 0.0 (sin a))))))
double code(double r, double a, double b) {
return (r * sin(b)) / fma(cos(b), cos(a), (sin(b) * (0.0 - sin(a))));
}
function code(r, a, b) return Float64(Float64(r * sin(b)) / fma(cos(b), cos(a), Float64(sin(b) * Float64(0.0 - sin(a))))) end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision] + N[(N[Sin[b], $MachinePrecision] * N[(0.0 - N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \sin b \cdot \left(0 - \sin a\right)\right)}
\end{array}
Initial program 78.5%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f6478.5%
Simplified78.5%
cos-sumN/A
fmm-defN/A
*-commutativeN/A
fma-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
cos-lowering-cos.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
neg-sub0N/A
--lowering--.f64N/A
sin-lowering-sin.f6499.6%
Applied egg-rr99.6%
*-commutativeN/A
sub0-negN/A
distribute-lft-neg-outN/A
neg-lowering-neg.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (- (* (cos b) (cos a)) (* (sin b) (sin a)))))
double code(double r, double a, double b) {
return (r * sin(b)) / ((cos(b) * cos(a)) - (sin(b) * sin(a)));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r * sin(b)) / ((cos(b) * cos(a)) - (sin(b) * sin(a)))
end function
public static double code(double r, double a, double b) {
return (r * Math.sin(b)) / ((Math.cos(b) * Math.cos(a)) - (Math.sin(b) * Math.sin(a)));
}
def code(r, a, b): return (r * math.sin(b)) / ((math.cos(b) * math.cos(a)) - (math.sin(b) * math.sin(a)))
function code(r, a, b) return Float64(Float64(r * sin(b)) / Float64(Float64(cos(b) * cos(a)) - Float64(sin(b) * sin(a)))) end
function tmp = code(r, a, b) tmp = (r * sin(b)) / ((cos(b) * cos(a)) - (sin(b) * sin(a))); end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\cos b \cdot \cos a - \sin b \cdot \sin a}
\end{array}
Initial program 78.5%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f6478.5%
Simplified78.5%
cos-sumN/A
*-commutativeN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (r a b) :precision binary64 (* r (/ (sin b) (- (* (cos b) (cos a)) (* (sin b) (sin a))))))
double code(double r, double a, double b) {
return r * (sin(b) / ((cos(b) * cos(a)) - (sin(b) * sin(a))));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * (sin(b) / ((cos(b) * cos(a)) - (sin(b) * sin(a))))
end function
public static double code(double r, double a, double b) {
return r * (Math.sin(b) / ((Math.cos(b) * Math.cos(a)) - (Math.sin(b) * Math.sin(a))));
}
def code(r, a, b): return r * (math.sin(b) / ((math.cos(b) * math.cos(a)) - (math.sin(b) * math.sin(a))))
function code(r, a, b) return Float64(r * Float64(sin(b) / Float64(Float64(cos(b) * cos(a)) - Float64(sin(b) * sin(a))))) end
function tmp = code(r, a, b) tmp = r * (sin(b) / ((cos(b) * cos(a)) - (sin(b) * sin(a)))); end
code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \sin a}
\end{array}
Initial program 78.5%
cos-sumN/A
*-commutativeN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (r a b)
:precision binary64
(let* ((t_0 (* r (sin b))))
(if (<= a -6.8e-5)
(* r (/ (sin b) (cos a)))
(if (<= a 2.3e+15) (/ t_0 (cos b)) (/ t_0 (cos a))))))
double code(double r, double a, double b) {
double t_0 = r * sin(b);
double tmp;
if (a <= -6.8e-5) {
tmp = r * (sin(b) / cos(a));
} else if (a <= 2.3e+15) {
tmp = t_0 / cos(b);
} else {
tmp = t_0 / cos(a);
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = r * sin(b)
if (a <= (-6.8d-5)) then
tmp = r * (sin(b) / cos(a))
else if (a <= 2.3d+15) then
tmp = t_0 / cos(b)
else
tmp = t_0 / cos(a)
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = r * Math.sin(b);
double tmp;
if (a <= -6.8e-5) {
tmp = r * (Math.sin(b) / Math.cos(a));
} else if (a <= 2.3e+15) {
tmp = t_0 / Math.cos(b);
} else {
tmp = t_0 / Math.cos(a);
}
return tmp;
}
def code(r, a, b): t_0 = r * math.sin(b) tmp = 0 if a <= -6.8e-5: tmp = r * (math.sin(b) / math.cos(a)) elif a <= 2.3e+15: tmp = t_0 / math.cos(b) else: tmp = t_0 / math.cos(a) return tmp
function code(r, a, b) t_0 = Float64(r * sin(b)) tmp = 0.0 if (a <= -6.8e-5) tmp = Float64(r * Float64(sin(b) / cos(a))); elseif (a <= 2.3e+15) tmp = Float64(t_0 / cos(b)); else tmp = Float64(t_0 / cos(a)); end return tmp end
function tmp_2 = code(r, a, b) t_0 = r * sin(b); tmp = 0.0; if (a <= -6.8e-5) tmp = r * (sin(b) / cos(a)); elseif (a <= 2.3e+15) tmp = t_0 / cos(b); else tmp = t_0 / cos(a); end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6.8e-5], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e+15], N[(t$95$0 / N[Cos[b], $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[Cos[a], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \sin b\\
\mathbf{if}\;a \leq -6.8 \cdot 10^{-5}:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+15}:\\
\;\;\;\;\frac{t\_0}{\cos b}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\cos a}\\
\end{array}
\end{array}
if a < -6.7999999999999999e-5Initial program 59.8%
Taylor expanded in b around 0
cos-lowering-cos.f6459.1%
Simplified59.1%
if -6.7999999999999999e-5 < a < 2.3e15Initial program 97.9%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6498.0%
Simplified98.0%
if 2.3e15 < a Initial program 56.9%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f6457.0%
Simplified57.0%
Taylor expanded in b around 0
cos-lowering-cos.f6456.6%
Simplified56.6%
(FPCore (r a b) :precision binary64 (if (<= a -0.000235) (* r (/ (sin b) (cos a))) (if (<= a 2.3e+15) (* r (tan b)) (/ (* r (sin b)) (cos a)))))
double code(double r, double a, double b) {
double tmp;
if (a <= -0.000235) {
tmp = r * (sin(b) / cos(a));
} else if (a <= 2.3e+15) {
tmp = r * tan(b);
} else {
tmp = (r * sin(b)) / cos(a);
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-0.000235d0)) then
tmp = r * (sin(b) / cos(a))
else if (a <= 2.3d+15) then
tmp = r * tan(b)
else
tmp = (r * sin(b)) / cos(a)
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (a <= -0.000235) {
tmp = r * (Math.sin(b) / Math.cos(a));
} else if (a <= 2.3e+15) {
tmp = r * Math.tan(b);
} else {
tmp = (r * Math.sin(b)) / Math.cos(a);
}
return tmp;
}
def code(r, a, b): tmp = 0 if a <= -0.000235: tmp = r * (math.sin(b) / math.cos(a)) elif a <= 2.3e+15: tmp = r * math.tan(b) else: tmp = (r * math.sin(b)) / math.cos(a) return tmp
function code(r, a, b) tmp = 0.0 if (a <= -0.000235) tmp = Float64(r * Float64(sin(b) / cos(a))); elseif (a <= 2.3e+15) tmp = Float64(r * tan(b)); else tmp = Float64(Float64(r * sin(b)) / cos(a)); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (a <= -0.000235) tmp = r * (sin(b) / cos(a)); elseif (a <= 2.3e+15) tmp = r * tan(b); else tmp = (r * sin(b)) / cos(a); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[a, -0.000235], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e+15], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000235:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+15}:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;\frac{r \cdot \sin b}{\cos a}\\
\end{array}
\end{array}
if a < -2.34999999999999993e-4Initial program 59.8%
Taylor expanded in b around 0
cos-lowering-cos.f6459.1%
Simplified59.1%
if -2.34999999999999993e-4 < a < 2.3e15Initial program 97.9%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6498.0%
Simplified98.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6498.0%
Applied egg-rr98.0%
if 2.3e15 < a Initial program 56.9%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f6457.0%
Simplified57.0%
Taylor expanded in b around 0
cos-lowering-cos.f6456.6%
Simplified56.6%
Final simplification78.3%
(FPCore (r a b) :precision binary64 (if (<= a -0.000155) (* r (/ (sin b) (cos a))) (if (<= a 2.3e+15) (* r (tan b)) (/ r (/ (cos a) (sin b))))))
double code(double r, double a, double b) {
double tmp;
if (a <= -0.000155) {
tmp = r * (sin(b) / cos(a));
} else if (a <= 2.3e+15) {
tmp = r * tan(b);
} else {
tmp = r / (cos(a) / sin(b));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-0.000155d0)) then
tmp = r * (sin(b) / cos(a))
else if (a <= 2.3d+15) then
tmp = r * tan(b)
else
tmp = r / (cos(a) / sin(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (a <= -0.000155) {
tmp = r * (Math.sin(b) / Math.cos(a));
} else if (a <= 2.3e+15) {
tmp = r * Math.tan(b);
} else {
tmp = r / (Math.cos(a) / Math.sin(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if a <= -0.000155: tmp = r * (math.sin(b) / math.cos(a)) elif a <= 2.3e+15: tmp = r * math.tan(b) else: tmp = r / (math.cos(a) / math.sin(b)) return tmp
function code(r, a, b) tmp = 0.0 if (a <= -0.000155) tmp = Float64(r * Float64(sin(b) / cos(a))); elseif (a <= 2.3e+15) tmp = Float64(r * tan(b)); else tmp = Float64(r / Float64(cos(a) / sin(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (a <= -0.000155) tmp = r * (sin(b) / cos(a)); elseif (a <= 2.3e+15) tmp = r * tan(b); else tmp = r / (cos(a) / sin(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[a, -0.000155], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e+15], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], N[(r / N[(N[Cos[a], $MachinePrecision] / N[Sin[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000155:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+15}:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{\cos a}{\sin b}}\\
\end{array}
\end{array}
if a < -1.55e-4Initial program 59.8%
Taylor expanded in b around 0
cos-lowering-cos.f6459.1%
Simplified59.1%
if -1.55e-4 < a < 2.3e15Initial program 97.9%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6498.0%
Simplified98.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6498.0%
Applied egg-rr98.0%
if 2.3e15 < a Initial program 56.9%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f6457.0%
Simplified57.0%
Taylor expanded in b around 0
cos-lowering-cos.f6456.6%
Simplified56.6%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6456.6%
Applied egg-rr56.6%
Final simplification78.2%
(FPCore (r a b) :precision binary64 (let* ((t_0 (* r (/ (sin b) (cos a))))) (if (<= a -7.5e-6) t_0 (if (<= a 2.3e+15) (* r (tan b)) t_0))))
double code(double r, double a, double b) {
double t_0 = r * (sin(b) / cos(a));
double tmp;
if (a <= -7.5e-6) {
tmp = t_0;
} else if (a <= 2.3e+15) {
tmp = r * tan(b);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = r * (sin(b) / cos(a))
if (a <= (-7.5d-6)) then
tmp = t_0
else if (a <= 2.3d+15) then
tmp = r * tan(b)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = r * (Math.sin(b) / Math.cos(a));
double tmp;
if (a <= -7.5e-6) {
tmp = t_0;
} else if (a <= 2.3e+15) {
tmp = r * Math.tan(b);
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = r * (math.sin(b) / math.cos(a)) tmp = 0 if a <= -7.5e-6: tmp = t_0 elif a <= 2.3e+15: tmp = r * math.tan(b) else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(r * Float64(sin(b) / cos(a))) tmp = 0.0 if (a <= -7.5e-6) tmp = t_0; elseif (a <= 2.3e+15) tmp = Float64(r * tan(b)); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = r * (sin(b) / cos(a)); tmp = 0.0; if (a <= -7.5e-6) tmp = t_0; elseif (a <= 2.3e+15) tmp = r * tan(b); else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -7.5e-6], t$95$0, If[LessEqual[a, 2.3e+15], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \frac{\sin b}{\cos a}\\
\mathbf{if}\;a \leq -7.5 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+15}:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -7.50000000000000019e-6 or 2.3e15 < a Initial program 58.4%
Taylor expanded in b around 0
cos-lowering-cos.f6457.8%
Simplified57.8%
if -7.50000000000000019e-6 < a < 2.3e15Initial program 97.9%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6498.0%
Simplified98.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6498.0%
Applied egg-rr98.0%
Final simplification78.2%
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ b a))))
double code(double r, double a, double b) {
return (r * sin(b)) / cos((b + a));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (r * sin(b)) / cos((b + a))
end function
public static double code(double r, double a, double b) {
return (r * Math.sin(b)) / Math.cos((b + a));
}
def code(r, a, b): return (r * math.sin(b)) / math.cos((b + a))
function code(r, a, b) return Float64(Float64(r * sin(b)) / cos(Float64(b + a))) end
function tmp = code(r, a, b) tmp = (r * sin(b)) / cos((b + a)); end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\cos \left(b + a\right)}
\end{array}
Initial program 78.5%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f6478.5%
Simplified78.5%
(FPCore (r a b) :precision binary64 (* r (/ (sin b) (cos (+ b a)))))
double code(double r, double a, double b) {
return r * (sin(b) / cos((b + a)));
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * (sin(b) / cos((b + a)))
end function
public static double code(double r, double a, double b) {
return r * (Math.sin(b) / Math.cos((b + a)));
}
def code(r, a, b): return r * (math.sin(b) / math.cos((b + a)))
function code(r, a, b) return Float64(r * Float64(sin(b) / cos(Float64(b + a)))) end
function tmp = code(r, a, b) tmp = r * (sin(b) / cos((b + a))); end
code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\cos \left(b + a\right)}
\end{array}
Initial program 78.5%
Final simplification78.5%
(FPCore (r a b)
:precision binary64
(if (<= b -0.026)
(* r (tan b))
(if (<= b 8.0)
(/
(*
b
(+
r
(*
(* r (* b b))
(+ -0.16666666666666666 (* (* b b) 0.008333333333333333)))))
(cos (+ b a)))
(/ r (/ 1.0 (tan b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -0.026) {
tmp = r * tan(b);
} else if (b <= 8.0) {
tmp = (b * (r + ((r * (b * b)) * (-0.16666666666666666 + ((b * b) * 0.008333333333333333))))) / cos((b + a));
} else {
tmp = r / (1.0 / tan(b));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-0.026d0)) then
tmp = r * tan(b)
else if (b <= 8.0d0) then
tmp = (b * (r + ((r * (b * b)) * ((-0.16666666666666666d0) + ((b * b) * 0.008333333333333333d0))))) / cos((b + a))
else
tmp = r / (1.0d0 / tan(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -0.026) {
tmp = r * Math.tan(b);
} else if (b <= 8.0) {
tmp = (b * (r + ((r * (b * b)) * (-0.16666666666666666 + ((b * b) * 0.008333333333333333))))) / Math.cos((b + a));
} else {
tmp = r / (1.0 / Math.tan(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -0.026: tmp = r * math.tan(b) elif b <= 8.0: tmp = (b * (r + ((r * (b * b)) * (-0.16666666666666666 + ((b * b) * 0.008333333333333333))))) / math.cos((b + a)) else: tmp = r / (1.0 / math.tan(b)) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -0.026) tmp = Float64(r * tan(b)); elseif (b <= 8.0) tmp = Float64(Float64(b * Float64(r + Float64(Float64(r * Float64(b * b)) * Float64(-0.16666666666666666 + Float64(Float64(b * b) * 0.008333333333333333))))) / cos(Float64(b + a))); else tmp = Float64(r / Float64(1.0 / tan(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -0.026) tmp = r * tan(b); elseif (b <= 8.0) tmp = (b * (r + ((r * (b * b)) * (-0.16666666666666666 + ((b * b) * 0.008333333333333333))))) / cos((b + a)); else tmp = r / (1.0 / tan(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -0.026], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.0], N[(N[(b * N[(r + N[(N[(r * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(b * b), $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(r / N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.026:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 8:\\
\;\;\;\;\frac{b \cdot \left(r + \left(r \cdot \left(b \cdot b\right)\right) \cdot \left(-0.16666666666666666 + \left(b \cdot b\right) \cdot 0.008333333333333333\right)\right)}{\cos \left(b + a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\end{array}
if b < -0.0259999999999999988Initial program 63.7%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6462.3%
Simplified62.3%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6462.3%
Applied egg-rr62.3%
if -0.0259999999999999988 < b < 8Initial program 98.3%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f6498.4%
Simplified98.4%
Taylor expanded in b around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
Simplified98.3%
if 8 < b Initial program 54.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6452.9%
Simplified52.9%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
/-lowering-/.f64N/A
quot-tanN/A
tan-lowering-tan.f6452.9%
Applied egg-rr52.9%
Final simplification77.8%
(FPCore (r a b)
:precision binary64
(if (<= b -0.032)
(* r (tan b))
(if (<= b 8.0)
(*
r
(/
(*
b
(+
1.0
(*
(* b b)
(+ -0.16666666666666666 (* (* b b) 0.008333333333333333)))))
(cos (+ b a))))
(/ r (/ 1.0 (tan b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -0.032) {
tmp = r * tan(b);
} else if (b <= 8.0) {
tmp = r * ((b * (1.0 + ((b * b) * (-0.16666666666666666 + ((b * b) * 0.008333333333333333))))) / cos((b + a)));
} else {
tmp = r / (1.0 / tan(b));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-0.032d0)) then
tmp = r * tan(b)
else if (b <= 8.0d0) then
tmp = r * ((b * (1.0d0 + ((b * b) * ((-0.16666666666666666d0) + ((b * b) * 0.008333333333333333d0))))) / cos((b + a)))
else
tmp = r / (1.0d0 / tan(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -0.032) {
tmp = r * Math.tan(b);
} else if (b <= 8.0) {
tmp = r * ((b * (1.0 + ((b * b) * (-0.16666666666666666 + ((b * b) * 0.008333333333333333))))) / Math.cos((b + a)));
} else {
tmp = r / (1.0 / Math.tan(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -0.032: tmp = r * math.tan(b) elif b <= 8.0: tmp = r * ((b * (1.0 + ((b * b) * (-0.16666666666666666 + ((b * b) * 0.008333333333333333))))) / math.cos((b + a))) else: tmp = r / (1.0 / math.tan(b)) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -0.032) tmp = Float64(r * tan(b)); elseif (b <= 8.0) tmp = Float64(r * Float64(Float64(b * Float64(1.0 + Float64(Float64(b * b) * Float64(-0.16666666666666666 + Float64(Float64(b * b) * 0.008333333333333333))))) / cos(Float64(b + a)))); else tmp = Float64(r / Float64(1.0 / tan(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -0.032) tmp = r * tan(b); elseif (b <= 8.0) tmp = r * ((b * (1.0 + ((b * b) * (-0.16666666666666666 + ((b * b) * 0.008333333333333333))))) / cos((b + a))); else tmp = r / (1.0 / tan(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -0.032], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.0], N[(r * N[(N[(b * N[(1.0 + N[(N[(b * b), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(b * b), $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r / N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.032:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 8:\\
\;\;\;\;r \cdot \frac{b \cdot \left(1 + \left(b \cdot b\right) \cdot \left(-0.16666666666666666 + \left(b \cdot b\right) \cdot 0.008333333333333333\right)\right)}{\cos \left(b + a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\end{array}
if b < -0.032000000000000001Initial program 63.7%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6462.3%
Simplified62.3%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6462.3%
Applied egg-rr62.3%
if -0.032000000000000001 < b < 8Initial program 98.3%
Taylor expanded in b around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6498.3%
Simplified98.3%
if 8 < b Initial program 54.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6452.9%
Simplified52.9%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
/-lowering-/.f64N/A
quot-tanN/A
tan-lowering-tan.f6452.9%
Applied egg-rr52.9%
Final simplification77.8%
(FPCore (r a b)
:precision binary64
(if (<= b -0.006)
(* r (tan b))
(if (<= b 6.6e+18)
(/ (* r (* b (+ 1.0 (* (* b b) -0.16666666666666666)))) (cos (+ b a)))
(/ r (/ 1.0 (tan b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -0.006) {
tmp = r * tan(b);
} else if (b <= 6.6e+18) {
tmp = (r * (b * (1.0 + ((b * b) * -0.16666666666666666)))) / cos((b + a));
} else {
tmp = r / (1.0 / tan(b));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-0.006d0)) then
tmp = r * tan(b)
else if (b <= 6.6d+18) then
tmp = (r * (b * (1.0d0 + ((b * b) * (-0.16666666666666666d0))))) / cos((b + a))
else
tmp = r / (1.0d0 / tan(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -0.006) {
tmp = r * Math.tan(b);
} else if (b <= 6.6e+18) {
tmp = (r * (b * (1.0 + ((b * b) * -0.16666666666666666)))) / Math.cos((b + a));
} else {
tmp = r / (1.0 / Math.tan(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -0.006: tmp = r * math.tan(b) elif b <= 6.6e+18: tmp = (r * (b * (1.0 + ((b * b) * -0.16666666666666666)))) / math.cos((b + a)) else: tmp = r / (1.0 / math.tan(b)) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -0.006) tmp = Float64(r * tan(b)); elseif (b <= 6.6e+18) tmp = Float64(Float64(r * Float64(b * Float64(1.0 + Float64(Float64(b * b) * -0.16666666666666666)))) / cos(Float64(b + a))); else tmp = Float64(r / Float64(1.0 / tan(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -0.006) tmp = r * tan(b); elseif (b <= 6.6e+18) tmp = (r * (b * (1.0 + ((b * b) * -0.16666666666666666)))) / cos((b + a)); else tmp = r / (1.0 / tan(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -0.006], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.6e+18], N[(N[(r * N[(b * N[(1.0 + N[(N[(b * b), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(r / N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.006:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 6.6 \cdot 10^{+18}:\\
\;\;\;\;\frac{r \cdot \left(b \cdot \left(1 + \left(b \cdot b\right) \cdot -0.16666666666666666\right)\right)}{\cos \left(b + a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\end{array}
if b < -0.0060000000000000001Initial program 63.7%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6462.3%
Simplified62.3%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6462.3%
Applied egg-rr62.3%
if -0.0060000000000000001 < b < 6.6e18Initial program 97.7%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f6497.8%
Simplified97.8%
Taylor expanded in b around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6497.5%
Simplified97.5%
if 6.6e18 < b Initial program 54.5%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6453.7%
Simplified53.7%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
/-lowering-/.f64N/A
quot-tanN/A
tan-lowering-tan.f6453.7%
Applied egg-rr53.7%
Final simplification77.8%
(FPCore (r a b)
:precision binary64
(if (<= b -0.0068)
(* r (tan b))
(if (<= b 6.6e+18)
(* r (/ (* b (+ 1.0 (* (* b b) -0.16666666666666666))) (cos (+ b a))))
(/ r (/ 1.0 (tan b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -0.0068) {
tmp = r * tan(b);
} else if (b <= 6.6e+18) {
tmp = r * ((b * (1.0 + ((b * b) * -0.16666666666666666))) / cos((b + a)));
} else {
tmp = r / (1.0 / tan(b));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-0.0068d0)) then
tmp = r * tan(b)
else if (b <= 6.6d+18) then
tmp = r * ((b * (1.0d0 + ((b * b) * (-0.16666666666666666d0)))) / cos((b + a)))
else
tmp = r / (1.0d0 / tan(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -0.0068) {
tmp = r * Math.tan(b);
} else if (b <= 6.6e+18) {
tmp = r * ((b * (1.0 + ((b * b) * -0.16666666666666666))) / Math.cos((b + a)));
} else {
tmp = r / (1.0 / Math.tan(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -0.0068: tmp = r * math.tan(b) elif b <= 6.6e+18: tmp = r * ((b * (1.0 + ((b * b) * -0.16666666666666666))) / math.cos((b + a))) else: tmp = r / (1.0 / math.tan(b)) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -0.0068) tmp = Float64(r * tan(b)); elseif (b <= 6.6e+18) tmp = Float64(r * Float64(Float64(b * Float64(1.0 + Float64(Float64(b * b) * -0.16666666666666666))) / cos(Float64(b + a)))); else tmp = Float64(r / Float64(1.0 / tan(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -0.0068) tmp = r * tan(b); elseif (b <= 6.6e+18) tmp = r * ((b * (1.0 + ((b * b) * -0.16666666666666666))) / cos((b + a))); else tmp = r / (1.0 / tan(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -0.0068], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.6e+18], N[(r * N[(N[(b * N[(1.0 + N[(N[(b * b), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r / N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0068:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 6.6 \cdot 10^{+18}:\\
\;\;\;\;r \cdot \frac{b \cdot \left(1 + \left(b \cdot b\right) \cdot -0.16666666666666666\right)}{\cos \left(b + a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\end{array}
if b < -0.00679999999999999962Initial program 63.7%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6462.3%
Simplified62.3%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6462.3%
Applied egg-rr62.3%
if -0.00679999999999999962 < b < 6.6e18Initial program 97.7%
Taylor expanded in b around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6497.5%
Simplified97.5%
if 6.6e18 < b Initial program 54.5%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6453.7%
Simplified53.7%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
/-lowering-/.f64N/A
quot-tanN/A
tan-lowering-tan.f6453.7%
Applied egg-rr53.7%
Final simplification77.8%
(FPCore (r a b) :precision binary64 (if (<= b -4.6e-5) (* r (tan b)) (if (<= b 8.0) (/ (* r b) (cos a)) (/ r (/ 1.0 (tan b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -4.6e-5) {
tmp = r * tan(b);
} else if (b <= 8.0) {
tmp = (r * b) / cos(a);
} else {
tmp = r / (1.0 / tan(b));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-4.6d-5)) then
tmp = r * tan(b)
else if (b <= 8.0d0) then
tmp = (r * b) / cos(a)
else
tmp = r / (1.0d0 / tan(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -4.6e-5) {
tmp = r * Math.tan(b);
} else if (b <= 8.0) {
tmp = (r * b) / Math.cos(a);
} else {
tmp = r / (1.0 / Math.tan(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -4.6e-5: tmp = r * math.tan(b) elif b <= 8.0: tmp = (r * b) / math.cos(a) else: tmp = r / (1.0 / math.tan(b)) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -4.6e-5) tmp = Float64(r * tan(b)); elseif (b <= 8.0) tmp = Float64(Float64(r * b) / cos(a)); else tmp = Float64(r / Float64(1.0 / tan(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -4.6e-5) tmp = r * tan(b); elseif (b <= 8.0) tmp = (r * b) / cos(a); else tmp = r / (1.0 / tan(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -4.6e-5], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.0], N[(N[(r * b), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision], N[(r / N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.6 \cdot 10^{-5}:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 8:\\
\;\;\;\;\frac{r \cdot b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\end{array}
if b < -4.6e-5Initial program 63.8%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6462.0%
Simplified62.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6462.0%
Applied egg-rr62.0%
if -4.6e-5 < b < 8Initial program 98.8%
Taylor expanded in b around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f6498.9%
Simplified98.9%
if 8 < b Initial program 54.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6452.9%
Simplified52.9%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
/-lowering-/.f64N/A
quot-tanN/A
tan-lowering-tan.f6452.9%
Applied egg-rr52.9%
Final simplification77.7%
(FPCore (r a b) :precision binary64 (if (<= b -3e-5) (* r (tan b)) (if (<= b 8.0) (* r (/ b (cos a))) (/ r (/ 1.0 (tan b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -3e-5) {
tmp = r * tan(b);
} else if (b <= 8.0) {
tmp = r * (b / cos(a));
} else {
tmp = r / (1.0 / tan(b));
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-3d-5)) then
tmp = r * tan(b)
else if (b <= 8.0d0) then
tmp = r * (b / cos(a))
else
tmp = r / (1.0d0 / tan(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -3e-5) {
tmp = r * Math.tan(b);
} else if (b <= 8.0) {
tmp = r * (b / Math.cos(a));
} else {
tmp = r / (1.0 / Math.tan(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -3e-5: tmp = r * math.tan(b) elif b <= 8.0: tmp = r * (b / math.cos(a)) else: tmp = r / (1.0 / math.tan(b)) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -3e-5) tmp = Float64(r * tan(b)); elseif (b <= 8.0) tmp = Float64(r * Float64(b / cos(a))); else tmp = Float64(r / Float64(1.0 / tan(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -3e-5) tmp = r * tan(b); elseif (b <= 8.0) tmp = r * (b / cos(a)); else tmp = r / (1.0 / tan(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -3e-5], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.0], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r / N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3 \cdot 10^{-5}:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 8:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\end{array}
if b < -3.00000000000000008e-5Initial program 63.8%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6462.0%
Simplified62.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6462.0%
Applied egg-rr62.0%
if -3.00000000000000008e-5 < b < 8Initial program 98.8%
Taylor expanded in b around 0
/-lowering-/.f64N/A
cos-lowering-cos.f6498.8%
Simplified98.8%
if 8 < b Initial program 54.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6452.9%
Simplified52.9%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
/-lowering-/.f64N/A
quot-tanN/A
tan-lowering-tan.f6452.9%
Applied egg-rr52.9%
Final simplification77.7%
(FPCore (r a b) :precision binary64 (let* ((t_0 (* r (tan b)))) (if (<= b -1.52e-5) t_0 (if (<= b 8.0) (* r (/ b (cos a))) t_0))))
double code(double r, double a, double b) {
double t_0 = r * tan(b);
double tmp;
if (b <= -1.52e-5) {
tmp = t_0;
} else if (b <= 8.0) {
tmp = r * (b / cos(a));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = r * tan(b)
if (b <= (-1.52d-5)) then
tmp = t_0
else if (b <= 8.0d0) then
tmp = r * (b / cos(a))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = r * Math.tan(b);
double tmp;
if (b <= -1.52e-5) {
tmp = t_0;
} else if (b <= 8.0) {
tmp = r * (b / Math.cos(a));
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = r * math.tan(b) tmp = 0 if b <= -1.52e-5: tmp = t_0 elif b <= 8.0: tmp = r * (b / math.cos(a)) else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(r * tan(b)) tmp = 0.0 if (b <= -1.52e-5) tmp = t_0; elseif (b <= 8.0) tmp = Float64(r * Float64(b / cos(a))); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = r * tan(b); tmp = 0.0; if (b <= -1.52e-5) tmp = t_0; elseif (b <= 8.0) tmp = r * (b / cos(a)); else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.52e-5], t$95$0, If[LessEqual[b, 8.0], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \tan b\\
\mathbf{if}\;b \leq -1.52 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 8:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -1.52e-5 or 8 < b Initial program 59.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6457.5%
Simplified57.5%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6457.5%
Applied egg-rr57.5%
if -1.52e-5 < b < 8Initial program 98.8%
Taylor expanded in b around 0
/-lowering-/.f64N/A
cos-lowering-cos.f6498.8%
Simplified98.8%
Final simplification77.7%
(FPCore (r a b) :precision binary64 (* r (tan b)))
double code(double r, double a, double b) {
return r * tan(b);
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * tan(b)
end function
public static double code(double r, double a, double b) {
return r * Math.tan(b);
}
def code(r, a, b): return r * math.tan(b)
function code(r, a, b) return Float64(r * tan(b)) end
function tmp = code(r, a, b) tmp = r * tan(b); end
code[r_, a_, b_] := N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \tan b
\end{array}
Initial program 78.5%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6461.1%
Simplified61.1%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
quot-tanN/A
tan-lowering-tan.f6461.1%
Applied egg-rr61.1%
Final simplification61.1%
(FPCore (r a b) :precision binary64 (* r (sin b)))
double code(double r, double a, double b) {
return r * sin(b);
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * sin(b)
end function
public static double code(double r, double a, double b) {
return r * Math.sin(b);
}
def code(r, a, b): return r * math.sin(b)
function code(r, a, b) return Float64(r * sin(b)) end
function tmp = code(r, a, b) tmp = r * sin(b); end
code[r_, a_, b_] := N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \sin b
\end{array}
Initial program 78.5%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f6478.5%
Simplified78.5%
Taylor expanded in b around 0
cos-lowering-cos.f6454.1%
Simplified54.1%
Taylor expanded in a around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6437.2%
Simplified37.2%
(FPCore (r a b) :precision binary64 (* r b))
double code(double r, double a, double b) {
return r * b;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = r * b
end function
public static double code(double r, double a, double b) {
return r * b;
}
def code(r, a, b): return r * b
function code(r, a, b) return Float64(r * b) end
function tmp = code(r, a, b) tmp = r * b; end
code[r_, a_, b_] := N[(r * b), $MachinePrecision]
\begin{array}{l}
\\
r \cdot b
\end{array}
Initial program 78.5%
Taylor expanded in b around 0
/-lowering-/.f64N/A
cos-lowering-cos.f6450.6%
Simplified50.6%
Taylor expanded in a around 0
*-commutativeN/A
*-lowering-*.f6433.9%
Simplified33.9%
herbie shell --seed 2024159
(FPCore (r a b)
:name "rsin B (should all be same)"
:precision binary64
(* r (/ (sin b) (cos (+ a b)))))