
(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 11 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)) (sin a)))))
double code(double r, double a, double b) {
return (r * sin(b)) / fma(cos(b), cos(a), (-sin(b) * sin(a)));
}
function code(r, a, b) return Float64(Float64(r * sin(b)) / fma(cos(b), cos(a), Float64(Float64(-sin(b)) * 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[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \sin a\right)}
\end{array}
Initial program 75.1%
associate-*r/75.1%
+-commutative75.1%
Simplified75.1%
cos-sum99.5%
cancel-sign-sub-inv99.5%
fma-define99.5%
Applied egg-rr99.5%
(FPCore (r a b) :precision binary64 (* r (/ (sin b) (fma (cos b) (cos a) (* (- (sin b)) (sin a))))))
double code(double r, double a, double b) {
return r * (sin(b) / fma(cos(b), cos(a), (-sin(b) * sin(a))));
}
function code(r, a, b) return Float64(r * Float64(sin(b) / fma(cos(b), cos(a), Float64(Float64(-sin(b)) * sin(a))))) end
code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision] + N[((-N[Sin[b], $MachinePrecision]) * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \sin a\right)}
\end{array}
Initial program 75.1%
+-commutative75.1%
Simplified75.1%
cos-sum99.5%
cancel-sign-sub-inv99.5%
fma-define99.5%
Applied egg-rr99.5%
(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 75.1%
associate-*r/75.1%
+-commutative75.1%
Simplified75.1%
cos-sum99.5%
Applied egg-rr99.5%
(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 75.1%
+-commutative75.1%
Simplified75.1%
cos-sum99.5%
Applied egg-rr99.5%
(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}
Initial program 75.1%
+-commutative75.1%
Simplified75.1%
cos-sum99.5%
cancel-sign-sub-inv99.5%
fma-define99.5%
Applied egg-rr99.5%
add-sqr-sqrt52.1%
sqrt-unprod85.3%
sqr-neg85.3%
sqrt-unprod33.2%
add-sqr-sqrt74.8%
sin-mult76.0%
cos-sum74.3%
cancel-sign-sub-inv74.3%
add-sqr-sqrt41.2%
sqrt-unprod75.2%
sqr-neg75.2%
sqrt-unprod34.0%
add-sqr-sqrt76.0%
cos-diff76.0%
Applied egg-rr76.0%
+-inverses76.0%
metadata-eval76.0%
Simplified76.0%
(FPCore (r a b) :precision binary64 (if (or (<= a -75000000000000.0) (not (<= a 2.9e-8))) (* r (/ (sin b) (cos a))) (* r (tan b))))
double code(double r, double a, double b) {
double tmp;
if ((a <= -75000000000000.0) || !(a <= 2.9e-8)) {
tmp = r * (sin(b) / cos(a));
} else {
tmp = r * 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 ((a <= (-75000000000000.0d0)) .or. (.not. (a <= 2.9d-8))) then
tmp = r * (sin(b) / cos(a))
else
tmp = r * tan(b)
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if ((a <= -75000000000000.0) || !(a <= 2.9e-8)) {
tmp = r * (Math.sin(b) / Math.cos(a));
} else {
tmp = r * Math.tan(b);
}
return tmp;
}
def code(r, a, b): tmp = 0 if (a <= -75000000000000.0) or not (a <= 2.9e-8): tmp = r * (math.sin(b) / math.cos(a)) else: tmp = r * math.tan(b) return tmp
function code(r, a, b) tmp = 0.0 if ((a <= -75000000000000.0) || !(a <= 2.9e-8)) tmp = Float64(r * Float64(sin(b) / cos(a))); else tmp = Float64(r * tan(b)); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if ((a <= -75000000000000.0) || ~((a <= 2.9e-8))) tmp = r * (sin(b) / cos(a)); else tmp = r * tan(b); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[a, -75000000000000.0], N[Not[LessEqual[a, 2.9e-8]], $MachinePrecision]], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -75000000000000 \lor \neg \left(a \leq 2.9 \cdot 10^{-8}\right):\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \tan b\\
\end{array}
\end{array}
if a < -7.5e13 or 2.9000000000000002e-8 < a Initial program 58.3%
+-commutative58.3%
Simplified58.3%
Taylor expanded in b around 0 57.9%
if -7.5e13 < a < 2.9000000000000002e-8Initial program 97.4%
associate-*r/97.3%
+-commutative97.3%
Simplified97.3%
cos-sum99.7%
cancel-sign-sub-inv99.7%
fma-define99.7%
Applied egg-rr99.7%
frac-2neg99.7%
div-inv99.6%
distribute-rgt-neg-in99.6%
add-sqr-sqrt61.3%
sqrt-unprod60.9%
sqr-neg60.9%
sqrt-unprod6.1%
add-sqr-sqrt18.6%
distribute-lft-neg-out18.6%
fma-neg18.6%
cos-sum18.8%
cos-sum18.6%
cancel-sign-sub-inv18.6%
Applied egg-rr18.8%
associate-*r/18.8%
*-rgt-identity18.8%
distribute-frac-neg218.8%
associate-*l/18.8%
associate-/r/18.8%
distribute-neg-frac18.8%
Simplified18.8%
Taylor expanded in a around 0 18.8%
mul-1-neg18.8%
associate-/l*18.8%
distribute-rgt-neg-in18.8%
Simplified18.8%
add-sqr-sqrt17.3%
sqrt-unprod43.1%
distribute-rgt-neg-out43.1%
distribute-rgt-neg-out43.1%
sqr-neg43.1%
sqrt-unprod54.4%
add-sqr-sqrt97.4%
clear-num97.2%
un-div-inv97.2%
clear-num97.2%
quot-tan97.2%
Applied egg-rr97.2%
associate-/r/97.5%
/-rgt-identity97.5%
Simplified97.5%
Final simplification74.9%
(FPCore (r a b) :precision binary64 (if (<= a -75000000000000.0) (* r (/ (sin b) (cos a))) (if (<= a 2.9e-8) (* r (tan b)) (/ (* r (sin b)) (cos a)))))
double code(double r, double a, double b) {
double tmp;
if (a <= -75000000000000.0) {
tmp = r * (sin(b) / cos(a));
} else if (a <= 2.9e-8) {
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 <= (-75000000000000.0d0)) then
tmp = r * (sin(b) / cos(a))
else if (a <= 2.9d-8) 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 <= -75000000000000.0) {
tmp = r * (Math.sin(b) / Math.cos(a));
} else if (a <= 2.9e-8) {
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 <= -75000000000000.0: tmp = r * (math.sin(b) / math.cos(a)) elif a <= 2.9e-8: 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 <= -75000000000000.0) tmp = Float64(r * Float64(sin(b) / cos(a))); elseif (a <= 2.9e-8) 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 <= -75000000000000.0) tmp = r * (sin(b) / cos(a)); elseif (a <= 2.9e-8) tmp = r * tan(b); else tmp = (r * sin(b)) / cos(a); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[a, -75000000000000.0], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.9e-8], 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 -75000000000000:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{elif}\;a \leq 2.9 \cdot 10^{-8}:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;\frac{r \cdot \sin b}{\cos a}\\
\end{array}
\end{array}
if a < -7.5e13Initial program 52.9%
+-commutative52.9%
Simplified52.9%
Taylor expanded in b around 0 52.5%
if -7.5e13 < a < 2.9000000000000002e-8Initial program 97.4%
associate-*r/97.3%
+-commutative97.3%
Simplified97.3%
cos-sum99.7%
cancel-sign-sub-inv99.7%
fma-define99.7%
Applied egg-rr99.7%
frac-2neg99.7%
div-inv99.6%
distribute-rgt-neg-in99.6%
add-sqr-sqrt61.3%
sqrt-unprod60.9%
sqr-neg60.9%
sqrt-unprod6.1%
add-sqr-sqrt18.6%
distribute-lft-neg-out18.6%
fma-neg18.6%
cos-sum18.8%
cos-sum18.6%
cancel-sign-sub-inv18.6%
Applied egg-rr18.8%
associate-*r/18.8%
*-rgt-identity18.8%
distribute-frac-neg218.8%
associate-*l/18.8%
associate-/r/18.8%
distribute-neg-frac18.8%
Simplified18.8%
Taylor expanded in a around 0 18.8%
mul-1-neg18.8%
associate-/l*18.8%
distribute-rgt-neg-in18.8%
Simplified18.8%
add-sqr-sqrt17.3%
sqrt-unprod43.1%
distribute-rgt-neg-out43.1%
distribute-rgt-neg-out43.1%
sqr-neg43.1%
sqrt-unprod54.4%
add-sqr-sqrt97.4%
clear-num97.2%
un-div-inv97.2%
clear-num97.2%
quot-tan97.2%
Applied egg-rr97.2%
associate-/r/97.5%
/-rgt-identity97.5%
Simplified97.5%
if 2.9000000000000002e-8 < a Initial program 64.7%
associate-*r/64.7%
+-commutative64.7%
Simplified64.7%
Taylor expanded in b around 0 64.3%
(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 75.1%
Final simplification75.1%
(FPCore (r a b) :precision binary64 (if (or (<= b -0.0015) (not (<= b 0.00013))) (* r (tan b)) (* b (/ r (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -0.0015) || !(b <= 0.00013)) {
tmp = r * tan(b);
} 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 <= (-0.0015d0)) .or. (.not. (b <= 0.00013d0))) then
tmp = r * tan(b)
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 <= -0.0015) || !(b <= 0.00013)) {
tmp = r * Math.tan(b);
} else {
tmp = b * (r / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -0.0015) or not (b <= 0.00013): tmp = r * math.tan(b) else: tmp = b * (r / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if ((b <= -0.0015) || !(b <= 0.00013)) tmp = Float64(r * tan(b)); else tmp = Float64(b * Float64(r / cos(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if ((b <= -0.0015) || ~((b <= 0.00013))) tmp = r * tan(b); else tmp = b * (r / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -0.0015], N[Not[LessEqual[b, 0.00013]], $MachinePrecision]], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0015 \lor \neg \left(b \leq 0.00013\right):\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\end{array}
\end{array}
if b < -0.0015 or 1.29999999999999989e-4 < b Initial program 49.4%
associate-*r/49.4%
+-commutative49.4%
Simplified49.4%
cos-sum99.2%
cancel-sign-sub-inv99.2%
fma-define99.3%
Applied egg-rr99.3%
frac-2neg99.3%
div-inv99.2%
distribute-rgt-neg-in99.2%
add-sqr-sqrt50.2%
sqrt-unprod51.3%
sqr-neg51.3%
sqrt-unprod0.9%
add-sqr-sqrt2.0%
distribute-lft-neg-out2.0%
fma-neg2.0%
cos-sum6.5%
cos-sum2.0%
cancel-sign-sub-inv2.0%
Applied egg-rr7.1%
associate-*r/7.1%
*-rgt-identity7.1%
distribute-frac-neg27.1%
associate-*l/7.1%
associate-/r/7.1%
distribute-neg-frac7.1%
Simplified7.1%
Taylor expanded in a around 0 7.2%
mul-1-neg7.2%
associate-/l*7.2%
distribute-rgt-neg-in7.2%
Simplified7.2%
add-sqr-sqrt3.8%
sqrt-unprod17.3%
distribute-rgt-neg-out17.3%
distribute-rgt-neg-out17.3%
sqr-neg17.3%
sqrt-unprod23.3%
add-sqr-sqrt48.7%
clear-num48.5%
un-div-inv48.6%
clear-num48.6%
quot-tan48.7%
Applied egg-rr48.7%
associate-/r/48.7%
/-rgt-identity48.7%
Simplified48.7%
if -0.0015 < b < 1.29999999999999989e-4Initial program 99.2%
+-commutative99.2%
Simplified99.2%
cos-sum99.8%
cancel-sign-sub-inv99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in b around 0 99.2%
cos-neg99.2%
associate-/l*99.2%
cos-neg99.2%
Simplified99.2%
Final simplification74.8%
(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 75.1%
associate-*r/75.1%
+-commutative75.1%
Simplified75.1%
cos-sum99.5%
cancel-sign-sub-inv99.5%
fma-define99.5%
Applied egg-rr99.5%
frac-2neg99.5%
div-inv99.4%
distribute-rgt-neg-in99.4%
add-sqr-sqrt51.9%
sqrt-unprod55.5%
sqr-neg55.5%
sqrt-unprod9.4%
add-sqr-sqrt20.0%
distribute-lft-neg-out20.0%
fma-neg20.0%
cos-sum22.1%
cos-sum20.0%
cancel-sign-sub-inv20.0%
Applied egg-rr22.5%
associate-*r/22.5%
*-rgt-identity22.5%
distribute-frac-neg222.5%
associate-*l/22.5%
associate-/r/22.5%
distribute-neg-frac22.5%
Simplified22.5%
Taylor expanded in a around 0 24.1%
mul-1-neg24.1%
associate-/l*24.1%
distribute-rgt-neg-in24.1%
Simplified24.1%
add-sqr-sqrt20.1%
sqrt-unprod33.0%
distribute-rgt-neg-out33.0%
distribute-rgt-neg-out33.0%
sqr-neg33.0%
sqrt-unprod36.8%
add-sqr-sqrt57.9%
clear-num57.9%
un-div-inv57.9%
clear-num57.9%
quot-tan57.9%
Applied egg-rr57.9%
associate-/r/58.0%
/-rgt-identity58.0%
Simplified58.0%
(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 75.1%
+-commutative75.1%
Simplified75.1%
Taylor expanded in b around 0 52.9%
Taylor expanded in a around 0 36.2%
herbie shell --seed 2024113
(FPCore (r a b)
:name "rsin B (should all be same)"
:precision binary64
(* r (/ (sin b) (cos (+ a b)))))