
(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 9 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) (- (* (cos a) (cos b)) (* (sin b) (sin a))))))
double code(double r, double a, double b) {
return r * (sin(b) / ((cos(a) * cos(b)) - (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(a) * cos(b)) - (sin(b) * sin(a))))
end function
public static double code(double r, double a, double b) {
return r * (Math.sin(b) / ((Math.cos(a) * Math.cos(b)) - (Math.sin(b) * Math.sin(a))));
}
def code(r, a, b): return r * (math.sin(b) / ((math.cos(a) * math.cos(b)) - (math.sin(b) * math.sin(a))))
function code(r, a, b) return Float64(r * Float64(sin(b) / Float64(Float64(cos(a) * cos(b)) - Float64(sin(b) * sin(a))))) end
function tmp = code(r, a, b) tmp = r * (sin(b) / ((cos(a) * cos(b)) - (sin(b) * sin(a)))); end
code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[a], $MachinePrecision] * N[Cos[b], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
r \cdot \frac{\sin b}{\cos a \cdot \cos b - \sin b \cdot \sin a}
\end{array}
Initial program 73.4%
cos-sumN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6499.5
Applied rewrites99.5%
(FPCore (r a b) :precision binary64 (let* ((t_0 (cos (+ b a))) (t_1 (/ (sin b) t_0)) (t_2 (* r (tan b)))) (if (<= t_1 -0.02) t_2 (if (<= t_1 1e-12) (/ (* r b) t_0) t_2))))
double code(double r, double a, double b) {
double t_0 = cos((b + a));
double t_1 = sin(b) / t_0;
double t_2 = r * tan(b);
double tmp;
if (t_1 <= -0.02) {
tmp = t_2;
} else if (t_1 <= 1e-12) {
tmp = (r * b) / t_0;
} else {
tmp = t_2;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((b + a))
t_1 = sin(b) / t_0
t_2 = r * tan(b)
if (t_1 <= (-0.02d0)) then
tmp = t_2
else if (t_1 <= 1d-12) then
tmp = (r * b) / t_0
else
tmp = t_2
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = Math.cos((b + a));
double t_1 = Math.sin(b) / t_0;
double t_2 = r * Math.tan(b);
double tmp;
if (t_1 <= -0.02) {
tmp = t_2;
} else if (t_1 <= 1e-12) {
tmp = (r * b) / t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(r, a, b): t_0 = math.cos((b + a)) t_1 = math.sin(b) / t_0 t_2 = r * math.tan(b) tmp = 0 if t_1 <= -0.02: tmp = t_2 elif t_1 <= 1e-12: tmp = (r * b) / t_0 else: tmp = t_2 return tmp
function code(r, a, b) t_0 = cos(Float64(b + a)) t_1 = Float64(sin(b) / t_0) t_2 = Float64(r * tan(b)) tmp = 0.0 if (t_1 <= -0.02) tmp = t_2; elseif (t_1 <= 1e-12) tmp = Float64(Float64(r * b) / t_0); else tmp = t_2; end return tmp end
function tmp_2 = code(r, a, b) t_0 = cos((b + a)); t_1 = sin(b) / t_0; t_2 = r * tan(b); tmp = 0.0; if (t_1 <= -0.02) tmp = t_2; elseif (t_1 <= 1e-12) tmp = (r * b) / t_0; else tmp = t_2; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[b], $MachinePrecision] / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.02], t$95$2, If[LessEqual[t$95$1, 1e-12], N[(N[(r * b), $MachinePrecision] / t$95$0), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(b + a\right)\\
t_1 := \frac{\sin b}{t\_0}\\
t_2 := r \cdot \tan b\\
\mathbf{if}\;t\_1 \leq -0.02:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-12}:\\
\;\;\;\;\frac{r \cdot b}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) < -0.0200000000000000004 or 9.9999999999999998e-13 < (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) Initial program 52.3%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6452.2
Applied rewrites52.2%
Taylor expanded in a around 0
lower-cos.f6452.5
Applied rewrites52.5%
lift-cos.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
frac-2negN/A
metadata-evalN/A
lift-sin.f64N/A
sin-negN/A
lift-neg.f64N/A
lift-sin.f64N/A
metadata-evalN/A
lift-sin.f64N/A
lift-neg.f64N/A
sin-negN/A
lift-sin.f64N/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6452.5
Applied rewrites52.6%
if -0.0200000000000000004 < (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) < 9.9999999999999998e-13Initial program 98.4%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6498.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.4
Applied rewrites98.4%
Taylor expanded in b around 0
lower-*.f6498.4
Applied rewrites98.4%
Final simplification73.6%
(FPCore (r a b) :precision binary64 (let* ((t_0 (/ (sin b) (cos (+ b a)))) (t_1 (* r (tan b)))) (if (<= t_0 -0.02) t_1 (if (<= t_0 1e-12) (* b (/ r (cos a))) t_1))))
double code(double r, double a, double b) {
double t_0 = sin(b) / cos((b + a));
double t_1 = r * tan(b);
double tmp;
if (t_0 <= -0.02) {
tmp = t_1;
} else if (t_0 <= 1e-12) {
tmp = b * (r / cos(a));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = sin(b) / cos((b + a))
t_1 = r * tan(b)
if (t_0 <= (-0.02d0)) then
tmp = t_1
else if (t_0 <= 1d-12) then
tmp = b * (r / cos(a))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = Math.sin(b) / Math.cos((b + a));
double t_1 = r * Math.tan(b);
double tmp;
if (t_0 <= -0.02) {
tmp = t_1;
} else if (t_0 <= 1e-12) {
tmp = b * (r / Math.cos(a));
} else {
tmp = t_1;
}
return tmp;
}
def code(r, a, b): t_0 = math.sin(b) / math.cos((b + a)) t_1 = r * math.tan(b) tmp = 0 if t_0 <= -0.02: tmp = t_1 elif t_0 <= 1e-12: tmp = b * (r / math.cos(a)) else: tmp = t_1 return tmp
function code(r, a, b) t_0 = Float64(sin(b) / cos(Float64(b + a))) t_1 = Float64(r * tan(b)) tmp = 0.0 if (t_0 <= -0.02) tmp = t_1; elseif (t_0 <= 1e-12) tmp = Float64(b * Float64(r / cos(a))); else tmp = t_1; end return tmp end
function tmp_2 = code(r, a, b) t_0 = sin(b) / cos((b + a)); t_1 = r * tan(b); tmp = 0.0; if (t_0 <= -0.02) tmp = t_1; elseif (t_0 <= 1e-12) tmp = b * (r / cos(a)); else tmp = t_1; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[Sin[b], $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.02], t$95$1, If[LessEqual[t$95$0, 1e-12], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin b}{\cos \left(b + a\right)}\\
t_1 := r \cdot \tan b\\
\mathbf{if}\;t\_0 \leq -0.02:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{-12}:\\
\;\;\;\;b \cdot \frac{r}{\cos a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) < -0.0200000000000000004 or 9.9999999999999998e-13 < (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) Initial program 52.3%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6452.2
Applied rewrites52.2%
Taylor expanded in a around 0
lower-cos.f6452.5
Applied rewrites52.5%
lift-cos.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
frac-2negN/A
metadata-evalN/A
lift-sin.f64N/A
sin-negN/A
lift-neg.f64N/A
lift-sin.f64N/A
metadata-evalN/A
lift-sin.f64N/A
lift-neg.f64N/A
sin-negN/A
lift-sin.f64N/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6452.5
Applied rewrites52.6%
if -0.0200000000000000004 < (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) < 9.9999999999999998e-13Initial program 98.4%
Taylor expanded in b around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f6498.3
Applied rewrites98.3%
Final simplification73.5%
(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 73.4%
Final simplification73.4%
(FPCore (r a b)
:precision binary64
(if (<= b -0.0045)
(* r (tan b))
(if (<= b 0.0046)
(/ (* b (fma -0.16666666666666666 (* r (* b b)) r)) (cos (+ b a)))
(/ r (/ 1.0 (tan b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -0.0045) {
tmp = r * tan(b);
} else if (b <= 0.0046) {
tmp = (b * fma(-0.16666666666666666, (r * (b * b)), r)) / cos((b + a));
} else {
tmp = r / (1.0 / tan(b));
}
return tmp;
}
function code(r, a, b) tmp = 0.0 if (b <= -0.0045) tmp = Float64(r * tan(b)); elseif (b <= 0.0046) tmp = Float64(Float64(b * fma(-0.16666666666666666, Float64(r * Float64(b * b)), r)) / cos(Float64(b + a))); else tmp = Float64(r / Float64(1.0 / tan(b))); end return tmp end
code[r_, a_, b_] := If[LessEqual[b, -0.0045], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.0046], N[(N[(b * N[(-0.16666666666666666 * N[(r * N[(b * b), $MachinePrecision]), $MachinePrecision] + r), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(r / N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0045:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 0.0046:\\
\;\;\;\;\frac{b \cdot \mathsf{fma}\left(-0.16666666666666666, r \cdot \left(b \cdot b\right), r\right)}{\cos \left(b + a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\end{array}
if b < -0.00449999999999999966Initial program 54.1%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6454.0
Applied rewrites54.0%
Taylor expanded in a around 0
lower-cos.f6455.2
Applied rewrites55.2%
lift-cos.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
frac-2negN/A
metadata-evalN/A
lift-sin.f64N/A
sin-negN/A
lift-neg.f64N/A
lift-sin.f64N/A
metadata-evalN/A
lift-sin.f64N/A
lift-neg.f64N/A
sin-negN/A
lift-sin.f64N/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6455.2
Applied rewrites55.4%
if -0.00449999999999999966 < b < 0.0045999999999999999Initial program 98.4%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6498.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.4
Applied rewrites98.4%
Taylor expanded in b around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6498.4
Applied rewrites98.4%
if 0.0045999999999999999 < b Initial program 48.0%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6448.0
Applied rewrites48.0%
Taylor expanded in a around 0
lower-cos.f6447.4
Applied rewrites47.4%
lift-cos.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
frac-2negN/A
metadata-evalN/A
lift-sin.f64N/A
sin-negN/A
lift-neg.f64N/A
lift-sin.f64N/A
metadata-evalN/A
lift-sin.f64N/A
lift-neg.f64N/A
sin-negN/A
lift-sin.f64N/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
Applied rewrites47.6%
Final simplification73.6%
(FPCore (r a b)
:precision binary64
(if (<= b -0.0045)
(* r (tan b))
(if (<= b 0.0046)
(* r (/ (fma b (* b (* b -0.16666666666666666)) b) (cos (+ b a))))
(/ r (/ 1.0 (tan b))))))
double code(double r, double a, double b) {
double tmp;
if (b <= -0.0045) {
tmp = r * tan(b);
} else if (b <= 0.0046) {
tmp = r * (fma(b, (b * (b * -0.16666666666666666)), b) / cos((b + a)));
} else {
tmp = r / (1.0 / tan(b));
}
return tmp;
}
function code(r, a, b) tmp = 0.0 if (b <= -0.0045) tmp = Float64(r * tan(b)); elseif (b <= 0.0046) tmp = Float64(r * Float64(fma(b, Float64(b * Float64(b * -0.16666666666666666)), b) / cos(Float64(b + a)))); else tmp = Float64(r / Float64(1.0 / tan(b))); end return tmp end
code[r_, a_, b_] := If[LessEqual[b, -0.0045], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.0046], N[(r * N[(N[(b * N[(b * N[(b * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r / N[(1.0 / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0045:\\
\;\;\;\;r \cdot \tan b\\
\mathbf{elif}\;b \leq 0.0046:\\
\;\;\;\;r \cdot \frac{\mathsf{fma}\left(b, b \cdot \left(b \cdot -0.16666666666666666\right), b\right)}{\cos \left(b + a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{r}{\frac{1}{\tan b}}\\
\end{array}
\end{array}
if b < -0.00449999999999999966Initial program 54.1%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6454.0
Applied rewrites54.0%
Taylor expanded in a around 0
lower-cos.f6455.2
Applied rewrites55.2%
lift-cos.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
frac-2negN/A
metadata-evalN/A
lift-sin.f64N/A
sin-negN/A
lift-neg.f64N/A
lift-sin.f64N/A
metadata-evalN/A
lift-sin.f64N/A
lift-neg.f64N/A
sin-negN/A
lift-sin.f64N/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6455.2
Applied rewrites55.4%
if -0.00449999999999999966 < b < 0.0045999999999999999Initial program 98.4%
Taylor expanded in b around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6498.4
Applied rewrites98.4%
if 0.0045999999999999999 < b Initial program 48.0%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6448.0
Applied rewrites48.0%
Taylor expanded in a around 0
lower-cos.f6447.4
Applied rewrites47.4%
lift-cos.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
frac-2negN/A
metadata-evalN/A
lift-sin.f64N/A
sin-negN/A
lift-neg.f64N/A
lift-sin.f64N/A
metadata-evalN/A
lift-sin.f64N/A
lift-neg.f64N/A
sin-negN/A
lift-sin.f64N/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
Applied rewrites47.6%
Final simplification73.6%
(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 73.4%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6473.3
Applied rewrites73.3%
Taylor expanded in a around 0
lower-cos.f6460.3
Applied rewrites60.3%
lift-cos.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
frac-2negN/A
metadata-evalN/A
lift-sin.f64N/A
sin-negN/A
lift-neg.f64N/A
lift-sin.f64N/A
metadata-evalN/A
lift-sin.f64N/A
lift-neg.f64N/A
sin-negN/A
lift-sin.f64N/A
frac-2negN/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6460.3
Applied rewrites60.4%
Final simplification60.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 73.4%
lift-sin.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6473.3
Applied rewrites73.3%
Taylor expanded in b around 0
lower-cos.f6451.8
Applied rewrites51.8%
Taylor expanded in a around 0
lower-sin.f6439.0
Applied rewrites39.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 73.4%
Taylor expanded in b around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f6448.2
Applied rewrites48.2%
Taylor expanded in a around 0
lower-*.f6435.1
Applied rewrites35.1%
Final simplification35.1%
herbie shell --seed 2024216
(FPCore (r a b)
:name "rsin B (should all be same)"
:precision binary64
(* r (/ (sin b) (cos (+ a b)))))