
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s): return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x))) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x)); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s): return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x))) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x)); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}
(FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* c x)))) (/ (/ (cos (+ x x)) t_0) t_0)))
double code(double x, double c, double s) {
double t_0 = s * (c * x);
return (cos((x + x)) / t_0) / t_0;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = s * (c * x)
code = (cos((x + x)) / t_0) / t_0
end function
public static double code(double x, double c, double s) {
double t_0 = s * (c * x);
return (Math.cos((x + x)) / t_0) / t_0;
}
def code(x, c, s): t_0 = s * (c * x) return (math.cos((x + x)) / t_0) / t_0
function code(x, c, s) t_0 = Float64(s * Float64(c * x)) return Float64(Float64(cos(Float64(x + x)) / t_0) / t_0) end
function tmp = code(x, c, s) t_0 = s * (c * x); tmp = (cos((x + x)) / t_0) / t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \left(c \cdot x\right)\\
\frac{\frac{\cos \left(x + x\right)}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-/.f6466.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.0
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
pow2N/A
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6476.1
lift-pow.f64N/A
unpow2N/A
lower-*.f6476.1
Applied rewrites76.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
unpow-prod-downN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6498.5
lift-*.f64N/A
*-commutativeN/A
lift-*.f6498.5
Applied rewrites98.5%
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lower-+.f6498.5
Applied rewrites98.5%
Final simplification98.5%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* (* s x) c)))
(if (<= (/ (cos (* 2.0 x)) (* (* (* (pow s 2.0) x) x) (pow c 2.0))) -4e-231)
(/
(fma
(fma (fma -0.08888888888888889 (* x x) 0.6666666666666666) (* x x) -2.0)
(* x x)
1.0)
(* (* (* s x) (* (* c c) x)) s))
(/ (/ 1.0 t_0) t_0))))
double code(double x, double c, double s) {
double t_0 = (s * x) * c;
double tmp;
if ((cos((2.0 * x)) / (((pow(s, 2.0) * x) * x) * pow(c, 2.0))) <= -4e-231) {
tmp = fma(fma(fma(-0.08888888888888889, (x * x), 0.6666666666666666), (x * x), -2.0), (x * x), 1.0) / (((s * x) * ((c * c) * x)) * s);
} else {
tmp = (1.0 / t_0) / t_0;
}
return tmp;
}
function code(x, c, s) t_0 = Float64(Float64(s * x) * c) tmp = 0.0 if (Float64(cos(Float64(2.0 * x)) / Float64(Float64(Float64((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= -4e-231) tmp = Float64(fma(fma(fma(-0.08888888888888889, Float64(x * x), 0.6666666666666666), Float64(x * x), -2.0), Float64(x * x), 1.0) / Float64(Float64(Float64(s * x) * Float64(Float64(c * c) * x)) * s)); else tmp = Float64(Float64(1.0 / t_0) / t_0); end return tmp end
code[x_, c_, s_] := Block[{t$95$0 = N[(N[(s * x), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(N[Power[s, 2.0], $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -4e-231], N[(N[(N[(N[(-0.08888888888888889 * N[(x * x), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + -2.0), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(N[(s * x), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * s), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(s \cdot x\right) \cdot c\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -4 \cdot 10^{-231}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.08888888888888889, x \cdot x, 0.6666666666666666\right), x \cdot x, -2\right), x \cdot x, 1\right)}{\left(\left(s \cdot x\right) \cdot \left(\left(c \cdot c\right) \cdot x\right)\right) \cdot s}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -4e-231Initial program 72.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6488.6
Applied rewrites88.6%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.3
Applied rewrites51.3%
if -4e-231 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 65.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-/.f6465.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.6
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
pow2N/A
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6475.2
lift-pow.f64N/A
unpow2N/A
lower-*.f6475.2
Applied rewrites75.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
unpow-prod-downN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6498.4
lift-*.f64N/A
*-commutativeN/A
lift-*.f6498.4
Applied rewrites98.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6484.5
Applied rewrites84.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6485.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.1
Applied rewrites85.1%
Final simplification82.9%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* s (* c x))) (t_1 (* (* s x) c)))
(if (<= (/ (cos (* 2.0 x)) (* (* (* (pow s 2.0) x) x) (pow c 2.0))) -1e-249)
(/ (fma -2.0 (* x x) 1.0) (* t_0 t_0))
(/ (/ 1.0 t_1) t_1))))
double code(double x, double c, double s) {
double t_0 = s * (c * x);
double t_1 = (s * x) * c;
double tmp;
if ((cos((2.0 * x)) / (((pow(s, 2.0) * x) * x) * pow(c, 2.0))) <= -1e-249) {
tmp = fma(-2.0, (x * x), 1.0) / (t_0 * t_0);
} else {
tmp = (1.0 / t_1) / t_1;
}
return tmp;
}
function code(x, c, s) t_0 = Float64(s * Float64(c * x)) t_1 = Float64(Float64(s * x) * c) tmp = 0.0 if (Float64(cos(Float64(2.0 * x)) / Float64(Float64(Float64((s ^ 2.0) * x) * x) * (c ^ 2.0))) <= -1e-249) tmp = Float64(fma(-2.0, Float64(x * x), 1.0) / Float64(t_0 * t_0)); else tmp = Float64(Float64(1.0 / t_1) / t_1); end return tmp end
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(s * x), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(N[Power[s, 2.0], $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-249], N[(N[(-2.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \left(c \cdot x\right)\\
t_1 := \left(s \cdot x\right) \cdot c\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left({s}^{2} \cdot x\right) \cdot x\right) \cdot {c}^{2}} \leq -1 \cdot 10^{-249}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-2, x \cdot x, 1\right)}{t\_0 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_1}}{t\_1}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -1.00000000000000005e-249Initial program 73.9%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
unpow2N/A
unswap-sqrN/A
unpow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6448.8
Applied rewrites48.8%
if -1.00000000000000005e-249 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 65.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-/.f6465.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.4
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
pow2N/A
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6475.1
lift-pow.f64N/A
unpow2N/A
lower-*.f6475.1
Applied rewrites75.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
unpow-prod-downN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6498.4
lift-*.f64N/A
*-commutativeN/A
lift-*.f6498.4
Applied rewrites98.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6484.9
Applied rewrites84.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6485.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.5
Applied rewrites85.5%
Final simplification82.9%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* c x)))) (/ (cos (+ x x)) (* t_0 t_0))))
double code(double x, double c, double s) {
double t_0 = s * (c * x);
return cos((x + x)) / (t_0 * t_0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = s * (c * x)
code = cos((x + x)) / (t_0 * t_0)
end function
public static double code(double x, double c, double s) {
double t_0 = s * (c * x);
return Math.cos((x + x)) / (t_0 * t_0);
}
def code(x, c, s): t_0 = s * (c * x) return math.cos((x + x)) / (t_0 * t_0)
function code(x, c, s) t_0 = Float64(s * Float64(c * x)) return Float64(cos(Float64(x + x)) / Float64(t_0 * t_0)) end
function tmp = code(x, c, s) t_0 = s * (c * x); tmp = cos((x + x)) / (t_0 * t_0); end
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]}, N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \left(c \cdot x\right)\\
\frac{\cos \left(x + x\right)}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Initial program 65.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
unpow2N/A
unswap-sqrN/A
unpow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6498.2
Applied rewrites98.2%
lift-*.f64N/A
count-2N/A
lower-+.f6498.2
Applied rewrites98.2%
Final simplification98.2%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* (* s x) c))) (/ (/ 1.0 t_0) t_0)))
double code(double x, double c, double s) {
double t_0 = (s * x) * c;
return (1.0 / t_0) / t_0;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = (s * x) * c
code = (1.0d0 / t_0) / t_0
end function
public static double code(double x, double c, double s) {
double t_0 = (s * x) * c;
return (1.0 / t_0) / t_0;
}
def code(x, c, s): t_0 = (s * x) * c return (1.0 / t_0) / t_0
function code(x, c, s) t_0 = Float64(Float64(s * x) * c) return Float64(Float64(1.0 / t_0) / t_0) end
function tmp = code(x, c, s) t_0 = (s * x) * c; tmp = (1.0 / t_0) / t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(N[(s * x), $MachinePrecision] * c), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(s \cdot x\right) \cdot c\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-/.f6466.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.0
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
pow2N/A
pow-prod-downN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6476.1
lift-pow.f64N/A
unpow2N/A
lower-*.f6476.1
Applied rewrites76.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-pow.f64N/A
unpow-prod-downN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6498.5
lift-*.f64N/A
*-commutativeN/A
lift-*.f6498.5
Applied rewrites98.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.0
Applied rewrites79.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6479.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.5
Applied rewrites79.5%
Final simplification79.5%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* c x)))) (/ 1.0 (* t_0 t_0))))
double code(double x, double c, double s) {
double t_0 = s * (c * x);
return 1.0 / (t_0 * t_0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = s * (c * x)
code = 1.0d0 / (t_0 * t_0)
end function
public static double code(double x, double c, double s) {
double t_0 = s * (c * x);
return 1.0 / (t_0 * t_0);
}
def code(x, c, s): t_0 = s * (c * x) return 1.0 / (t_0 * t_0)
function code(x, c, s) t_0 = Float64(s * Float64(c * x)) return Float64(1.0 / Float64(t_0 * t_0)) end
function tmp = code(x, c, s) t_0 = s * (c * x); tmp = 1.0 / (t_0 * t_0); end
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(c * x), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \left(c \cdot x\right)\\
\frac{1}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Initial program 65.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
unpow2N/A
unswap-sqrN/A
unpow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6498.2
Applied rewrites98.2%
Taylor expanded in x around 0
Applied rewrites79.8%
Final simplification79.8%
herbie shell --seed 2024243
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))