
(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 (* 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 91.8%
associate-/l*91.8%
remove-double-neg91.8%
remove-double-neg91.8%
+-commutative91.8%
Simplified91.8%
cos-sum99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (r a b) :precision binary64 (if (or (<= a -2.9e-8) (not (<= a 2.1e-8))) (* r (/ (sin b) (cos a))) (* r (/ (sin b) (cos b)))))
double code(double r, double a, double b) {
double tmp;
if ((a <= -2.9e-8) || !(a <= 2.1e-8)) {
tmp = r * (sin(b) / 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 ((a <= (-2.9d-8)) .or. (.not. (a <= 2.1d-8))) then
tmp = r * (sin(b) / 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 ((a <= -2.9e-8) || !(a <= 2.1e-8)) {
tmp = r * (Math.sin(b) / Math.cos(a));
} else {
tmp = r * (Math.sin(b) / Math.cos(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (a <= -2.9e-8) or not (a <= 2.1e-8): tmp = r * (math.sin(b) / math.cos(a)) else: tmp = r * (math.sin(b) / math.cos(b)) return tmp
function code(r, a, b) tmp = 0.0 if ((a <= -2.9e-8) || !(a <= 2.1e-8)) tmp = Float64(r * Float64(sin(b) / 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 ((a <= -2.9e-8) || ~((a <= 2.1e-8))) tmp = r * (sin(b) / cos(a)); else tmp = r * (sin(b) / cos(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[a, -2.9e-8], N[Not[LessEqual[a, 2.1e-8]], $MachinePrecision]], N[(r * N[(N[Sin[b], $MachinePrecision] / 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}\;a \leq -2.9 \cdot 10^{-8} \lor \neg \left(a \leq 2.1 \cdot 10^{-8}\right):\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos b}\\
\end{array}
\end{array}
if a < -2.9000000000000002e-8 or 2.09999999999999994e-8 < a Initial program 55.8%
associate-/l*55.8%
remove-double-neg55.8%
remove-double-neg55.8%
+-commutative55.8%
Simplified55.8%
Taylor expanded in b around 0 54.8%
if -2.9000000000000002e-8 < a < 2.09999999999999994e-8Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in a around 0 99.9%
Final simplification91.7%
(FPCore (r a b) :precision binary64 (if (<= a -2.2e-8) (* r (/ (sin b) (cos a))) (if (<= a 1.1e-21) (* r (/ (sin b) (cos b))) (/ r (/ (cos a) (sin b))))))
double code(double r, double a, double b) {
double tmp;
if (a <= -2.2e-8) {
tmp = r * (sin(b) / cos(a));
} else if (a <= 1.1e-21) {
tmp = r * (sin(b) / cos(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 <= (-2.2d-8)) then
tmp = r * (sin(b) / cos(a))
else if (a <= 1.1d-21) then
tmp = r * (sin(b) / cos(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 <= -2.2e-8) {
tmp = r * (Math.sin(b) / Math.cos(a));
} else if (a <= 1.1e-21) {
tmp = r * (Math.sin(b) / Math.cos(b));
} else {
tmp = r / (Math.cos(a) / Math.sin(b));
}
return tmp;
}
def code(r, a, b): tmp = 0 if a <= -2.2e-8: tmp = r * (math.sin(b) / math.cos(a)) elif a <= 1.1e-21: tmp = r * (math.sin(b) / math.cos(b)) else: tmp = r / (math.cos(a) / math.sin(b)) return tmp
function code(r, a, b) tmp = 0.0 if (a <= -2.2e-8) tmp = Float64(r * Float64(sin(b) / cos(a))); elseif (a <= 1.1e-21) tmp = Float64(r * Float64(sin(b) / cos(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 <= -2.2e-8) tmp = r * (sin(b) / cos(a)); elseif (a <= 1.1e-21) tmp = r * (sin(b) / cos(b)); else tmp = r / (cos(a) / sin(b)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[a, -2.2e-8], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.1e-21], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[b], $MachinePrecision]), $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 -2.2 \cdot 10^{-8}:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{-21}:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos b}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{\cos a}{\sin b}}\\
\end{array}
\end{array}
if a < -2.1999999999999998e-8Initial program 53.4%
associate-/l*53.4%
remove-double-neg53.4%
remove-double-neg53.4%
+-commutative53.4%
Simplified53.4%
Taylor expanded in b around 0 51.1%
if -2.1999999999999998e-8 < a < 1.1e-21Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in a around 0 99.9%
if 1.1e-21 < a Initial program 65.4%
associate-/l*65.3%
remove-double-neg65.3%
remove-double-neg65.3%
+-commutative65.3%
Simplified65.3%
clear-num65.2%
un-div-inv65.5%
Applied egg-rr65.5%
Taylor expanded in b around 0 66.0%
Final simplification91.7%
(FPCore (r a b) :precision binary64 (if (<= a -1.05e-7) (* r (/ (sin b) (cos a))) (if (<= a 1.8e-8) (* r (/ (sin b) (cos b))) (/ (* r (sin b)) (cos a)))))
double code(double r, double a, double b) {
double tmp;
if (a <= -1.05e-7) {
tmp = r * (sin(b) / cos(a));
} else if (a <= 1.8e-8) {
tmp = r * (sin(b) / cos(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 <= (-1.05d-7)) then
tmp = r * (sin(b) / cos(a))
else if (a <= 1.8d-8) then
tmp = r * (sin(b) / cos(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 <= -1.05e-7) {
tmp = r * (Math.sin(b) / Math.cos(a));
} else if (a <= 1.8e-8) {
tmp = r * (Math.sin(b) / Math.cos(b));
} else {
tmp = (r * Math.sin(b)) / Math.cos(a);
}
return tmp;
}
def code(r, a, b): tmp = 0 if a <= -1.05e-7: tmp = r * (math.sin(b) / math.cos(a)) elif a <= 1.8e-8: tmp = r * (math.sin(b) / math.cos(b)) else: tmp = (r * math.sin(b)) / math.cos(a) return tmp
function code(r, a, b) tmp = 0.0 if (a <= -1.05e-7) tmp = Float64(r * Float64(sin(b) / cos(a))); elseif (a <= 1.8e-8) tmp = Float64(r * Float64(sin(b) / cos(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 <= -1.05e-7) tmp = r * (sin(b) / cos(a)); elseif (a <= 1.8e-8) tmp = r * (sin(b) / cos(b)); else tmp = (r * sin(b)) / cos(a); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[a, -1.05e-7], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.8e-8], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[b], $MachinePrecision]), $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 -1.05 \cdot 10^{-7}:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{-8}:\\
\;\;\;\;r \cdot \frac{\sin b}{\cos b}\\
\mathbf{else}:\\
\;\;\;\;\frac{r \cdot \sin b}{\cos a}\\
\end{array}
\end{array}
if a < -1.05e-7Initial program 53.4%
associate-/l*53.4%
remove-double-neg53.4%
remove-double-neg53.4%
+-commutative53.4%
Simplified53.4%
Taylor expanded in b around 0 51.1%
if -1.05e-7 < a < 1.79999999999999991e-8Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in a around 0 99.9%
if 1.79999999999999991e-8 < a Initial program 58.9%
+-commutative58.9%
Simplified58.9%
Taylor expanded in b around 0 59.6%
Final simplification91.7%
(FPCore (r a b) :precision binary64 (* (sin b) (* r (/ 1.0 (cos (+ b a))))))
double code(double r, double a, double b) {
return sin(b) * (r * (1.0 / 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 * (1.0d0 / cos((b + a))))
end function
public static double code(double r, double a, double b) {
return Math.sin(b) * (r * (1.0 / Math.cos((b + a))));
}
def code(r, a, b): return math.sin(b) * (r * (1.0 / math.cos((b + a))))
function code(r, a, b) return Float64(sin(b) * Float64(r * Float64(1.0 / cos(Float64(b + a))))) end
function tmp = code(r, a, b) tmp = sin(b) * (r * (1.0 / cos((b + a)))); end
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] * N[(r * N[(1.0 / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin b \cdot \left(r \cdot \frac{1}{\cos \left(b + a\right)}\right)
\end{array}
Initial program 91.8%
+-commutative91.8%
Simplified91.8%
associate-*r/91.8%
*-commutative91.8%
div-inv91.8%
associate-*l*91.8%
Applied egg-rr91.8%
Final simplification91.8%
(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 91.8%
associate-/l*91.8%
remove-double-neg91.8%
remove-double-neg91.8%
+-commutative91.8%
Simplified91.8%
Final simplification91.8%
(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 91.8%
+-commutative91.8%
Simplified91.8%
*-commutative91.8%
associate-/l*91.8%
Applied egg-rr91.8%
Final simplification91.8%
(FPCore (r a b) :precision binary64 (* r (/ (sin b) (cos a))))
double code(double r, double a, double b) {
return r * (sin(b) / cos(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(a))
end function
public static double code(double r, double a, double b) {
return r * (Math.sin(b) / Math.cos(a));
}
def code(r, a, b): return r * (math.sin(b) / math.cos(a))
function code(r, a, b) return Float64(r * Float64(sin(b) / cos(a))) end
function tmp = code(r, a, b) tmp = r * (sin(b) / cos(a)); end
code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\cos a}
\end{array}
Initial program 91.8%
associate-/l*91.8%
remove-double-neg91.8%
remove-double-neg91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in b around 0 86.6%
Final simplification86.6%
(FPCore (r a b) :precision binary64 (* r (* b (/ 1.0 (cos a)))))
double code(double r, double a, double b) {
return r * (b * (1.0 / cos(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 * (b * (1.0d0 / cos(a)))
end function
public static double code(double r, double a, double b) {
return r * (b * (1.0 / Math.cos(a)));
}
def code(r, a, b): return r * (b * (1.0 / math.cos(a)))
function code(r, a, b) return Float64(r * Float64(b * Float64(1.0 / cos(a)))) end
function tmp = code(r, a, b) tmp = r * (b * (1.0 / cos(a))); end
code[r_, a_, b_] := N[(r * N[(b * N[(1.0 / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \left(b \cdot \frac{1}{\cos a}\right)
\end{array}
Initial program 91.8%
associate-/l*91.8%
remove-double-neg91.8%
remove-double-neg91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in b around 0 85.4%
clear-num85.2%
associate-/r/85.4%
Applied egg-rr85.4%
Final simplification85.4%
(FPCore (r a b) :precision binary64 (/ (* r b) (cos (+ b a))))
double code(double r, double a, double b) {
return (r * 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 * b) / cos((b + a))
end function
public static double code(double r, double a, double b) {
return (r * b) / Math.cos((b + a));
}
def code(r, a, b): return (r * b) / math.cos((b + a))
function code(r, a, b) return Float64(Float64(r * b) / cos(Float64(b + a))) end
function tmp = code(r, a, b) tmp = (r * b) / cos((b + a)); end
code[r_, a_, b_] := N[(N[(r * b), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot b}{\cos \left(b + a\right)}
\end{array}
Initial program 91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in b around 0 85.6%
Final simplification85.6%
(FPCore (r a b) :precision binary64 (* r (/ b (cos a))))
double code(double r, double a, double b) {
return r * (b / cos(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 * (b / cos(a))
end function
public static double code(double r, double a, double b) {
return r * (b / Math.cos(a));
}
def code(r, a, b): return r * (b / math.cos(a))
function code(r, a, b) return Float64(r * Float64(b / cos(a))) end
function tmp = code(r, a, b) tmp = r * (b / cos(a)); end
code[r_, a_, b_] := N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{b}{\cos a}
\end{array}
Initial program 91.8%
associate-/l*91.8%
remove-double-neg91.8%
remove-double-neg91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in b around 0 85.4%
Final simplification85.4%
(FPCore (r a b) :precision binary64 (/ (* r b) (cos a)))
double code(double r, double a, double b) {
return (r * b) / cos(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 * b) / cos(a)
end function
public static double code(double r, double a, double b) {
return (r * b) / Math.cos(a);
}
def code(r, a, b): return (r * b) / math.cos(a)
function code(r, a, b) return Float64(Float64(r * b) / cos(a)) end
function tmp = code(r, a, b) tmp = (r * b) / cos(a); end
code[r_, a_, b_] := N[(N[(r * b), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{r \cdot b}{\cos a}
\end{array}
Initial program 91.8%
associate-/l*91.8%
remove-double-neg91.8%
remove-double-neg91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in b around 0 85.4%
Final simplification85.4%
(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 91.8%
associate-/l*91.8%
remove-double-neg91.8%
remove-double-neg91.8%
+-commutative91.8%
Simplified91.8%
add-log-exp36.7%
Applied egg-rr36.7%
Taylor expanded in b around 0 31.6%
Taylor expanded in a around 0 82.4%
*-commutative82.4%
Simplified82.4%
Final simplification82.4%
(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 91.8%
associate-/l*91.8%
remove-double-neg91.8%
remove-double-neg91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in b around 0 85.4%
Taylor expanded in a around 0 81.8%
Final simplification81.8%
herbie shell --seed 2024052
(FPCore (r a b)
:name "rsin A (should all be same)"
:precision binary64
(/ (* r (sin b)) (cos (+ a b))))