
(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(Float64(r * 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[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 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(Float64(r * 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[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\end{array}
(FPCore (r a b)
:precision binary64
(*
(/
(sin b)
(fma
(cos b)
(cos a)
(fma (sin a) (- (sin b)) (fma (- (sin a)) (sin b) (* (sin b) (sin a))))))
r))
double code(double r, double a, double b) {
return (sin(b) / fma(cos(b), cos(a), fma(sin(a), -sin(b), fma(-sin(a), sin(b), (sin(b) * sin(a)))))) * r;
}
function code(r, a, b) return Float64(Float64(sin(b) / fma(cos(b), cos(a), fma(sin(a), Float64(-sin(b)), fma(Float64(-sin(a)), sin(b), Float64(sin(b) * sin(a)))))) * r) end
code[r_, a_, b_] := N[(N[(N[Sin[b], $MachinePrecision] / N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision] + N[(N[Sin[a], $MachinePrecision] * (-N[Sin[b], $MachinePrecision]) + N[((-N[Sin[a], $MachinePrecision]) * N[Sin[b], $MachinePrecision] + N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, \mathsf{fma}\left(\sin a, -\sin b, \mathsf{fma}\left(-\sin a, \sin b, \sin b \cdot \sin a\right)\right)\right)} \cdot r
\end{array}
(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}
(FPCore (r a b) :precision binary64 (* r (/ (sin b) (fma (cos b) (cos a) 0.0))))
double code(double r, double a, double b) {
return r * (sin(b) / fma(cos(b), cos(a), 0.0));
}
function code(r, a, b) return Float64(r * Float64(sin(b) / fma(cos(b), cos(a), 0.0))) end
code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision] + 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, 0\right)}
\end{array}
(FPCore (r a b) :precision binary64 (if (or (<= a -8e-5) (not (<= a 0.00075))) (* r (/ (sin b) (cos a))) (* r (/ 1.0 (- (/ 1.0 (tan b)) a)))))
double code(double r, double a, double b) {
double tmp;
if ((a <= -8e-5) || !(a <= 0.00075)) {
tmp = r * (sin(b) / cos(a));
} else {
tmp = r * (1.0 / ((1.0 / tan(b)) - 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 <= (-8d-5)) .or. (.not. (a <= 0.00075d0))) then
tmp = r * (sin(b) / cos(a))
else
tmp = r * (1.0d0 / ((1.0d0 / tan(b)) - a))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if ((a <= -8e-5) || !(a <= 0.00075)) {
tmp = r * (Math.sin(b) / Math.cos(a));
} else {
tmp = r * (1.0 / ((1.0 / Math.tan(b)) - a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (a <= -8e-5) or not (a <= 0.00075): tmp = r * (math.sin(b) / math.cos(a)) else: tmp = r * (1.0 / ((1.0 / math.tan(b)) - a)) return tmp
function code(r, a, b) tmp = 0.0 if ((a <= -8e-5) || !(a <= 0.00075)) tmp = Float64(r * Float64(sin(b) / cos(a))); else tmp = Float64(r * Float64(1.0 / Float64(Float64(1.0 / tan(b)) - a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if ((a <= -8e-5) || ~((a <= 0.00075))) tmp = r * (sin(b) / cos(a)); else tmp = r * (1.0 / ((1.0 / tan(b)) - a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[a, -8e-5], N[Not[LessEqual[a, 0.00075]], $MachinePrecision]], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[(1.0 / N[(N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{-5} \lor \neg \left(a \leq 0.00075\right):\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{1}{\frac{1}{\tan b} - a}\\
\end{array}
\end{array}
(FPCore (r a b)
:precision binary64
(if (<= a -0.000185)
(/ r (/ (cos a) (sin b)))
(if (<= a 0.0006)
(* r (/ 1.0 (- (/ 1.0 (tan b)) a)))
(* r (/ (sin b) (cos a))))))
double code(double r, double a, double b) {
double tmp;
if (a <= -0.000185) {
tmp = r / (cos(a) / sin(b));
} else if (a <= 0.0006) {
tmp = r * (1.0 / ((1.0 / tan(b)) - a));
} 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.000185d0)) then
tmp = r / (cos(a) / sin(b))
else if (a <= 0.0006d0) then
tmp = r * (1.0d0 / ((1.0d0 / tan(b)) - a))
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.000185) {
tmp = r / (Math.cos(a) / Math.sin(b));
} else if (a <= 0.0006) {
tmp = r * (1.0 / ((1.0 / Math.tan(b)) - a));
} else {
tmp = r * (Math.sin(b) / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if a <= -0.000185: tmp = r / (math.cos(a) / math.sin(b)) elif a <= 0.0006: tmp = r * (1.0 / ((1.0 / math.tan(b)) - a)) else: tmp = r * (math.sin(b) / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if (a <= -0.000185) tmp = Float64(r / Float64(cos(a) / sin(b))); elseif (a <= 0.0006) tmp = Float64(r * Float64(1.0 / Float64(Float64(1.0 / tan(b)) - a))); else tmp = Float64(r * Float64(sin(b) / cos(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (a <= -0.000185) tmp = r / (cos(a) / sin(b)); elseif (a <= 0.0006) tmp = r * (1.0 / ((1.0 / tan(b)) - a)); else tmp = r * (sin(b) / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[a, -0.000185], N[(r / N[(N[Cos[a], $MachinePrecision] / N[Sin[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 0.0006], N[(r * N[(1.0 / N[(N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000185:\\
\;\;\;\;\frac{r}{\frac{\cos a}{\sin b}}\\
\mathbf{elif}\;a \leq 0.0006:\\
\;\;\;\;r \cdot \frac{1}{\frac{1}{\tan b} - a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\end{array}
\end{array}
(FPCore (r a b) :precision binary64 (if (<= b -7.6e+15) (/ r (/ (cos b) (sin b))) (if (<= b 2.3e-7) (* b (/ r (cos a))) (* r (/ (sin b) (cos b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -7.6e+15) {
tmp = r / (cos(b) / sin(b));
} else if (b <= 2.3e-7) {
tmp = b * (r / cos(a));
} else {
tmp = r * (sin(b) / cos(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 <= (-7.6d+15)) then
tmp = r / (cos(b) / sin(b))
else if (b <= 2.3d-7) then
tmp = b * (r / cos(a))
else
tmp = r * (sin(b) / cos(b))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -7.6e+15) {
tmp = r / (Math.cos(b) / Math.sin(b));
} else if (b <= 2.3e-7) {
tmp = b * (r / Math.cos(a));
} else {
tmp = r * (Math.sin(b) / Math.cos(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -7.6e+15: tmp = r / (math.cos(b) / math.sin(b)) elif b <= 2.3e-7: tmp = b * (r / math.cos(a)) else: tmp = r * (math.sin(b) / math.cos(b)) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -7.6e+15) tmp = Float64(r / Float64(cos(b) / sin(b))); elseif (b <= 2.3e-7) tmp = Float64(b * Float64(r / cos(a))); else tmp = Float64(r * Float64(sin(b) / cos(b))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -7.6e+15) tmp = r / (cos(b) / sin(b)); elseif (b <= 2.3e-7) tmp = b * (r / cos(a)); else tmp = r * (sin(b) / cos(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -7.6e+15], N[(r / N[(N[Cos[b], $MachinePrecision] / N[Sin[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.3e-7], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.6 \cdot 10^{+15}:\\
\;\;\;\;\frac{r}{\frac{\cos b}{\sin b}}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-7}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos b}\\
\end{array}
\end{array}
(FPCore (r a b) :precision binary64 (* (sin b) (/ r (cos (+ b a)))))
double code(double r, double a, double b) {
return sin(b) * (r / 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 = sin(b) * (r / cos((b + a)))
end function
public static double code(double r, double a, double b) {
return Math.sin(b) * (r / Math.cos((b + a)));
}
def code(r, a, b): return math.sin(b) * (r / math.cos((b + a)))
function code(r, a, b) return Float64(sin(b) * Float64(r / cos(Float64(b + a)))) end
function tmp = code(r, a, b) tmp = sin(b) * (r / cos((b + a))); end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] * N[(r / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin b \cdot \frac{r}{\cos \left(b + a\right)}
\end{array}
(FPCore (r a b)
:precision binary64
(let* ((t_0 (- (/ 1.0 (tan b)) a)))
(if (<= b -1.6e+20)
(/ r t_0)
(if (<= b 2.3e-7) (* b (/ r (cos a))) (* r (/ 1.0 t_0))))))
double code(double r, double a, double b) {
double t_0 = (1.0 / tan(b)) - a;
double tmp;
if (b <= -1.6e+20) {
tmp = r / t_0;
} else if (b <= 2.3e-7) {
tmp = b * (r / cos(a));
} else {
tmp = r * (1.0 / 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 = (1.0d0 / tan(b)) - a
if (b <= (-1.6d+20)) then
tmp = r / t_0
else if (b <= 2.3d-7) then
tmp = b * (r / cos(a))
else
tmp = r * (1.0d0 / t_0)
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (1.0 / Math.tan(b)) - a;
double tmp;
if (b <= -1.6e+20) {
tmp = r / t_0;
} else if (b <= 2.3e-7) {
tmp = b * (r / Math.cos(a));
} else {
tmp = r * (1.0 / t_0);
}
return tmp;
}
def code(r, a, b): t_0 = (1.0 / math.tan(b)) - a tmp = 0 if b <= -1.6e+20: tmp = r / t_0 elif b <= 2.3e-7: tmp = b * (r / math.cos(a)) else: tmp = r * (1.0 / t_0) return tmp
function code(r, a, b) t_0 = Float64(Float64(1.0 / tan(b)) - a) tmp = 0.0 if (b <= -1.6e+20) tmp = Float64(r / t_0); elseif (b <= 2.3e-7) tmp = Float64(b * Float64(r / cos(a))); else tmp = Float64(r * Float64(1.0 / t_0)); end return tmp end
function tmp_2 = code(r, a, b) t_0 = (1.0 / tan(b)) - a; tmp = 0.0; if (b <= -1.6e+20) tmp = r / t_0; elseif (b <= 2.3e-7) tmp = b * (r / cos(a)); else tmp = r * (1.0 / t_0); end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]}, If[LessEqual[b, -1.6e+20], N[(r / t$95$0), $MachinePrecision], If[LessEqual[b, 2.3e-7], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\tan b} - a\\
\mathbf{if}\;b \leq -1.6 \cdot 10^{+20}:\\
\;\;\;\;\frac{r}{t_0}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-7}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{1}{t_0}\\
\end{array}
\end{array}
(FPCore (r a b)
:precision binary64
(let* ((t_0 (- (/ 1.0 (tan b)) a)))
(if (<= b -1.6e+20)
(/ 1.0 (/ t_0 r))
(if (<= b 2.3e-7) (* b (/ r (cos a))) (* r (/ 1.0 t_0))))))
double code(double r, double a, double b) {
double t_0 = (1.0 / tan(b)) - a;
double tmp;
if (b <= -1.6e+20) {
tmp = 1.0 / (t_0 / r);
} else if (b <= 2.3e-7) {
tmp = b * (r / cos(a));
} else {
tmp = r * (1.0 / 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 = (1.0d0 / tan(b)) - a
if (b <= (-1.6d+20)) then
tmp = 1.0d0 / (t_0 / r)
else if (b <= 2.3d-7) then
tmp = b * (r / cos(a))
else
tmp = r * (1.0d0 / t_0)
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (1.0 / Math.tan(b)) - a;
double tmp;
if (b <= -1.6e+20) {
tmp = 1.0 / (t_0 / r);
} else if (b <= 2.3e-7) {
tmp = b * (r / Math.cos(a));
} else {
tmp = r * (1.0 / t_0);
}
return tmp;
}
def code(r, a, b): t_0 = (1.0 / math.tan(b)) - a tmp = 0 if b <= -1.6e+20: tmp = 1.0 / (t_0 / r) elif b <= 2.3e-7: tmp = b * (r / math.cos(a)) else: tmp = r * (1.0 / t_0) return tmp
function code(r, a, b) t_0 = Float64(Float64(1.0 / tan(b)) - a) tmp = 0.0 if (b <= -1.6e+20) tmp = Float64(1.0 / Float64(t_0 / r)); elseif (b <= 2.3e-7) tmp = Float64(b * Float64(r / cos(a))); else tmp = Float64(r * Float64(1.0 / t_0)); end return tmp end
function tmp_2 = code(r, a, b) t_0 = (1.0 / tan(b)) - a; tmp = 0.0; if (b <= -1.6e+20) tmp = 1.0 / (t_0 / r); elseif (b <= 2.3e-7) tmp = b * (r / cos(a)); else tmp = r * (1.0 / t_0); end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]}, If[LessEqual[b, -1.6e+20], N[(1.0 / N[(t$95$0 / r), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.3e-7], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\tan b} - a\\
\mathbf{if}\;b \leq -1.6 \cdot 10^{+20}:\\
\;\;\;\;\frac{1}{\frac{t_0}{r}}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-7}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{1}{t_0}\\
\end{array}
\end{array}
(FPCore (r a b) :precision binary64 (if (or (<= b -1.6e+20) (not (<= b 2.3e-7))) (/ r (- (/ 1.0 (tan b)) a)) (* b (/ r (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -1.6e+20) || !(b <= 2.3e-7)) {
tmp = r / ((1.0 / tan(b)) - a);
} else {
tmp = b * (r / 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 ((b <= (-1.6d+20)) .or. (.not. (b <= 2.3d-7))) then
tmp = r / ((1.0d0 / tan(b)) - a)
else
tmp = b * (r / cos(a))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if ((b <= -1.6e+20) || !(b <= 2.3e-7)) {
tmp = r / ((1.0 / Math.tan(b)) - a);
} else {
tmp = b * (r / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -1.6e+20) or not (b <= 2.3e-7): tmp = r / ((1.0 / math.tan(b)) - a) else: tmp = b * (r / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if ((b <= -1.6e+20) || !(b <= 2.3e-7)) tmp = Float64(r / Float64(Float64(1.0 / tan(b)) - a)); else tmp = Float64(b * Float64(r / cos(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if ((b <= -1.6e+20) || ~((b <= 2.3e-7))) tmp = r / ((1.0 / tan(b)) - a); else tmp = b * (r / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -1.6e+20], N[Not[LessEqual[b, 2.3e-7]], $MachinePrecision]], N[(r / N[(N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.6 \cdot 10^{+20} \lor \neg \left(b \leq 2.3 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{r}{\frac{1}{\tan b} - a}\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\end{array}
\end{array}
(FPCore (r a b) :precision binary64 (if (or (<= b -1.6e+20) (not (<= b 9000.0))) (* (sin b) r) (* r (/ b (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -1.6e+20) || !(b <= 9000.0)) {
tmp = sin(b) * r;
} else {
tmp = r * (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 ((b <= (-1.6d+20)) .or. (.not. (b <= 9000.0d0))) then
tmp = sin(b) * r
else
tmp = r * (b / cos(a))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if ((b <= -1.6e+20) || !(b <= 9000.0)) {
tmp = Math.sin(b) * r;
} else {
tmp = r * (b / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -1.6e+20) or not (b <= 9000.0): tmp = math.sin(b) * r else: tmp = r * (b / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if ((b <= -1.6e+20) || !(b <= 9000.0)) tmp = Float64(sin(b) * r); else tmp = Float64(r * Float64(b / cos(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if ((b <= -1.6e+20) || ~((b <= 9000.0))) tmp = sin(b) * r; else tmp = r * (b / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -1.6e+20], N[Not[LessEqual[b, 9000.0]], $MachinePrecision]], N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.6 \cdot 10^{+20} \lor \neg \left(b \leq 9000\right):\\
\;\;\;\;\sin b \cdot r\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\end{array}
\end{array}
(FPCore (r a b) :precision binary64 (if (or (<= b -1.6e+20) (not (<= b 360000000.0))) (* (sin b) r) (* b (/ r (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -1.6e+20) || !(b <= 360000000.0)) {
tmp = sin(b) * r;
} else {
tmp = b * (r / 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 ((b <= (-1.6d+20)) .or. (.not. (b <= 360000000.0d0))) then
tmp = sin(b) * r
else
tmp = b * (r / cos(a))
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if ((b <= -1.6e+20) || !(b <= 360000000.0)) {
tmp = Math.sin(b) * r;
} else {
tmp = b * (r / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -1.6e+20) or not (b <= 360000000.0): tmp = math.sin(b) * r else: tmp = b * (r / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if ((b <= -1.6e+20) || !(b <= 360000000.0)) tmp = Float64(sin(b) * r); else tmp = Float64(b * Float64(r / cos(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if ((b <= -1.6e+20) || ~((b <= 360000000.0))) tmp = sin(b) * r; else tmp = b * (r / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -1.6e+20], N[Not[LessEqual[b, 360000000.0]], $MachinePrecision]], N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.6 \cdot 10^{+20} \lor \neg \left(b \leq 360000000\right):\\
\;\;\;\;\sin b \cdot r\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\end{array}
\end{array}
(FPCore (r a b) :precision binary64 (* (sin b) r))
double code(double r, double a, double b) {
return sin(b) * r;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = sin(b) * r
end function
public static double code(double r, double a, double b) {
return Math.sin(b) * r;
}
def code(r, a, b): return math.sin(b) * r
function code(r, a, b) return Float64(sin(b) * r) end
function tmp = code(r, a, b) tmp = sin(b) * r; end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision]
\begin{array}{l}
\\
\sin b \cdot r
\end{array}
(FPCore (r a b) :precision binary64 (* b r))
double code(double r, double a, double b) {
return b * r;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = b * r
end function
public static double code(double r, double a, double b) {
return b * r;
}
def code(r, a, b): return b * r
function code(r, a, b) return Float64(b * r) end
function tmp = code(r, a, b) tmp = b * r; end
code[r_, a_, b_] := N[(b * r), $MachinePrecision]
\begin{array}{l}
\\
b \cdot r
\end{array}
herbie shell --seed 2024010
(FPCore (r a b)
:name "rsin A (should all be same)"
:precision binary64
(/ (* r (sin b)) (cos (+ a b))))