
(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 17 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 a) (cos b) (* (- (sin b)) (sin a)))))
double code(double r, double a, double b) {
return (sin(b) * r) / fma(cos(a), cos(b), (-sin(b) * sin(a)));
}
function code(r, a, b) return Float64(Float64(sin(b) * r) / fma(cos(a), cos(b), Float64(Float64(-sin(b)) * sin(a)))) end
code[r_, a_, b_] := N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / N[(N[Cos[a], $MachinePrecision] * N[Cos[b], $MachinePrecision] + N[((-N[Sin[b], $MachinePrecision]) * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin b \cdot r}{\mathsf{fma}\left(\cos a, \cos b, \left(-\sin b\right) \cdot \sin a\right)}
\end{array}
Initial program 76.3%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (r a b)
:precision binary64
(let* ((t_0 (cos (+ a b))))
(if (<= (/ (sin b) t_0) -0.05)
(/ (* (sin b) r) 1.0)
(* (/ (/ 1.0 (/ (fma (* b b) 0.16666666666666666 1.0) b)) t_0) r))))
double code(double r, double a, double b) {
double t_0 = cos((a + b));
double tmp;
if ((sin(b) / t_0) <= -0.05) {
tmp = (sin(b) * r) / 1.0;
} else {
tmp = ((1.0 / (fma((b * b), 0.16666666666666666, 1.0) / b)) / t_0) * r;
}
return tmp;
}
function code(r, a, b) t_0 = cos(Float64(a + b)) tmp = 0.0 if (Float64(sin(b) / t_0) <= -0.05) tmp = Float64(Float64(sin(b) * r) / 1.0); else tmp = Float64(Float64(Float64(1.0 / Float64(fma(Float64(b * b), 0.16666666666666666, 1.0) / b)) / t_0) * r); end return tmp end
code[r_, a_, b_] := Block[{t$95$0 = N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Sin[b], $MachinePrecision] / t$95$0), $MachinePrecision], -0.05], N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / 1.0), $MachinePrecision], N[(N[(N[(1.0 / N[(N[(N[(b * b), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * r), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(a + b\right)\\
\mathbf{if}\;\frac{\sin b}{t\_0} \leq -0.05:\\
\;\;\;\;\frac{\sin b \cdot r}{1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\frac{\mathsf{fma}\left(b \cdot b, 0.16666666666666666, 1\right)}{b}}}{t\_0} \cdot r\\
\end{array}
\end{array}
if (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) < -0.050000000000000003Initial program 48.3%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.2
Applied rewrites99.2%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.3
Applied rewrites99.3%
Taylor expanded in a around 0
Applied rewrites47.9%
Taylor expanded in b around 0
Applied rewrites13.5%
if -0.050000000000000003 < (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) Initial program 85.4%
Taylor expanded in b around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6469.8
Applied rewrites69.8%
Applied rewrites69.7%
Taylor expanded in b around 0
Applied rewrites70.2%
Final simplification56.2%
(FPCore (r a b)
:precision binary64
(let* ((t_0 (* (sin b) r)))
(if (<= a -0.000102)
(/ t_0 (cos a))
(if (<= a 1.05e-5) (/ t_0 (cos b)) (* (/ (sin b) (cos a)) r)))))
double code(double r, double a, double b) {
double t_0 = sin(b) * r;
double tmp;
if (a <= -0.000102) {
tmp = t_0 / cos(a);
} else if (a <= 1.05e-5) {
tmp = t_0 / cos(b);
} else {
tmp = (sin(b) / cos(a)) * 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) :: t_0
real(8) :: tmp
t_0 = sin(b) * r
if (a <= (-0.000102d0)) then
tmp = t_0 / cos(a)
else if (a <= 1.05d-5) then
tmp = t_0 / cos(b)
else
tmp = (sin(b) / cos(a)) * r
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = Math.sin(b) * r;
double tmp;
if (a <= -0.000102) {
tmp = t_0 / Math.cos(a);
} else if (a <= 1.05e-5) {
tmp = t_0 / Math.cos(b);
} else {
tmp = (Math.sin(b) / Math.cos(a)) * r;
}
return tmp;
}
def code(r, a, b): t_0 = math.sin(b) * r tmp = 0 if a <= -0.000102: tmp = t_0 / math.cos(a) elif a <= 1.05e-5: tmp = t_0 / math.cos(b) else: tmp = (math.sin(b) / math.cos(a)) * r return tmp
function code(r, a, b) t_0 = Float64(sin(b) * r) tmp = 0.0 if (a <= -0.000102) tmp = Float64(t_0 / cos(a)); elseif (a <= 1.05e-5) tmp = Float64(t_0 / cos(b)); else tmp = Float64(Float64(sin(b) / cos(a)) * r); end return tmp end
function tmp_2 = code(r, a, b) t_0 = sin(b) * r; tmp = 0.0; if (a <= -0.000102) tmp = t_0 / cos(a); elseif (a <= 1.05e-5) tmp = t_0 / cos(b); else tmp = (sin(b) / cos(a)) * r; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[a, -0.000102], N[(t$95$0 / N[Cos[a], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.05e-5], N[(t$95$0 / N[Cos[b], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin b \cdot r\\
\mathbf{if}\;a \leq -0.000102:\\
\;\;\;\;\frac{t\_0}{\cos a}\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_0}{\cos b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin b}{\cos a} \cdot r\\
\end{array}
\end{array}
if a < -1.01999999999999999e-4Initial program 51.3%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.3
Applied rewrites99.3%
Taylor expanded in b around 0
lower-cos.f6451.6
Applied rewrites51.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lower-/.f6451.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.7
Applied rewrites51.7%
if -1.01999999999999999e-4 < a < 1.04999999999999994e-5Initial program 99.3%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
Applied rewrites99.3%
if 1.04999999999999994e-5 < a Initial program 60.8%
Taylor expanded in b around 0
lower-cos.f6460.8
Applied rewrites60.8%
Final simplification76.4%
(FPCore (r a b) :precision binary64 (if (<= a -0.000102) (* (/ r (cos a)) (sin b)) (if (<= a 1.05e-5) (/ (* (sin b) r) (cos b)) (* (/ (sin b) (cos a)) r))))
double code(double r, double a, double b) {
double tmp;
if (a <= -0.000102) {
tmp = (r / cos(a)) * sin(b);
} else if (a <= 1.05e-5) {
tmp = (sin(b) * r) / cos(b);
} else {
tmp = (sin(b) / cos(a)) * 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 (a <= (-0.000102d0)) then
tmp = (r / cos(a)) * sin(b)
else if (a <= 1.05d-5) then
tmp = (sin(b) * r) / cos(b)
else
tmp = (sin(b) / cos(a)) * r
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double tmp;
if (a <= -0.000102) {
tmp = (r / Math.cos(a)) * Math.sin(b);
} else if (a <= 1.05e-5) {
tmp = (Math.sin(b) * r) / Math.cos(b);
} else {
tmp = (Math.sin(b) / Math.cos(a)) * r;
}
return tmp;
}
def code(r, a, b): tmp = 0 if a <= -0.000102: tmp = (r / math.cos(a)) * math.sin(b) elif a <= 1.05e-5: tmp = (math.sin(b) * r) / math.cos(b) else: tmp = (math.sin(b) / math.cos(a)) * r return tmp
function code(r, a, b) tmp = 0.0 if (a <= -0.000102) tmp = Float64(Float64(r / cos(a)) * sin(b)); elseif (a <= 1.05e-5) tmp = Float64(Float64(sin(b) * r) / cos(b)); else tmp = Float64(Float64(sin(b) / cos(a)) * r); end return tmp end
function tmp_2 = code(r, a, b) tmp = 0.0; if (a <= -0.000102) tmp = (r / cos(a)) * sin(b); elseif (a <= 1.05e-5) tmp = (sin(b) * r) / cos(b); else tmp = (sin(b) / cos(a)) * r; end tmp_2 = tmp; end
code[r_, a_, b_] := If[LessEqual[a, -0.000102], N[(N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision] * N[Sin[b], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.05e-5], N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000102:\\
\;\;\;\;\frac{r}{\cos a} \cdot \sin b\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin b \cdot r}{\cos b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin b}{\cos a} \cdot r\\
\end{array}
\end{array}
if a < -1.01999999999999999e-4Initial program 51.3%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.3
Applied rewrites99.3%
Taylor expanded in b around 0
lower-cos.f6451.6
Applied rewrites51.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6451.6
Applied rewrites51.6%
if -1.01999999999999999e-4 < a < 1.04999999999999994e-5Initial program 99.3%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
Applied rewrites99.3%
if 1.04999999999999994e-5 < a Initial program 60.8%
Taylor expanded in b around 0
lower-cos.f6460.8
Applied rewrites60.8%
Final simplification76.4%
(FPCore (r a b)
:precision binary64
(let* ((t_0 (* (/ (sin b) (cos a)) r)))
(if (<= a -0.000102)
t_0
(if (<= a 1.05e-5) (/ (* (sin b) r) (cos b)) t_0))))
double code(double r, double a, double b) {
double t_0 = (sin(b) / cos(a)) * r;
double tmp;
if (a <= -0.000102) {
tmp = t_0;
} else if (a <= 1.05e-5) {
tmp = (sin(b) * r) / cos(b);
} else {
tmp = t_0;
}
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) :: tmp
t_0 = (sin(b) / cos(a)) * r
if (a <= (-0.000102d0)) then
tmp = t_0
else if (a <= 1.05d-5) then
tmp = (sin(b) * r) / cos(b)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (Math.sin(b) / Math.cos(a)) * r;
double tmp;
if (a <= -0.000102) {
tmp = t_0;
} else if (a <= 1.05e-5) {
tmp = (Math.sin(b) * r) / Math.cos(b);
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = (math.sin(b) / math.cos(a)) * r tmp = 0 if a <= -0.000102: tmp = t_0 elif a <= 1.05e-5: tmp = (math.sin(b) * r) / math.cos(b) else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(Float64(sin(b) / cos(a)) * r) tmp = 0.0 if (a <= -0.000102) tmp = t_0; elseif (a <= 1.05e-5) tmp = Float64(Float64(sin(b) * r) / cos(b)); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = (sin(b) / cos(a)) * r; tmp = 0.0; if (a <= -0.000102) tmp = t_0; elseif (a <= 1.05e-5) tmp = (sin(b) * r) / cos(b); else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[a, -0.000102], t$95$0, If[LessEqual[a, 1.05e-5], N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin b}{\cos a} \cdot r\\
\mathbf{if}\;a \leq -0.000102:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin b \cdot r}{\cos b}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -1.01999999999999999e-4 or 1.04999999999999994e-5 < a Initial program 56.0%
Taylor expanded in b around 0
lower-cos.f6456.2
Applied rewrites56.2%
if -1.01999999999999999e-4 < a < 1.04999999999999994e-5Initial program 99.3%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
Applied rewrites99.3%
Final simplification76.4%
(FPCore (r a b) :precision binary64 (let* ((t_0 (/ (* (sin b) r) (cos b)))) (if (<= b -3.2e-5) t_0 (if (<= b 3e-7) (* (/ r (cos a)) b) t_0))))
double code(double r, double a, double b) {
double t_0 = (sin(b) * r) / cos(b);
double tmp;
if (b <= -3.2e-5) {
tmp = t_0;
} else if (b <= 3e-7) {
tmp = (r / cos(a)) * b;
} else {
tmp = t_0;
}
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) :: tmp
t_0 = (sin(b) * r) / cos(b)
if (b <= (-3.2d-5)) then
tmp = t_0
else if (b <= 3d-7) then
tmp = (r / cos(a)) * b
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (Math.sin(b) * r) / Math.cos(b);
double tmp;
if (b <= -3.2e-5) {
tmp = t_0;
} else if (b <= 3e-7) {
tmp = (r / Math.cos(a)) * b;
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = (math.sin(b) * r) / math.cos(b) tmp = 0 if b <= -3.2e-5: tmp = t_0 elif b <= 3e-7: tmp = (r / math.cos(a)) * b else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(Float64(sin(b) * r) / cos(b)) tmp = 0.0 if (b <= -3.2e-5) tmp = t_0; elseif (b <= 3e-7) tmp = Float64(Float64(r / cos(a)) * b); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = (sin(b) * r) / cos(b); tmp = 0.0; if (b <= -3.2e-5) tmp = t_0; elseif (b <= 3e-7) tmp = (r / cos(a)) * b; else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.2e-5], t$95$0, If[LessEqual[b, 3e-7], N[(N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin b \cdot r}{\cos b}\\
\mathbf{if}\;b \leq -3.2 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 3 \cdot 10^{-7}:\\
\;\;\;\;\frac{r}{\cos a} \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -3.19999999999999986e-5 or 2.9999999999999999e-7 < b Initial program 51.9%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.3
Applied rewrites99.3%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.3
Applied rewrites99.3%
Taylor expanded in a around 0
Applied rewrites51.7%
if -3.19999999999999986e-5 < b < 2.9999999999999999e-7Initial program 99.2%
lift-/.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
inv-powN/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f6499.1
Applied rewrites99.1%
Taylor expanded in b around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f6499.2
Applied rewrites99.2%
Final simplification76.2%
(FPCore (r a b) :precision binary64 (let* ((t_0 (* (/ r (cos b)) (sin b)))) (if (<= b -3.2e-5) t_0 (if (<= b 3e-7) (* (/ r (cos a)) b) t_0))))
double code(double r, double a, double b) {
double t_0 = (r / cos(b)) * sin(b);
double tmp;
if (b <= -3.2e-5) {
tmp = t_0;
} else if (b <= 3e-7) {
tmp = (r / cos(a)) * b;
} else {
tmp = t_0;
}
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) :: tmp
t_0 = (r / cos(b)) * sin(b)
if (b <= (-3.2d-5)) then
tmp = t_0
else if (b <= 3d-7) then
tmp = (r / cos(a)) * b
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (r / Math.cos(b)) * Math.sin(b);
double tmp;
if (b <= -3.2e-5) {
tmp = t_0;
} else if (b <= 3e-7) {
tmp = (r / Math.cos(a)) * b;
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = (r / math.cos(b)) * math.sin(b) tmp = 0 if b <= -3.2e-5: tmp = t_0 elif b <= 3e-7: tmp = (r / math.cos(a)) * b else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(Float64(r / cos(b)) * sin(b)) tmp = 0.0 if (b <= -3.2e-5) tmp = t_0; elseif (b <= 3e-7) tmp = Float64(Float64(r / cos(a)) * b); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = (r / cos(b)) * sin(b); tmp = 0.0; if (b <= -3.2e-5) tmp = t_0; elseif (b <= 3e-7) tmp = (r / cos(a)) * b; else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(r / N[Cos[b], $MachinePrecision]), $MachinePrecision] * N[Sin[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.2e-5], t$95$0, If[LessEqual[b, 3e-7], N[(N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r}{\cos b} \cdot \sin b\\
\mathbf{if}\;b \leq -3.2 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 3 \cdot 10^{-7}:\\
\;\;\;\;\frac{r}{\cos a} \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -3.19999999999999986e-5 or 2.9999999999999999e-7 < b Initial program 51.9%
Taylor expanded in a around 0
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6451.6
Applied rewrites51.6%
if -3.19999999999999986e-5 < b < 2.9999999999999999e-7Initial program 99.2%
lift-/.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
inv-powN/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f6499.1
Applied rewrites99.1%
Taylor expanded in b around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f6499.2
Applied rewrites99.2%
(FPCore (r a b) :precision binary64 (/ (* (sin b) r) (cos (+ a b))))
double code(double r, double a, double b) {
return (sin(b) * r) / 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 = (sin(b) * r) / cos((a + b))
end function
public static double code(double r, double a, double b) {
return (Math.sin(b) * r) / Math.cos((a + b));
}
def code(r, a, b): return (math.sin(b) * r) / math.cos((a + b))
function code(r, a, b) return Float64(Float64(sin(b) * r) / cos(Float64(a + b))) end
function tmp = code(r, a, b) tmp = (sin(b) * r) / cos((a + b)); end
code[r_, a_, b_] := N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin b \cdot r}{\cos \left(a + b\right)}
\end{array}
Initial program 76.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6476.3
Applied rewrites76.3%
(FPCore (r a b) :precision binary64 (* (/ (sin b) (cos (+ a b))) r))
double code(double r, double a, double b) {
return (sin(b) / cos((a + b))) * r;
}
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) / cos((a + b))) * r
end function
public static double code(double r, double a, double b) {
return (Math.sin(b) / Math.cos((a + b))) * r;
}
def code(r, a, b): return (math.sin(b) / math.cos((a + b))) * r
function code(r, a, b) return Float64(Float64(sin(b) / cos(Float64(a + b))) * r) end
function tmp = code(r, a, b) tmp = (sin(b) / cos((a + b))) * r; end
code[r_, a_, b_] := N[(N[(N[Sin[b], $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin b}{\cos \left(a + b\right)} \cdot r
\end{array}
Initial program 76.3%
Taylor expanded in b around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6453.2
Applied rewrites53.2%
Applied rewrites53.1%
Taylor expanded in b around inf
lower-sin.f6476.3
Applied rewrites76.3%
Final simplification76.3%
(FPCore (r a b)
:precision binary64
(let* ((t_0 (/ (* (sin b) r) 1.0)))
(if (<= b -2.8)
t_0
(if (<= b 1.4e+33)
(* (/ (fma (* -0.16666666666666666 (* b b)) b b) (cos (+ a b))) r)
t_0))))
double code(double r, double a, double b) {
double t_0 = (sin(b) * r) / 1.0;
double tmp;
if (b <= -2.8) {
tmp = t_0;
} else if (b <= 1.4e+33) {
tmp = (fma((-0.16666666666666666 * (b * b)), b, b) / cos((a + b))) * r;
} else {
tmp = t_0;
}
return tmp;
}
function code(r, a, b) t_0 = Float64(Float64(sin(b) * r) / 1.0) tmp = 0.0 if (b <= -2.8) tmp = t_0; elseif (b <= 1.4e+33) tmp = Float64(Float64(fma(Float64(-0.16666666666666666 * Float64(b * b)), b, b) / cos(Float64(a + b))) * r); else tmp = t_0; end return tmp end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / 1.0), $MachinePrecision]}, If[LessEqual[b, -2.8], t$95$0, If[LessEqual[b, 1.4e+33], N[(N[(N[(N[(-0.16666666666666666 * N[(b * b), $MachinePrecision]), $MachinePrecision] * b + b), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin b \cdot r}{1}\\
\mathbf{if}\;b \leq -2.8:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{+33}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(b \cdot b\right), b, b\right)}{\cos \left(a + b\right)} \cdot r\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -2.7999999999999998 or 1.4e33 < b Initial program 51.5%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.3
Applied rewrites99.3%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.3
Applied rewrites99.3%
Taylor expanded in a around 0
Applied rewrites51.1%
Taylor expanded in b around 0
Applied rewrites12.3%
if -2.7999999999999998 < b < 1.4e33Initial program 98.5%
Taylor expanded in b around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
lower-pow.f6498.5
Applied rewrites98.5%
Applied rewrites98.5%
Final simplification57.8%
(FPCore (r a b) :precision binary64 (let* ((t_0 (/ (* (sin b) r) 1.0))) (if (<= b -4.5) t_0 (if (<= b 3.2e+34) (* (/ r (cos a)) b) t_0))))
double code(double r, double a, double b) {
double t_0 = (sin(b) * r) / 1.0;
double tmp;
if (b <= -4.5) {
tmp = t_0;
} else if (b <= 3.2e+34) {
tmp = (r / cos(a)) * b;
} else {
tmp = t_0;
}
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) :: tmp
t_0 = (sin(b) * r) / 1.0d0
if (b <= (-4.5d0)) then
tmp = t_0
else if (b <= 3.2d+34) then
tmp = (r / cos(a)) * b
else
tmp = t_0
end if
code = tmp
end function
public static double code(double r, double a, double b) {
double t_0 = (Math.sin(b) * r) / 1.0;
double tmp;
if (b <= -4.5) {
tmp = t_0;
} else if (b <= 3.2e+34) {
tmp = (r / Math.cos(a)) * b;
} else {
tmp = t_0;
}
return tmp;
}
def code(r, a, b): t_0 = (math.sin(b) * r) / 1.0 tmp = 0 if b <= -4.5: tmp = t_0 elif b <= 3.2e+34: tmp = (r / math.cos(a)) * b else: tmp = t_0 return tmp
function code(r, a, b) t_0 = Float64(Float64(sin(b) * r) / 1.0) tmp = 0.0 if (b <= -4.5) tmp = t_0; elseif (b <= 3.2e+34) tmp = Float64(Float64(r / cos(a)) * b); else tmp = t_0; end return tmp end
function tmp_2 = code(r, a, b) t_0 = (sin(b) * r) / 1.0; tmp = 0.0; if (b <= -4.5) tmp = t_0; elseif (b <= 3.2e+34) tmp = (r / cos(a)) * b; else tmp = t_0; end tmp_2 = tmp; end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / 1.0), $MachinePrecision]}, If[LessEqual[b, -4.5], t$95$0, If[LessEqual[b, 3.2e+34], N[(N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin b \cdot r}{1}\\
\mathbf{if}\;b \leq -4.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{+34}:\\
\;\;\;\;\frac{r}{\cos a} \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -4.5 or 3.1999999999999998e34 < b Initial program 51.8%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.3
Applied rewrites99.3%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.3
Applied rewrites99.3%
Taylor expanded in a around 0
Applied rewrites51.3%
Taylor expanded in b around 0
Applied rewrites12.4%
if -4.5 < b < 3.1999999999999998e34Initial program 98.0%
lift-/.f64N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
inv-powN/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f6497.8
Applied rewrites97.8%
Taylor expanded in b around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f6497.7
Applied rewrites97.7%
Final simplification57.7%
(FPCore (r a b) :precision binary64 (/ (* (sin b) r) 1.0))
double code(double r, double a, double b) {
return (sin(b) * r) / 1.0;
}
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
end function
public static double code(double r, double a, double b) {
return (Math.sin(b) * r) / 1.0;
}
def code(r, a, b): return (math.sin(b) * r) / 1.0
function code(r, a, b) return Float64(Float64(sin(b) * r) / 1.0) end
function tmp = code(r, a, b) tmp = (sin(b) * r) / 1.0; end
code[r_, a_, b_] := N[(N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision] / 1.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin b \cdot r}{1}
\end{array}
Initial program 76.3%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in a around 0
Applied rewrites60.3%
Taylor expanded in b around 0
Applied rewrites41.8%
Final simplification41.8%
(FPCore (r a b) :precision binary64 (/ (* b r) (cos b)))
double code(double r, double a, double b) {
return (b * r) / cos(b);
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (b * r) / cos(b)
end function
public static double code(double r, double a, double b) {
return (b * r) / Math.cos(b);
}
def code(r, a, b): return (b * r) / math.cos(b)
function code(r, a, b) return Float64(Float64(b * r) / cos(b)) end
function tmp = code(r, a, b) tmp = (b * r) / cos(b); end
code[r_, a_, b_] := N[(N[(b * r), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot r}{\cos b}
\end{array}
Initial program 76.3%
lift-cos.f64N/A
lift-+.f64N/A
cos-sumN/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in a around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in a around 0
Applied rewrites60.3%
Taylor expanded in b around 0
Applied rewrites37.9%
(FPCore (r a b) :precision binary64 (* (/ b 1.0) r))
double code(double r, double a, double b) {
return (b / 1.0) * r;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (b / 1.0d0) * r
end function
public static double code(double r, double a, double b) {
return (b / 1.0) * r;
}
def code(r, a, b): return (b / 1.0) * r
function code(r, a, b) return Float64(Float64(b / 1.0) * r) end
function tmp = code(r, a, b) tmp = (b / 1.0) * r; end
code[r_, a_, b_] := N[(N[(b / 1.0), $MachinePrecision] * r), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{1} \cdot r
\end{array}
Initial program 76.3%
Taylor expanded in b around 0
lower-/.f64N/A
lower-cos.f6453.6
Applied rewrites53.6%
Taylor expanded in a around 0
Applied rewrites37.6%
Final simplification37.6%
(FPCore (r a b) :precision binary64 (* (fma (* b b) a b) r))
double code(double r, double a, double b) {
return fma((b * b), a, b) * r;
}
function code(r, a, b) return Float64(fma(Float64(b * b), a, b) * r) end
code[r_, a_, b_] := N[(N[(N[(b * b), $MachinePrecision] * a + b), $MachinePrecision] * r), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(b \cdot b, a, b\right) \cdot r
\end{array}
Initial program 76.3%
Taylor expanded in b around 0
+-commutativeN/A
distribute-lft-inN/A
associate-/l*N/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f64N/A
lower-cos.f6453.4
Applied rewrites53.4%
Taylor expanded in a around 0
Applied rewrites35.3%
Taylor expanded in a around inf
Applied rewrites16.5%
Taylor expanded in a around 0
Applied rewrites35.3%
Final simplification35.3%
(FPCore (r a b) :precision binary64 (* (fma (* a b) b b) r))
double code(double r, double a, double b) {
return fma((a * b), b, b) * r;
}
function code(r, a, b) return Float64(fma(Float64(a * b), b, b) * r) end
code[r_, a_, b_] := N[(N[(N[(a * b), $MachinePrecision] * b + b), $MachinePrecision] * r), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a \cdot b, b, b\right) \cdot r
\end{array}
Initial program 76.3%
Taylor expanded in b around 0
+-commutativeN/A
distribute-lft-inN/A
associate-/l*N/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f64N/A
lower-cos.f6453.4
Applied rewrites53.4%
Taylor expanded in a around 0
Applied rewrites35.3%
Applied rewrites35.2%
Final simplification35.2%
(FPCore (r a b) :precision binary64 (* (* (* a b) b) r))
double code(double r, double a, double b) {
return ((a * b) * b) * r;
}
real(8) function code(r, a, b)
real(8), intent (in) :: r
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((a * b) * b) * r
end function
public static double code(double r, double a, double b) {
return ((a * b) * b) * r;
}
def code(r, a, b): return ((a * b) * b) * r
function code(r, a, b) return Float64(Float64(Float64(a * b) * b) * r) end
function tmp = code(r, a, b) tmp = ((a * b) * b) * r; end
code[r_, a_, b_] := N[(N[(N[(a * b), $MachinePrecision] * b), $MachinePrecision] * r), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(a \cdot b\right) \cdot b\right) \cdot r
\end{array}
Initial program 76.3%
Taylor expanded in b around 0
+-commutativeN/A
distribute-lft-inN/A
associate-/l*N/A
associate-*r*N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f64N/A
lower-cos.f6453.4
Applied rewrites53.4%
Taylor expanded in a around 0
Applied rewrites35.3%
Taylor expanded in a around inf
Applied rewrites16.5%
Applied rewrites16.6%
Final simplification16.6%
herbie shell --seed 2024273
(FPCore (r a b)
:name "rsin B (should all be same)"
:precision binary64
(* r (/ (sin b) (cos (+ a b)))))