
(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 13 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 71.9%
associate-*r/72.0%
+-commutative72.0%
Simplified72.0%
cos-sum99.5%
cancel-sign-sub-inv99.5%
fma-define99.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 71.9%
+-commutative71.9%
Simplified71.9%
cos-sum99.4%
Applied egg-rr99.4%
Final simplification99.4%
(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 71.9%
associate-*r/72.0%
+-commutative72.0%
Simplified72.0%
cos-sum99.4%
Applied egg-rr99.5%
Final simplification99.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 71.9%
+-commutative71.9%
Simplified71.9%
log1p-expm1-u71.9%
Applied egg-rr71.9%
cos-sum99.3%
log1p-expm1-u99.4%
fma-neg99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
add-sqr-sqrt46.5%
sqrt-unprod84.3%
sqr-neg84.3%
sqrt-unprod37.7%
add-sqr-sqrt71.5%
sin-mult73.2%
div-sub73.2%
Applied egg-rr73.3%
+-inverses73.3%
Simplified73.3%
Final simplification73.3%
(FPCore (r a b) :precision binary64 (if (or (<= a -1.9e-5) (not (<= a 0.000205))) (* r (/ (sin b) (cos a))) (* r (tan b))))
double code(double r, double a, double b) {
double tmp;
if ((a <= -1.9e-5) || !(a <= 0.000205)) {
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 <= (-1.9d-5)) .or. (.not. (a <= 0.000205d0))) 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 <= -1.9e-5) || !(a <= 0.000205)) {
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 <= -1.9e-5) or not (a <= 0.000205): 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 <= -1.9e-5) || !(a <= 0.000205)) 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 <= -1.9e-5) || ~((a <= 0.000205))) tmp = r * (sin(b) / cos(a)); else tmp = r * tan(b); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[a, -1.9e-5], N[Not[LessEqual[a, 0.000205]], $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 -1.9 \cdot 10^{-5} \lor \neg \left(a \leq 0.000205\right):\\
\;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \tan b\\
\end{array}
\end{array}
if a < -1.9000000000000001e-5 or 2.05e-4 < a Initial program 49.7%
+-commutative49.7%
Simplified49.7%
Taylor expanded in b around 0 49.9%
if -1.9000000000000001e-5 < a < 2.05e-4Initial program 98.7%
+-commutative98.7%
Simplified98.7%
add-cbrt-cube36.9%
pow336.9%
associate-*r/37.0%
*-commutative37.0%
associate-/l*37.0%
Applied egg-rr37.0%
Taylor expanded in a around 0 27.6%
cube-prod37.0%
Simplified37.0%
cbrt-div37.0%
rem-cbrt-cube98.7%
rem-cbrt-cube98.9%
clear-num98.2%
Applied egg-rr98.2%
clear-num98.9%
associate-*r/98.7%
*-commutative98.7%
quot-tan98.9%
Applied egg-rr98.9%
Final simplification72.1%
(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 71.9%
Final simplification71.9%
(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 71.9%
associate-*r/72.0%
+-commutative72.0%
Simplified72.0%
*-commutative72.0%
associate-/l*72.0%
Applied egg-rr72.0%
Final simplification72.0%
(FPCore (r a b) :precision binary64 (if (or (<= b -0.00023) (not (<= b 2.9e-6))) (* r (tan b)) (* b (/ r (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -0.00023) || !(b <= 2.9e-6)) {
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.00023d0)) .or. (.not. (b <= 2.9d-6))) 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.00023) || !(b <= 2.9e-6)) {
tmp = r * Math.tan(b);
} else {
tmp = b * (r / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -0.00023) or not (b <= 2.9e-6): 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.00023) || !(b <= 2.9e-6)) 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.00023) || ~((b <= 2.9e-6))) tmp = r * tan(b); else tmp = b * (r / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -0.00023], N[Not[LessEqual[b, 2.9e-6]], $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.00023 \lor \neg \left(b \leq 2.9 \cdot 10^{-6}\right):\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\end{array}
\end{array}
if b < -2.3000000000000001e-4 or 2.9000000000000002e-6 < b Initial program 51.6%
+-commutative51.6%
Simplified51.6%
add-cbrt-cube16.0%
pow316.0%
associate-*r/16.1%
*-commutative16.1%
associate-/l*16.1%
Applied egg-rr16.1%
Taylor expanded in a around 0 15.6%
cube-prod15.7%
Simplified15.7%
cbrt-div15.6%
rem-cbrt-cube50.9%
rem-cbrt-cube51.1%
clear-num51.0%
Applied egg-rr51.0%
clear-num51.1%
associate-*r/51.0%
*-commutative51.0%
quot-tan51.1%
Applied egg-rr51.1%
if -2.3000000000000001e-4 < b < 2.9000000000000002e-6Initial program 99.3%
associate-*r/99.3%
+-commutative99.3%
Simplified99.3%
cos-sum99.7%
cancel-sign-sub-inv99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in b around 0 99.3%
associate-/l*99.3%
Simplified99.3%
Final simplification71.6%
(FPCore (r a b) :precision binary64 (if (or (<= b -2.7e-6) (not (<= b 1.95e-6))) (* r (tan b)) (* r (/ b (cos a)))))
double code(double r, double a, double b) {
double tmp;
if ((b <= -2.7e-6) || !(b <= 1.95e-6)) {
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 <= (-2.7d-6)) .or. (.not. (b <= 1.95d-6))) 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 <= -2.7e-6) || !(b <= 1.95e-6)) {
tmp = r * Math.tan(b);
} else {
tmp = r * (b / Math.cos(a));
}
return tmp;
}
def code(r, a, b): tmp = 0 if (b <= -2.7e-6) or not (b <= 1.95e-6): tmp = r * math.tan(b) else: tmp = r * (b / math.cos(a)) return tmp
function code(r, a, b) tmp = 0.0 if ((b <= -2.7e-6) || !(b <= 1.95e-6)) 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 <= -2.7e-6) || ~((b <= 1.95e-6))) tmp = r * tan(b); else tmp = r * (b / cos(a)); end tmp_2 = tmp; end
code[r_, a_, b_] := If[Or[LessEqual[b, -2.7e-6], N[Not[LessEqual[b, 1.95e-6]], $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 -2.7 \cdot 10^{-6} \lor \neg \left(b \leq 1.95 \cdot 10^{-6}\right):\\
\;\;\;\;r \cdot \tan b\\
\mathbf{else}:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\end{array}
\end{array}
if b < -2.69999999999999998e-6 or 1.95e-6 < b Initial program 51.6%
+-commutative51.6%
Simplified51.6%
add-cbrt-cube16.0%
pow316.0%
associate-*r/16.1%
*-commutative16.1%
associate-/l*16.1%
Applied egg-rr16.1%
Taylor expanded in a around 0 15.6%
cube-prod15.7%
Simplified15.7%
cbrt-div15.6%
rem-cbrt-cube50.9%
rem-cbrt-cube51.1%
clear-num51.0%
Applied egg-rr51.0%
clear-num51.1%
associate-*r/51.0%
*-commutative51.0%
quot-tan51.1%
Applied egg-rr51.1%
if -2.69999999999999998e-6 < b < 1.95e-6Initial program 99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in b around 0 99.3%
Final simplification71.7%
(FPCore (r a b) :precision binary64 (if (<= b -7.2e-5) (/ r (/ 1.0 (tan b))) (if (<= b 3.9e-6) (* r (/ b (cos a))) (* r (tan b)))))
double code(double r, double a, double b) {
double tmp;
if (b <= -7.2e-5) {
tmp = r / (1.0 / tan(b));
} else if (b <= 3.9e-6) {
tmp = r * (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 (b <= (-7.2d-5)) then
tmp = r / (1.0d0 / tan(b))
else if (b <= 3.9d-6) then
tmp = r * (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 (b <= -7.2e-5) {
tmp = r / (1.0 / Math.tan(b));
} else if (b <= 3.9e-6) {
tmp = r * (b / Math.cos(a));
} else {
tmp = r * Math.tan(b);
}
return tmp;
}
def code(r, a, b): tmp = 0 if b <= -7.2e-5: tmp = r / (1.0 / math.tan(b)) elif b <= 3.9e-6: tmp = r * (b / math.cos(a)) else: tmp = r * math.tan(b) return tmp
function code(r, a, b) tmp = 0.0 if (b <= -7.2e-5) tmp = Float64(r / Float64(1.0 / tan(b))); elseif (b <= 3.9e-6) tmp = Float64(r * Float64(b / cos(a))); else tmp = Float64(r * tan(b)); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (b <= -7.2e-5) tmp = r / (1.0 / tan(b)); elseif (b <= 3.9e-6) tmp = r * (b / cos(a)); else tmp = r * tan(b); end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[b, -7.2e-5], N[(r / N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.9e-6], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\mathbf{elif}\;b \leq 3.9 \cdot 10^{-6}:\\
\;\;\;\;r \cdot \frac{b}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;r \cdot \tan b\\
\end{array}
\end{array}
if b < -7.20000000000000018e-5Initial program 55.7%
+-commutative55.7%
Simplified55.7%
add-cbrt-cube18.0%
pow318.0%
associate-*r/18.0%
*-commutative18.0%
associate-/l*18.1%
Applied egg-rr18.1%
Taylor expanded in a around 0 17.7%
cube-prod17.7%
Simplified17.7%
add-cube-cbrt17.6%
pow317.5%
cbrt-div17.5%
rem-cbrt-cube54.4%
rem-cbrt-cube54.4%
associate-/l*54.3%
Applied egg-rr54.3%
rem-cube-cbrt55.0%
clear-num55.0%
un-div-inv55.2%
clear-num55.1%
quot-tan55.2%
Applied egg-rr55.2%
if -7.20000000000000018e-5 < b < 3.8999999999999999e-6Initial program 99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in b around 0 99.3%
if 3.8999999999999999e-6 < b Initial program 46.1%
+-commutative46.1%
Simplified46.1%
add-cbrt-cube13.4%
pow313.4%
associate-*r/13.4%
*-commutative13.4%
associate-/l*13.4%
Applied egg-rr13.4%
Taylor expanded in a around 0 12.9%
cube-prod12.9%
Simplified12.9%
cbrt-div12.9%
rem-cbrt-cube45.4%
rem-cbrt-cube45.7%
clear-num45.6%
Applied egg-rr45.6%
clear-num45.7%
associate-*r/45.6%
*-commutative45.6%
quot-tan45.7%
Applied egg-rr45.7%
Final simplification71.7%
(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 71.9%
+-commutative71.9%
Simplified71.9%
Taylor expanded in b around 0 47.0%
mul-1-neg47.0%
unsub-neg47.0%
Simplified47.0%
Taylor expanded in a around 0 34.4%
Final simplification34.4%
(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 71.9%
+-commutative71.9%
Simplified71.9%
add-cbrt-cube32.1%
pow332.1%
associate-*r/32.2%
*-commutative32.2%
associate-/l*32.2%
Applied egg-rr32.2%
Taylor expanded in a around 0 21.4%
cube-prod26.3%
Simplified26.3%
cbrt-div26.3%
rem-cbrt-cube56.2%
rem-cbrt-cube56.3%
clear-num56.0%
Applied egg-rr56.0%
clear-num56.3%
associate-*r/56.2%
*-commutative56.2%
quot-tan56.3%
Applied egg-rr56.3%
Final simplification56.3%
(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 71.9%
+-commutative71.9%
Simplified71.9%
Taylor expanded in b around 0 45.2%
Taylor expanded in a around 0 29.8%
Final simplification29.8%
herbie shell --seed 2024075
(FPCore (r a b)
:name "rsin B (should all be same)"
:precision binary64
(* r (/ (sin b) (cos (+ a b)))))