
(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 14 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 (* x (* s c)))) (/ (/ (cos (* x 2.0)) t_0) t_0)))
double code(double x, double c, double s) {
double t_0 = x * (s * c);
return (cos((x * 2.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 = x * (s * c)
code = (cos((x * 2.0d0)) / t_0) / t_0
end function
public static double code(double x, double c, double s) {
double t_0 = x * (s * c);
return (Math.cos((x * 2.0)) / t_0) / t_0;
}
def code(x, c, s): t_0 = x * (s * c) return (math.cos((x * 2.0)) / t_0) / t_0
function code(x, c, s) t_0 = Float64(x * Float64(s * c)) return Float64(Float64(cos(Float64(x * 2.0)) / t_0) / t_0) end
function tmp = code(x, c, s) t_0 = x * (s * c); tmp = (cos((x * 2.0)) / t_0) / t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(s \cdot c\right)\\
\frac{\frac{\cos \left(x \cdot 2\right)}{t_0}}{t_0}
\end{array}
\end{array}
Initial program 69.9%
associate-/r*69.6%
remove-double-neg69.6%
distribute-lft-neg-out69.6%
distribute-lft-neg-out69.6%
distribute-rgt-neg-out69.6%
associate-/l/69.9%
distribute-rgt-neg-out69.9%
distribute-lft-neg-out69.9%
associate-*l*73.2%
distribute-lft-neg-in73.2%
distribute-lft-neg-out73.2%
remove-double-neg73.2%
associate-*r*72.7%
*-commutative72.7%
associate-*r*70.9%
Simplified76.0%
Taylor expanded in x around 0 62.7%
unpow262.7%
unpow262.7%
unpow262.7%
swap-sqr78.8%
swap-sqr97.3%
unpow297.3%
associate-*r*98.0%
*-commutative98.0%
associate-*l*98.1%
Simplified98.1%
*-un-lft-identity98.1%
unpow298.1%
times-frac98.2%
*-commutative98.2%
Applied egg-rr98.2%
associate-*l/98.2%
Applied egg-rr98.2%
Final simplification98.2%
(FPCore (x c s) :precision binary64 (if (<= x 1.45e-8) (/ 1.0 (pow (* c (* x s)) 2.0)) (/ (cos (* x 2.0)) (* x (* x (* c (* c (* s s))))))))
double code(double x, double c, double s) {
double tmp;
if (x <= 1.45e-8) {
tmp = 1.0 / pow((c * (x * s)), 2.0);
} else {
tmp = cos((x * 2.0)) / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 1.45d-8) then
tmp = 1.0d0 / ((c * (x * s)) ** 2.0d0)
else
tmp = cos((x * 2.0d0)) / (x * (x * (c * (c * (s * s)))))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (x <= 1.45e-8) {
tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
} else {
tmp = Math.cos((x * 2.0)) / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
def code(x, c, s): tmp = 0 if x <= 1.45e-8: tmp = 1.0 / math.pow((c * (x * s)), 2.0) else: tmp = math.cos((x * 2.0)) / (x * (x * (c * (c * (s * s))))) return tmp
function code(x, c, s) tmp = 0.0 if (x <= 1.45e-8) tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (x <= 1.45e-8) tmp = 1.0 / ((c * (x * s)) ^ 2.0); else tmp = cos((x * 2.0)) / (x * (x * (c * (c * (s * s))))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[x, 1.45e-8], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45 \cdot 10^{-8}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 1.4500000000000001e-8Initial program 71.8%
associate-/r*71.2%
remove-double-neg71.2%
distribute-lft-neg-out71.2%
distribute-lft-neg-out71.2%
distribute-rgt-neg-out71.2%
associate-/l/71.8%
distribute-rgt-neg-out71.8%
distribute-lft-neg-out71.8%
associate-*l*75.8%
distribute-lft-neg-in75.8%
distribute-lft-neg-out75.8%
remove-double-neg75.8%
associate-*r*75.5%
*-commutative75.5%
associate-*r*73.2%
Simplified77.3%
Taylor expanded in x around 0 63.7%
unpow263.7%
unpow263.7%
unpow263.7%
swap-sqr79.2%
swap-sqr97.0%
unpow297.0%
associate-*r*98.6%
*-commutative98.6%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in x around 0 59.1%
unpow259.1%
unpow259.1%
unpow259.1%
associate-*r*59.2%
*-commutative59.2%
swap-sqr70.8%
swap-sqr86.3%
associate-*r*85.8%
associate-*r*86.8%
unpow286.8%
associate-*r*86.3%
*-commutative86.3%
associate-*r*85.6%
Simplified85.6%
if 1.4500000000000001e-8 < x Initial program 65.2%
associate-/r*65.6%
remove-double-neg65.6%
distribute-lft-neg-out65.6%
distribute-lft-neg-out65.6%
distribute-rgt-neg-out65.6%
associate-/l/65.2%
distribute-rgt-neg-out65.2%
distribute-lft-neg-out65.2%
associate-*l*67.2%
distribute-lft-neg-in67.2%
distribute-lft-neg-out67.2%
remove-double-neg67.2%
associate-*r*66.0%
*-commutative66.0%
associate-*r*65.5%
Simplified72.8%
Final simplification81.8%
(FPCore (x c s) :precision binary64 (if (<= x 4.8e-51) (/ 1.0 (pow (* c (* x s)) 2.0)) (/ (cos (* x 2.0)) (* x (* x (* (* s c) (* s c)))))))
double code(double x, double c, double s) {
double tmp;
if (x <= 4.8e-51) {
tmp = 1.0 / pow((c * (x * s)), 2.0);
} else {
tmp = cos((x * 2.0)) / (x * (x * ((s * c) * (s * c))));
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 4.8d-51) then
tmp = 1.0d0 / ((c * (x * s)) ** 2.0d0)
else
tmp = cos((x * 2.0d0)) / (x * (x * ((s * c) * (s * c))))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (x <= 4.8e-51) {
tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
} else {
tmp = Math.cos((x * 2.0)) / (x * (x * ((s * c) * (s * c))));
}
return tmp;
}
def code(x, c, s): tmp = 0 if x <= 4.8e-51: tmp = 1.0 / math.pow((c * (x * s)), 2.0) else: tmp = math.cos((x * 2.0)) / (x * (x * ((s * c) * (s * c)))) return tmp
function code(x, c, s) tmp = 0.0 if (x <= 4.8e-51) tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(x * Float64(Float64(s * c) * Float64(s * c))))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (x <= 4.8e-51) tmp = 1.0 / ((c * (x * s)) ^ 2.0); else tmp = cos((x * 2.0)) / (x * (x * ((s * c) * (s * c)))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[x, 4.8e-51], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(N[(s * c), $MachinePrecision] * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.8 \cdot 10^{-51}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)\right)}\\
\end{array}
\end{array}
if x < 4.8e-51Initial program 70.9%
associate-/r*70.2%
remove-double-neg70.2%
distribute-lft-neg-out70.2%
distribute-lft-neg-out70.2%
distribute-rgt-neg-out70.2%
associate-/l/70.9%
distribute-rgt-neg-out70.9%
distribute-lft-neg-out70.9%
associate-*l*75.1%
distribute-lft-neg-in75.1%
distribute-lft-neg-out75.1%
remove-double-neg75.1%
associate-*r*74.8%
*-commutative74.8%
associate-*r*72.4%
Simplified76.8%
Taylor expanded in x around 0 62.1%
unpow262.1%
unpow262.1%
unpow262.1%
swap-sqr78.8%
swap-sqr96.8%
unpow296.8%
associate-*r*98.6%
*-commutative98.6%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in x around 0 57.2%
unpow257.2%
unpow257.2%
unpow257.2%
associate-*r*57.3%
*-commutative57.3%
swap-sqr68.6%
swap-sqr85.3%
associate-*r*84.7%
associate-*r*85.8%
unpow285.8%
associate-*r*85.3%
*-commutative85.3%
associate-*r*84.5%
Simplified84.5%
if 4.8e-51 < x Initial program 68.0%
associate-/r*68.4%
remove-double-neg68.4%
distribute-lft-neg-out68.4%
distribute-lft-neg-out68.4%
distribute-rgt-neg-out68.4%
associate-/l/68.0%
distribute-rgt-neg-out68.0%
distribute-lft-neg-out68.0%
associate-*l*69.7%
distribute-lft-neg-in69.7%
distribute-lft-neg-out69.7%
remove-double-neg69.7%
associate-*r*68.7%
*-commutative68.7%
associate-*r*68.2%
Simplified74.5%
Taylor expanded in x around 0 68.8%
unpow268.8%
associate-*r*68.2%
unpow268.2%
swap-sqr84.2%
unpow284.2%
*-commutative84.2%
Simplified84.2%
unpow284.2%
*-commutative84.2%
*-commutative84.2%
Applied egg-rr84.2%
Final simplification84.4%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* x c)))) (/ (cos (* x 2.0)) (* t_0 t_0))))
double code(double x, double c, double s) {
double t_0 = s * (x * c);
return cos((x * 2.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 = cos((x * 2.0d0)) / (t_0 * t_0)
end function
public static double code(double x, double c, double s) {
double t_0 = s * (x * c);
return Math.cos((x * 2.0)) / (t_0 * t_0);
}
def code(x, c, s): t_0 = s * (x * c) return math.cos((x * 2.0)) / (t_0 * t_0)
function code(x, c, s) t_0 = Float64(s * Float64(x * c)) return Float64(cos(Float64(x * 2.0)) / Float64(t_0 * t_0)) end
function tmp = code(x, c, s) t_0 = s * (x * c); tmp = cos((x * 2.0)) / (t_0 * t_0); end
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 69.9%
associate-/r*69.6%
remove-double-neg69.6%
distribute-lft-neg-out69.6%
distribute-lft-neg-out69.6%
distribute-rgt-neg-out69.6%
associate-/l/69.9%
distribute-rgt-neg-out69.9%
distribute-lft-neg-out69.9%
associate-*l*73.2%
distribute-lft-neg-in73.2%
distribute-lft-neg-out73.2%
remove-double-neg73.2%
associate-*r*72.7%
*-commutative72.7%
associate-*r*70.9%
Simplified76.0%
Taylor expanded in x around 0 62.7%
unpow262.7%
unpow262.7%
unpow262.7%
swap-sqr78.8%
swap-sqr97.3%
unpow297.3%
associate-*r*98.0%
*-commutative98.0%
associate-*l*98.1%
Simplified98.1%
unpow278.1%
Applied egg-rr98.1%
Final simplification98.1%
(FPCore (x c s) :precision binary64 (if (<= c 2.9e-289) (/ (+ 1.0 (* -2.0 (* x x))) (* x (* x (* c (* c (* s s)))))) (/ 1.0 (pow (* c (* x s)) 2.0))))
double code(double x, double c, double s) {
double tmp;
if (c <= 2.9e-289) {
tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s)))));
} else {
tmp = 1.0 / pow((c * (x * s)), 2.0);
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (c <= 2.9d-289) then
tmp = (1.0d0 + ((-2.0d0) * (x * x))) / (x * (x * (c * (c * (s * s)))))
else
tmp = 1.0d0 / ((c * (x * s)) ** 2.0d0)
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (c <= 2.9e-289) {
tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s)))));
} else {
tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
}
return tmp;
}
def code(x, c, s): tmp = 0 if c <= 2.9e-289: tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s))))) else: tmp = 1.0 / math.pow((c * (x * s)), 2.0) return tmp
function code(x, c, s) tmp = 0.0 if (c <= 2.9e-289) tmp = Float64(Float64(1.0 + Float64(-2.0 * Float64(x * x))) / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))); else tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (c <= 2.9e-289) tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s))))); else tmp = 1.0 / ((c * (x * s)) ^ 2.0); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[c, 2.9e-289], N[(N[(1.0 + N[(-2.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq 2.9 \cdot 10^{-289}:\\
\;\;\;\;\frac{1 + -2 \cdot \left(x \cdot x\right)}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\end{array}
\end{array}
if c < 2.90000000000000006e-289Initial program 69.5%
associate-/r*68.9%
remove-double-neg68.9%
distribute-lft-neg-out68.9%
distribute-lft-neg-out68.9%
distribute-rgt-neg-out68.9%
associate-/l/69.5%
distribute-rgt-neg-out69.5%
distribute-lft-neg-out69.5%
associate-*l*73.6%
distribute-lft-neg-in73.6%
distribute-lft-neg-out73.6%
remove-double-neg73.6%
associate-*r*74.8%
*-commutative74.8%
associate-*r*74.1%
Simplified80.5%
Taylor expanded in x around 0 53.3%
unpow248.2%
Simplified53.3%
if 2.90000000000000006e-289 < c Initial program 70.3%
associate-/r*70.2%
remove-double-neg70.2%
distribute-lft-neg-out70.2%
distribute-lft-neg-out70.2%
distribute-rgt-neg-out70.2%
associate-/l/70.3%
distribute-rgt-neg-out70.3%
distribute-lft-neg-out70.3%
associate-*l*72.9%
distribute-lft-neg-in72.9%
distribute-lft-neg-out72.9%
remove-double-neg72.9%
associate-*r*70.5%
*-commutative70.5%
associate-*r*67.8%
Simplified71.6%
Taylor expanded in x around 0 62.3%
unpow262.3%
unpow262.3%
unpow262.3%
swap-sqr80.8%
swap-sqr98.3%
unpow298.3%
associate-*r*96.7%
*-commutative96.7%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in x around 0 55.7%
unpow255.7%
unpow255.7%
unpow255.7%
associate-*r*55.7%
*-commutative55.7%
swap-sqr66.3%
swap-sqr77.1%
associate-*r*76.2%
associate-*r*77.8%
unpow277.8%
associate-*r*77.1%
*-commutative77.1%
associate-*r*78.2%
Simplified78.2%
Final simplification65.8%
(FPCore (x c s) :precision binary64 (if (<= c 2.9e-289) (/ (+ 1.0 (* -2.0 (* x x))) (* x (* x (* c (* c (* s s)))))) (pow (* c (* x s)) -2.0)))
double code(double x, double c, double s) {
double tmp;
if (c <= 2.9e-289) {
tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s)))));
} else {
tmp = pow((c * (x * s)), -2.0);
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (c <= 2.9d-289) then
tmp = (1.0d0 + ((-2.0d0) * (x * x))) / (x * (x * (c * (c * (s * s)))))
else
tmp = (c * (x * s)) ** (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (c <= 2.9e-289) {
tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s)))));
} else {
tmp = Math.pow((c * (x * s)), -2.0);
}
return tmp;
}
def code(x, c, s): tmp = 0 if c <= 2.9e-289: tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s))))) else: tmp = math.pow((c * (x * s)), -2.0) return tmp
function code(x, c, s) tmp = 0.0 if (c <= 2.9e-289) tmp = Float64(Float64(1.0 + Float64(-2.0 * Float64(x * x))) / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))); else tmp = Float64(c * Float64(x * s)) ^ -2.0; end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (c <= 2.9e-289) tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s))))); else tmp = (c * (x * s)) ^ -2.0; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[c, 2.9e-289], N[(N[(1.0 + N[(-2.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq 2.9 \cdot 10^{-289}:\\
\;\;\;\;\frac{1 + -2 \cdot \left(x \cdot x\right)}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\end{array}
\end{array}
if c < 2.90000000000000006e-289Initial program 69.5%
associate-/r*68.9%
remove-double-neg68.9%
distribute-lft-neg-out68.9%
distribute-lft-neg-out68.9%
distribute-rgt-neg-out68.9%
associate-/l/69.5%
distribute-rgt-neg-out69.5%
distribute-lft-neg-out69.5%
associate-*l*73.6%
distribute-lft-neg-in73.6%
distribute-lft-neg-out73.6%
remove-double-neg73.6%
associate-*r*74.8%
*-commutative74.8%
associate-*r*74.1%
Simplified80.5%
Taylor expanded in x around 0 53.3%
unpow248.2%
Simplified53.3%
if 2.90000000000000006e-289 < c Initial program 70.3%
associate-/r*70.2%
remove-double-neg70.2%
distribute-lft-neg-out70.2%
distribute-lft-neg-out70.2%
distribute-rgt-neg-out70.2%
associate-/l/70.3%
distribute-rgt-neg-out70.3%
distribute-lft-neg-out70.3%
associate-*l*72.9%
distribute-lft-neg-in72.9%
distribute-lft-neg-out72.9%
remove-double-neg72.9%
associate-*r*70.5%
*-commutative70.5%
associate-*r*67.8%
Simplified71.6%
Taylor expanded in x around 0 62.3%
unpow262.3%
unpow262.3%
unpow262.3%
swap-sqr80.8%
swap-sqr98.3%
unpow298.3%
associate-*r*96.7%
*-commutative96.7%
associate-*l*97.5%
Simplified97.5%
*-un-lft-identity97.5%
unpow297.5%
times-frac97.4%
*-commutative97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 55.7%
*-commutative55.7%
unpow255.7%
*-commutative55.7%
associate-*l*55.7%
unpow255.7%
unpow255.7%
swap-sqr66.3%
swap-sqr77.1%
associate-/r*77.0%
*-lft-identity77.0%
associate-*l/77.0%
unpow-177.0%
unpow-177.0%
pow-sqr77.0%
*-commutative77.0%
*-commutative77.0%
associate-*r*78.2%
metadata-eval78.2%
Simplified78.2%
Final simplification65.8%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (/ 1.0 (* c (* x s)))))
(if (<= c 2.9e-289)
(/ (+ 1.0 (* -2.0 (* x x))) (* x (* x (* c (* c (* s s))))))
(* t_0 t_0))))
double code(double x, double c, double s) {
double t_0 = 1.0 / (c * (x * s));
double tmp;
if (c <= 2.9e-289) {
tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s)))));
} else {
tmp = t_0 * t_0;
}
return tmp;
}
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
real(8) :: tmp
t_0 = 1.0d0 / (c * (x * s))
if (c <= 2.9d-289) then
tmp = (1.0d0 + ((-2.0d0) * (x * x))) / (x * (x * (c * (c * (s * s)))))
else
tmp = t_0 * t_0
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = 1.0 / (c * (x * s));
double tmp;
if (c <= 2.9e-289) {
tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s)))));
} else {
tmp = t_0 * t_0;
}
return tmp;
}
def code(x, c, s): t_0 = 1.0 / (c * (x * s)) tmp = 0 if c <= 2.9e-289: tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s))))) else: tmp = t_0 * t_0 return tmp
function code(x, c, s) t_0 = Float64(1.0 / Float64(c * Float64(x * s))) tmp = 0.0 if (c <= 2.9e-289) tmp = Float64(Float64(1.0 + Float64(-2.0 * Float64(x * x))) / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))); else tmp = Float64(t_0 * t_0); end return tmp end
function tmp_2 = code(x, c, s) t_0 = 1.0 / (c * (x * s)); tmp = 0.0; if (c <= 2.9e-289) tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (c * (s * s))))); else tmp = t_0 * t_0; end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, 2.9e-289], N[(N[(1.0 + N[(-2.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{c \cdot \left(x \cdot s\right)}\\
\mathbf{if}\;c \leq 2.9 \cdot 10^{-289}:\\
\;\;\;\;\frac{1 + -2 \cdot \left(x \cdot x\right)}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot t_0\\
\end{array}
\end{array}
if c < 2.90000000000000006e-289Initial program 69.5%
associate-/r*68.9%
remove-double-neg68.9%
distribute-lft-neg-out68.9%
distribute-lft-neg-out68.9%
distribute-rgt-neg-out68.9%
associate-/l/69.5%
distribute-rgt-neg-out69.5%
distribute-lft-neg-out69.5%
associate-*l*73.6%
distribute-lft-neg-in73.6%
distribute-lft-neg-out73.6%
remove-double-neg73.6%
associate-*r*74.8%
*-commutative74.8%
associate-*r*74.1%
Simplified80.5%
Taylor expanded in x around 0 53.3%
unpow248.2%
Simplified53.3%
if 2.90000000000000006e-289 < c Initial program 70.3%
associate-/r*70.2%
remove-double-neg70.2%
distribute-lft-neg-out70.2%
distribute-lft-neg-out70.2%
distribute-rgt-neg-out70.2%
associate-/l/70.3%
distribute-rgt-neg-out70.3%
distribute-lft-neg-out70.3%
associate-*l*72.9%
distribute-lft-neg-in72.9%
distribute-lft-neg-out72.9%
remove-double-neg72.9%
associate-*r*70.5%
*-commutative70.5%
associate-*r*67.8%
Simplified71.6%
Taylor expanded in x around 0 62.3%
unpow262.3%
unpow262.3%
unpow262.3%
swap-sqr80.8%
swap-sqr98.3%
unpow298.3%
associate-*r*96.7%
*-commutative96.7%
associate-*l*97.5%
Simplified97.5%
*-un-lft-identity97.5%
unpow297.5%
times-frac97.4%
*-commutative97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 77.3%
Taylor expanded in s around 0 78.1%
Final simplification65.8%
(FPCore (x c s) :precision binary64 (if (<= x 3.8e-51) (/ 1.0 (* x (* (* c c) (* s (* x s))))) (/ 1.0 (* x (* x (* c (* c (* s s))))))))
double code(double x, double c, double s) {
double tmp;
if (x <= 3.8e-51) {
tmp = 1.0 / (x * ((c * c) * (s * (x * s))));
} else {
tmp = 1.0 / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 3.8d-51) then
tmp = 1.0d0 / (x * ((c * c) * (s * (x * s))))
else
tmp = 1.0d0 / (x * (x * (c * (c * (s * s)))))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (x <= 3.8e-51) {
tmp = 1.0 / (x * ((c * c) * (s * (x * s))));
} else {
tmp = 1.0 / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
def code(x, c, s): tmp = 0 if x <= 3.8e-51: tmp = 1.0 / (x * ((c * c) * (s * (x * s)))) else: tmp = 1.0 / (x * (x * (c * (c * (s * s))))) return tmp
function code(x, c, s) tmp = 0.0 if (x <= 3.8e-51) tmp = Float64(1.0 / Float64(x * Float64(Float64(c * c) * Float64(s * Float64(x * s))))); else tmp = Float64(1.0 / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (x <= 3.8e-51) tmp = 1.0 / (x * ((c * c) * (s * (x * s)))); else tmp = 1.0 / (x * (x * (c * (c * (s * s))))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[x, 3.8e-51], N[(1.0 / N[(x * N[(N[(c * c), $MachinePrecision] * N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.8 \cdot 10^{-51}:\\
\;\;\;\;\frac{1}{x \cdot \left(\left(c \cdot c\right) \cdot \left(s \cdot \left(x \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 3.80000000000000003e-51Initial program 70.9%
associate-/r*70.2%
remove-double-neg70.2%
distribute-lft-neg-out70.2%
distribute-lft-neg-out70.2%
distribute-rgt-neg-out70.2%
associate-/l/70.9%
distribute-rgt-neg-out70.9%
distribute-lft-neg-out70.9%
associate-*l*75.1%
distribute-lft-neg-in75.1%
distribute-lft-neg-out75.1%
remove-double-neg75.1%
associate-*r*74.8%
*-commutative74.8%
associate-*r*72.4%
Simplified76.8%
Taylor expanded in x around 0 69.2%
Taylor expanded in x around 0 66.2%
unpow266.2%
associate-*r*65.4%
*-commutative65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in s around 0 66.2%
unpow266.2%
unpow266.2%
associate-*l*71.6%
Simplified71.6%
if 3.80000000000000003e-51 < x Initial program 68.0%
associate-/r*68.4%
remove-double-neg68.4%
distribute-lft-neg-out68.4%
distribute-lft-neg-out68.4%
distribute-rgt-neg-out68.4%
associate-/l/68.0%
distribute-rgt-neg-out68.0%
distribute-lft-neg-out68.0%
associate-*l*69.7%
distribute-lft-neg-in69.7%
distribute-lft-neg-out69.7%
remove-double-neg69.7%
associate-*r*68.7%
*-commutative68.7%
associate-*r*68.2%
Simplified74.5%
Taylor expanded in x around 0 56.7%
Final simplification66.4%
(FPCore (x c s) :precision binary64 (let* ((t_0 (/ 1.0 (* c (* x s))))) (* t_0 t_0)))
double code(double x, double c, double s) {
double t_0 = 1.0 / (c * (x * s));
return 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 = 1.0d0 / (c * (x * s))
code = t_0 * t_0
end function
public static double code(double x, double c, double s) {
double t_0 = 1.0 / (c * (x * s));
return t_0 * t_0;
}
def code(x, c, s): t_0 = 1.0 / (c * (x * s)) return t_0 * t_0
function code(x, c, s) t_0 = Float64(1.0 / Float64(c * Float64(x * s))) return Float64(t_0 * t_0) end
function tmp = code(x, c, s) t_0 = 1.0 / (c * (x * s)); tmp = t_0 * t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{c \cdot \left(x \cdot s\right)}\\
t_0 \cdot t_0
\end{array}
\end{array}
Initial program 69.9%
associate-/r*69.6%
remove-double-neg69.6%
distribute-lft-neg-out69.6%
distribute-lft-neg-out69.6%
distribute-rgt-neg-out69.6%
associate-/l/69.9%
distribute-rgt-neg-out69.9%
distribute-lft-neg-out69.9%
associate-*l*73.2%
distribute-lft-neg-in73.2%
distribute-lft-neg-out73.2%
remove-double-neg73.2%
associate-*r*72.7%
*-commutative72.7%
associate-*r*70.9%
Simplified76.0%
Taylor expanded in x around 0 62.7%
unpow262.7%
unpow262.7%
unpow262.7%
swap-sqr78.8%
swap-sqr97.3%
unpow297.3%
associate-*r*98.0%
*-commutative98.0%
associate-*l*98.1%
Simplified98.1%
*-un-lft-identity98.1%
unpow298.1%
times-frac98.2%
*-commutative98.2%
Applied egg-rr98.2%
Taylor expanded in x around 0 76.8%
Taylor expanded in s around 0 77.1%
Final simplification77.1%
(FPCore (x c s) :precision binary64 (/ 1.0 (* x (* x (* c (* c (* s s)))))))
double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (c * (s * s)))));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / (x * (x * (c * (c * (s * s)))))
end function
public static double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (c * (s * s)))));
}
def code(x, c, s): return 1.0 / (x * (x * (c * (c * (s * s)))))
function code(x, c, s) return Float64(1.0 / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))) end
function tmp = code(x, c, s) tmp = 1.0 / (x * (x * (c * (c * (s * s))))); end
code[x_, c_, s_] := N[(1.0 / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}
\end{array}
Initial program 69.9%
associate-/r*69.6%
remove-double-neg69.6%
distribute-lft-neg-out69.6%
distribute-lft-neg-out69.6%
distribute-rgt-neg-out69.6%
associate-/l/69.9%
distribute-rgt-neg-out69.9%
distribute-lft-neg-out69.9%
associate-*l*73.2%
distribute-lft-neg-in73.2%
distribute-lft-neg-out73.2%
remove-double-neg73.2%
associate-*r*72.7%
*-commutative72.7%
associate-*r*70.9%
Simplified76.0%
Taylor expanded in x around 0 64.9%
Final simplification64.9%
(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(s * Float64(x * c)) return Float64(1.0 / Float64(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[(s * N[(x * c), $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(x \cdot c\right)\\
\frac{1}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 69.9%
associate-/r*69.6%
remove-double-neg69.6%
distribute-lft-neg-out69.6%
distribute-lft-neg-out69.6%
distribute-rgt-neg-out69.6%
associate-/r*69.9%
unpow269.9%
*-commutative69.9%
associate-*r*62.7%
sqr-neg62.7%
associate-*r*69.9%
unpow269.9%
Simplified69.9%
Taylor expanded in x around 0 54.9%
unpow254.9%
unpow254.9%
unpow254.9%
swap-sqr65.6%
swap-sqr77.2%
unpow277.2%
associate-*r*77.7%
*-commutative77.7%
associate-*l*78.1%
Simplified78.1%
unpow278.1%
Applied egg-rr78.1%
Final simplification78.1%
(FPCore (x c s) :precision binary64 (/ (/ 1.0 (* c (* x s))) (* x (* s c))))
double code(double x, double c, double s) {
return (1.0 / (c * (x * s))) / (x * (s * c));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = (1.0d0 / (c * (x * s))) / (x * (s * c))
end function
public static double code(double x, double c, double s) {
return (1.0 / (c * (x * s))) / (x * (s * c));
}
def code(x, c, s): return (1.0 / (c * (x * s))) / (x * (s * c))
function code(x, c, s) return Float64(Float64(1.0 / Float64(c * Float64(x * s))) / Float64(x * Float64(s * c))) end
function tmp = code(x, c, s) tmp = (1.0 / (c * (x * s))) / (x * (s * c)); end
code[x_, c_, s_] := N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{x \cdot \left(s \cdot c\right)}
\end{array}
Initial program 69.9%
associate-/r*69.6%
remove-double-neg69.6%
distribute-lft-neg-out69.6%
distribute-lft-neg-out69.6%
distribute-rgt-neg-out69.6%
associate-/l/69.9%
distribute-rgt-neg-out69.9%
distribute-lft-neg-out69.9%
associate-*l*73.2%
distribute-lft-neg-in73.2%
distribute-lft-neg-out73.2%
remove-double-neg73.2%
associate-*r*72.7%
*-commutative72.7%
associate-*r*70.9%
Simplified76.0%
Taylor expanded in x around 0 62.7%
unpow262.7%
unpow262.7%
unpow262.7%
swap-sqr78.8%
swap-sqr97.3%
unpow297.3%
associate-*r*98.0%
*-commutative98.0%
associate-*l*98.1%
Simplified98.1%
*-un-lft-identity98.1%
unpow298.1%
times-frac98.2%
*-commutative98.2%
Applied egg-rr98.2%
associate-*l/98.2%
Applied egg-rr98.2%
Taylor expanded in x around 0 76.4%
Final simplification76.4%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* x (* s c)))) (/ (/ 1.0 t_0) t_0)))
double code(double x, double c, double s) {
double t_0 = x * (s * 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 = x * (s * c)
code = (1.0d0 / t_0) / t_0
end function
public static double code(double x, double c, double s) {
double t_0 = x * (s * c);
return (1.0 / t_0) / t_0;
}
def code(x, c, s): t_0 = x * (s * c) return (1.0 / t_0) / t_0
function code(x, c, s) t_0 = Float64(x * Float64(s * c)) return Float64(Float64(1.0 / t_0) / t_0) end
function tmp = code(x, c, s) t_0 = x * (s * c); tmp = (1.0 / t_0) / t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(s \cdot c\right)\\
\frac{\frac{1}{t_0}}{t_0}
\end{array}
\end{array}
Initial program 69.9%
associate-/r*69.6%
remove-double-neg69.6%
distribute-lft-neg-out69.6%
distribute-lft-neg-out69.6%
distribute-rgt-neg-out69.6%
associate-/l/69.9%
distribute-rgt-neg-out69.9%
distribute-lft-neg-out69.9%
associate-*l*73.2%
distribute-lft-neg-in73.2%
distribute-lft-neg-out73.2%
remove-double-neg73.2%
associate-*r*72.7%
*-commutative72.7%
associate-*r*70.9%
Simplified76.0%
Taylor expanded in x around 0 62.7%
unpow262.7%
unpow262.7%
unpow262.7%
swap-sqr78.8%
swap-sqr97.3%
unpow297.3%
associate-*r*98.0%
*-commutative98.0%
associate-*l*98.1%
Simplified98.1%
*-un-lft-identity98.1%
unpow298.1%
times-frac98.2%
*-commutative98.2%
Applied egg-rr98.2%
associate-*l/98.2%
Applied egg-rr98.2%
Taylor expanded in x around 0 77.7%
Final simplification77.7%
(FPCore (x c s) :precision binary64 (/ -2.0 (* (* s s) (* c c))))
double code(double x, double c, double s) {
return -2.0 / ((s * s) * (c * c));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = (-2.0d0) / ((s * s) * (c * c))
end function
public static double code(double x, double c, double s) {
return -2.0 / ((s * s) * (c * c));
}
def code(x, c, s): return -2.0 / ((s * s) * (c * c))
function code(x, c, s) return Float64(-2.0 / Float64(Float64(s * s) * Float64(c * c))) end
function tmp = code(x, c, s) tmp = -2.0 / ((s * s) * (c * c)); end
code[x_, c_, s_] := N[(-2.0 / N[(N[(s * s), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-2}{\left(s \cdot s\right) \cdot \left(c \cdot c\right)}
\end{array}
Initial program 69.9%
associate-/r*69.6%
*-commutative69.6%
associate-*l*62.4%
unpow262.4%
unpow262.4%
associate-*r*68.1%
associate-/r*68.3%
associate-/l/69.1%
associate-/l/68.9%
*-commutative68.9%
associate-*l*68.3%
unpow268.3%
associate-*l*62.8%
unpow262.8%
unswap-sqr75.9%
*-commutative75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in x around 0 49.1%
unpow249.1%
Simplified49.1%
Taylor expanded in x around inf 27.2%
unpow227.2%
unpow227.2%
Simplified27.2%
Final simplification27.2%
herbie shell --seed 2023283
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))