
(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 12 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 (* (sin b) (/ r (fma (cos b) (cos a) (* (sin b) (- (sin a)))))))
double code(double r, double a, double b) {
return sin(b) * (r / fma(cos(b), cos(a), (sin(b) * -sin(a))));
}
function code(r, a, b) return Float64(sin(b) * Float64(r / fma(cos(b), cos(a), Float64(sin(b) * Float64(-sin(a)))))) end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] * N[(r / 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}
\\
\sin b \cdot \frac{r}{\mathsf{fma}\left(\cos b, \cos a, \sin b \cdot \left(-\sin a\right)\right)}
\end{array}
Initial program 79.5%
associate-*r/79.6%
/-rgt-identity79.6%
metadata-eval79.6%
associate-/l/79.6%
associate-*l/79.6%
associate-/l/79.6%
metadata-eval79.6%
metadata-eval79.6%
metadata-eval79.6%
/-rgt-identity79.6%
+-commutative79.6%
Simplified79.6%
cos-sum99.5%
Applied egg-rr99.5%
fma-neg99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
Final simplification99.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 79.5%
+-commutative79.5%
Simplified79.5%
cos-sum99.5%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (r a b) :precision binary64 (* (sin b) (/ r (- (* (cos b) (cos a)) (* (sin b) (sin a))))))
double code(double r, double a, double b) {
return sin(b) * (r / ((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 = sin(b) * (r / ((cos(b) * cos(a)) - (sin(b) * sin(a))))
end function
public static double code(double r, double a, double b) {
return Math.sin(b) * (r / ((Math.cos(b) * Math.cos(a)) - (Math.sin(b) * Math.sin(a))));
}
def code(r, a, b): return math.sin(b) * (r / ((math.cos(b) * math.cos(a)) - (math.sin(b) * math.sin(a))))
function code(r, a, b) return Float64(sin(b) * Float64(r / Float64(Float64(cos(b) * cos(a)) - Float64(sin(b) * sin(a))))) end
function tmp = code(r, a, b) tmp = sin(b) * (r / ((cos(b) * cos(a)) - (sin(b) * sin(a)))); end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] * N[(r / 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}
\\
\sin b \cdot \frac{r}{\cos b \cdot \cos a - \sin b \cdot \sin a}
\end{array}
Initial program 79.5%
associate-*r/79.6%
/-rgt-identity79.6%
metadata-eval79.6%
associate-/l/79.6%
associate-*l/79.6%
associate-/l/79.6%
metadata-eval79.6%
metadata-eval79.6%
metadata-eval79.6%
/-rgt-identity79.6%
+-commutative79.6%
Simplified79.6%
cos-sum99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (r a b) :precision binary64 (if (<= b -9.2e-5) (/ r (/ (cos b) (sin b))) (if (<= b 16500.0) (* b (/ r (cos a))) (/ (tan b) (/ 1.0 r)))))
double code(double r, double a, double b) {
double tmp;
if (b <= -9.2e-5) {
tmp = r / (cos(b) / sin(b));
} else if (b <= 16500.0) {
tmp = b * (r / cos(a));
} else {
tmp = tan(b) / (1.0 / r);
}
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 <= (-9.2d-5)) then
tmp = r / (cos(b) / sin(b))
else if (b <= 16500.0d0) then
tmp = b * (r / cos(a))
else
tmp = tan(b) / (1.0d0 / r)
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -9.2e-5) {
tmp = r / (Math.cos(b) / Math.sin(b));
} else if (b <= 16500.0) {
tmp = b * (r / Math.cos(a));
} else {
tmp = Math.tan(b) / (1.0 / r);
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -9.2e-5: tmp = r / (math.cos(b) / math.sin(b)) elif b <= 16500.0: tmp = b * (r / math.cos(a)) else: tmp = math.tan(b) / (1.0 / r) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -9.2e-5) tmp = Float64(r / Float64(cos(b) / sin(b))); elseif (b <= 16500.0) tmp = Float64(b * Float64(r / cos(a))); else tmp = Float64(tan(b) / Float64(1.0 / r)); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -9.2e-5) tmp = r / (cos(b) / sin(b)); elseif (b <= 16500.0) tmp = b * (r / cos(a)); else tmp = tan(b) / (1.0 / r); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -9.2e-5], N[(r / N[(N[Cos[b], $MachinePrecision] / N[Sin[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 16500.0], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Tan[b], $MachinePrecision] / N[(1.0 / r), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{r}{\frac{\cos b}{\sin b}}\\
\mathbf{elif}\;b \leq 16500:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan b}{\frac{1}{r}}\\
\end{array}
\end{array}
if b < -9.20000000000000001e-5Initial program 60.0%
+-commutative60.0%
Simplified60.0%
Taylor expanded in a around 0 57.8%
associate-/l*57.9%
Simplified57.9%
if -9.20000000000000001e-5 < b < 16500Initial program 98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in b around 0 98.7%
clear-num98.6%
un-div-inv98.7%
Applied egg-rr98.7%
associate-/r/98.8%
Simplified98.8%
if 16500 < b Initial program 59.5%
+-commutative59.5%
Simplified59.5%
associate-*r/59.6%
associate-*l/59.5%
*-commutative59.5%
clear-num59.5%
un-div-inv59.5%
Applied egg-rr59.5%
Taylor expanded in a around 0 60.0%
clear-num60.1%
inv-pow60.1%
clear-num59.9%
associate-/r/59.9%
quot-tan60.2%
Applied egg-rr60.2%
unpow-160.2%
clear-num60.2%
associate-/l*60.3%
Applied egg-rr60.3%
Final simplification79.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 79.5%
Final simplification79.5%
(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}
Initial program 79.5%
associate-*r/79.6%
/-rgt-identity79.6%
metadata-eval79.6%
associate-/l/79.6%
associate-*l/79.6%
associate-/l/79.6%
metadata-eval79.6%
metadata-eval79.6%
metadata-eval79.6%
/-rgt-identity79.6%
+-commutative79.6%
Simplified79.6%
Final simplification79.6%
(FPCore (r a b) :precision binary64 (if (or (<= b -9e-6) (not (<= b 16500.0))) (* r (tan b)) (* r (/ b (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -9e-6) || !(b <= 16500.0)) {
tmp = r * tan(b);
} 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 <= (-9d-6)) .or. (.not. (b <= 16500.0d0))) then
tmp = r * tan(b)
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 <= -9e-6) || !(b <= 16500.0)) {
tmp = r * Math.tan(b);
} else {
tmp = r * (b / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -9e-6) or not (b <= 16500.0): tmp = r * math.tan(b) else: tmp = r * (b / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if ((b <= -9e-6) || !(b <= 16500.0)) tmp = Float64(r * tan(b)); else tmp = Float64(r * Float64(b / cos(a))); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if ((b <= -9e-6) || ~((b <= 16500.0))) tmp = r * tan(b); else tmp = r * (b / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -9e-6], N[Not[LessEqual[b, 16500.0]], $MachinePrecision]], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9 \cdot 10^{-6} \lor \neg \left(b \leq 16500\right):\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\end{array}
\end{array}
if b < -9.00000000000000023e-6 or 16500 < b Initial program 59.8%
+-commutative59.8%
Simplified59.8%
associate-*r/59.8%
associate-*l/59.8%
*-commutative59.8%
clear-num59.8%
un-div-inv59.7%
Applied egg-rr59.7%
Taylor expanded in a around 0 58.9%
associate-/r/58.9%
quot-tan59.0%
Applied egg-rr59.0%
if -9.00000000000000023e-6 < b < 16500Initial program 98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in b around 0 98.7%
Final simplification79.2%
(FPCore (r a b) :precision binary64 (if (or (<= b -1e-5) (not (<= b 16500.0))) (* r (tan b)) (* b (/ r (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -1e-5) || !(b <= 16500.0)) {
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 <= (-1d-5)) .or. (.not. (b <= 16500.0d0))) 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 <= -1e-5) || !(b <= 16500.0)) {
tmp = r * Math.tan(b);
} else {
tmp = b * (r / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -1e-5) or not (b <= 16500.0): tmp = r * math.tan(b) else: tmp = b * (r / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if ((b <= -1e-5) || !(b <= 16500.0)) 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 <= -1e-5) || ~((b <= 16500.0))) tmp = r * tan(b); else tmp = b * (r / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -1e-5], N[Not[LessEqual[b, 16500.0]], $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 -1 \cdot 10^{-5} \lor \neg \left(b \leq 16500\right):\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\end{array}
\end{array}
if b < -1.00000000000000008e-5 or 16500 < b Initial program 59.8%
+-commutative59.8%
Simplified59.8%
associate-*r/59.8%
associate-*l/59.8%
*-commutative59.8%
clear-num59.8%
un-div-inv59.7%
Applied egg-rr59.7%
Taylor expanded in a around 0 58.9%
associate-/r/58.9%
quot-tan59.0%
Applied egg-rr59.0%
if -1.00000000000000008e-5 < b < 16500Initial program 98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in b around 0 98.7%
clear-num98.6%
un-div-inv98.7%
Applied egg-rr98.7%
associate-/r/98.8%
Simplified98.8%
Final simplification79.2%
(FPCore (r a b) :precision binary64 (if (<= b -3e-6) (* r (tan b)) (if (<= b 16500.0) (* b (/ r (cos a))) (/ (tan b) (/ 1.0 r)))))
double code(double r, double a, double b) {
double tmp;
if (b <= -3e-6) {
tmp = r * tan(b);
} else if (b <= 16500.0) {
tmp = b * (r / cos(a));
} else {
tmp = tan(b) / (1.0 / r);
}
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-6)) then
tmp = r * tan(b)
else if (b <= 16500.0d0) then
tmp = b * (r / cos(a))
else
tmp = tan(b) / (1.0d0 / r)
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (b <= -3e-6) {
tmp = r * Math.tan(b);
} else if (b <= 16500.0) {
tmp = b * (r / Math.cos(a));
} else {
tmp = Math.tan(b) / (1.0 / r);
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -3e-6: tmp = r * math.tan(b) elif b <= 16500.0: tmp = b * (r / math.cos(a)) else: tmp = math.tan(b) / (1.0 / r) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -3e-6) tmp = Float64(r * tan(b)); elseif (b <= 16500.0) tmp = Float64(b * Float64(r / cos(a))); else tmp = Float64(tan(b) / Float64(1.0 / r)); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -3e-6) tmp = r * tan(b); elseif (b <= 16500.0) tmp = b * (r / cos(a)); else tmp = tan(b) / (1.0 / r); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -3e-6], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 16500.0], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Tan[b], $MachinePrecision] / N[(1.0 / r), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3 \cdot 10^{-6}:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 16500:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan b}{\frac{1}{r}}\\
\end{array}
\end{array}
if b < -3.0000000000000001e-6Initial program 60.0%
+-commutative60.0%
Simplified60.0%
associate-*r/60.0%
associate-*l/60.1%
*-commutative60.1%
clear-num60.1%
un-div-inv60.0%
Applied egg-rr60.0%
Taylor expanded in a around 0 57.8%
associate-/r/57.9%
quot-tan57.9%
Applied egg-rr57.9%
if -3.0000000000000001e-6 < b < 16500Initial program 98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in b around 0 98.7%
clear-num98.6%
un-div-inv98.7%
Applied egg-rr98.7%
associate-/r/98.8%
Simplified98.8%
if 16500 < b Initial program 59.5%
+-commutative59.5%
Simplified59.5%
associate-*r/59.6%
associate-*l/59.5%
*-commutative59.5%
clear-num59.5%
un-div-inv59.5%
Applied egg-rr59.5%
Taylor expanded in a around 0 60.0%
clear-num60.1%
inv-pow60.1%
clear-num59.9%
associate-/r/59.9%
quot-tan60.2%
Applied egg-rr60.2%
unpow-160.2%
clear-num60.2%
associate-/l*60.3%
Applied egg-rr60.3%
Final simplification79.3%
(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 79.5%
+-commutative79.5%
Simplified79.5%
associate-*r/79.6%
associate-*l/79.6%
*-commutative79.6%
clear-num79.5%
un-div-inv79.5%
Applied egg-rr79.5%
Taylor expanded in b around 0 53.8%
mul-1-neg53.8%
unsub-neg53.8%
Simplified53.8%
Taylor expanded in a around 0 41.1%
*-commutative41.1%
Simplified41.1%
Final simplification41.1%
(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 79.5%
+-commutative79.5%
Simplified79.5%
associate-*r/79.6%
associate-*l/79.6%
*-commutative79.6%
clear-num79.5%
un-div-inv79.5%
Applied egg-rr79.5%
Taylor expanded in a around 0 63.5%
associate-/r/63.6%
quot-tan63.6%
Applied egg-rr63.6%
Final simplification63.6%
(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 79.5%
+-commutative79.5%
Simplified79.5%
Taylor expanded in b around 0 52.2%
Taylor expanded in a around 0 36.4%
Final simplification36.4%
herbie shell --seed 2023318
(FPCore (r a b)
:name "rsin B (should all be same)"
:precision binary64
(* r (/ (sin b) (cos (+ a b)))))