
(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 19 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 (cos (+ x x))))
(if (<=
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* x (* x (pow s 2.0)))))
INFINITY)
(/ t_0 (pow (* c (* x s)) 2.0))
(/ t_0 (pow (* x (* c s)) 2.0)))))
double code(double x, double c, double s) {
double t_0 = cos((x + x));
double tmp;
if ((cos((2.0 * x)) / (pow(c, 2.0) * (x * (x * pow(s, 2.0))))) <= ((double) INFINITY)) {
tmp = t_0 / pow((c * (x * s)), 2.0);
} else {
tmp = t_0 / pow((x * (c * s)), 2.0);
}
return tmp;
}
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x + x));
double tmp;
if ((Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * (x * (x * Math.pow(s, 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 / Math.pow((c * (x * s)), 2.0);
} else {
tmp = t_0 / Math.pow((x * (c * s)), 2.0);
}
return tmp;
}
def code(x, c, s): t_0 = math.cos((x + x)) tmp = 0 if (math.cos((2.0 * x)) / (math.pow(c, 2.0) * (x * (x * math.pow(s, 2.0))))) <= math.inf: tmp = t_0 / math.pow((c * (x * s)), 2.0) else: tmp = t_0 / math.pow((x * (c * s)), 2.0) return tmp
function code(x, c, s) t_0 = cos(Float64(x + x)) tmp = 0.0 if (Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= Inf) tmp = Float64(t_0 / (Float64(c * Float64(x * s)) ^ 2.0)); else tmp = Float64(t_0 / (Float64(x * Float64(c * s)) ^ 2.0)); end return tmp end
function tmp_2 = code(x, c, s) t_0 = cos((x + x)); tmp = 0.0; if ((cos((2.0 * x)) / ((c ^ 2.0) * (x * (x * (s ^ 2.0))))) <= Inf) tmp = t_0 / ((c * (x * s)) ^ 2.0); else tmp = t_0 / ((x * (c * s)) ^ 2.0); end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[Power[N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(x + x\right)\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{t_0}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) < +inf.0Initial program 85.1%
associate-/r*83.6%
remove-double-neg83.6%
distribute-lft-neg-out83.6%
distribute-lft-neg-out83.6%
distribute-rgt-neg-out83.6%
associate-/r*85.1%
*-commutative85.1%
associate-*r*84.1%
associate-*r*85.1%
associate-*r*78.2%
sqr-neg78.2%
associate-*r*85.1%
*-commutative85.1%
unpow285.1%
sqr-neg85.1%
unpow285.1%
Simplified85.0%
Taylor expanded in x around inf 78.2%
count-278.2%
*-lft-identity78.2%
associate-*r*78.2%
unpow278.2%
unpow278.2%
associate-*r*80.0%
unpow280.0%
*-commutative80.0%
times-frac79.3%
associate-*r*77.5%
swap-sqr82.1%
unpow282.1%
associate-/r*82.1%
times-frac90.1%
*-commutative90.1%
associate-/l*89.8%
Simplified99.5%
if +inf.0 < (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) Initial program 0.0%
associate-/r*0.0%
remove-double-neg0.0%
distribute-lft-neg-out0.0%
distribute-lft-neg-out0.0%
distribute-rgt-neg-out0.0%
associate-/r*0.0%
*-commutative0.0%
associate-*r*0.4%
associate-*r*0.0%
associate-*r*0.0%
sqr-neg0.0%
associate-*r*0.0%
*-commutative0.0%
unpow20.0%
sqr-neg0.0%
unpow20.0%
Simplified0.4%
Taylor expanded in x around inf 0.0%
count-20.0%
*-lft-identity0.0%
associate-*r*0.2%
unpow20.2%
unpow20.2%
associate-*r*25.8%
unpow225.8%
*-commutative25.8%
times-frac25.6%
associate-*r*0.1%
swap-sqr72.6%
unpow272.6%
associate-/r*72.6%
times-frac85.0%
*-commutative85.0%
associate-/l*85.0%
Simplified76.7%
add-sqr-sqrt_binary6443.9%
Applied rewrite-once43.9%
rem-square-sqrt76.7%
associate-*r*99.1%
Simplified99.1%
Final simplification99.4%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (+ x x))))
(if (<= x 13000000000.0)
(/ t_0 (pow (* c (* x s)) 2.0))
(/ (/ t_0 (* (* x (* c s)) (* x c))) s))))
double code(double x, double c, double s) {
double t_0 = cos((x + x));
double tmp;
if (x <= 13000000000.0) {
tmp = t_0 / pow((c * (x * s)), 2.0);
} else {
tmp = (t_0 / ((x * (c * s)) * (x * c))) / 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) :: t_0
real(8) :: tmp
t_0 = cos((x + x))
if (x <= 13000000000.0d0) then
tmp = t_0 / ((c * (x * s)) ** 2.0d0)
else
tmp = (t_0 / ((x * (c * s)) * (x * c))) / s
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x + x));
double tmp;
if (x <= 13000000000.0) {
tmp = t_0 / Math.pow((c * (x * s)), 2.0);
} else {
tmp = (t_0 / ((x * (c * s)) * (x * c))) / s;
}
return tmp;
}
def code(x, c, s): t_0 = math.cos((x + x)) tmp = 0 if x <= 13000000000.0: tmp = t_0 / math.pow((c * (x * s)), 2.0) else: tmp = (t_0 / ((x * (c * s)) * (x * c))) / s return tmp
function code(x, c, s) t_0 = cos(Float64(x + x)) tmp = 0.0 if (x <= 13000000000.0) tmp = Float64(t_0 / (Float64(c * Float64(x * s)) ^ 2.0)); else tmp = Float64(Float64(t_0 / Float64(Float64(x * Float64(c * s)) * Float64(x * c))) / s); end return tmp end
function tmp_2 = code(x, c, s) t_0 = cos((x + x)); tmp = 0.0; if (x <= 13000000000.0) tmp = t_0 / ((c * (x * s)) ^ 2.0); else tmp = (t_0 / ((x * (c * s)) * (x * c))) / s; end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 13000000000.0], N[(t$95$0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / N[(N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision] * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / s), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(x + x\right)\\
\mathbf{if}\;x \leq 13000000000:\\
\;\;\;\;\frac{t_0}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot c\right)}}{s}\\
\end{array}
\end{array}
if x < 1.3e10Initial program 68.9%
associate-/r*68.3%
remove-double-neg68.3%
distribute-lft-neg-out68.3%
distribute-lft-neg-out68.3%
distribute-rgt-neg-out68.3%
associate-/r*68.9%
*-commutative68.9%
associate-*r*68.4%
associate-*r*68.9%
associate-*r*63.2%
sqr-neg63.2%
associate-*r*68.9%
*-commutative68.9%
unpow268.9%
sqr-neg68.9%
unpow268.9%
Simplified69.4%
Taylor expanded in x around inf 63.2%
count-263.2%
*-lft-identity63.2%
associate-*r*63.2%
unpow263.2%
unpow263.2%
associate-*r*70.5%
unpow270.5%
*-commutative70.5%
times-frac69.5%
associate-*r*62.2%
swap-sqr79.7%
unpow279.7%
associate-/r*79.7%
times-frac89.4%
*-commutative89.4%
associate-/l*89.4%
Simplified95.3%
if 1.3e10 < x Initial program 71.5%
associate-/r*68.0%
remove-double-neg68.0%
distribute-lft-neg-out68.0%
distribute-lft-neg-out68.0%
distribute-rgt-neg-out68.0%
associate-/r*71.5%
*-commutative71.5%
associate-*r*69.8%
associate-*r*71.5%
associate-*r*66.1%
sqr-neg66.1%
associate-*r*71.5%
*-commutative71.5%
unpow271.5%
sqr-neg71.5%
unpow271.5%
Simplified69.9%
associate-/r*71.0%
associate-*l*74.8%
associate-/r*78.0%
associate-*r*86.0%
associate-*r*91.7%
associate-/r*93.2%
div-inv93.2%
associate-/l/93.2%
count-293.2%
*-commutative93.2%
Applied egg-rr93.2%
associate-*r/93.2%
*-rgt-identity93.2%
associate-/l/93.2%
Simplified93.2%
add-sqr-sqrt_binary6440.4%
Applied rewrite-once40.4%
rem-square-sqrt95.4%
associate-*r*96.1%
Simplified93.9%
Final simplification95.0%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (* 2.0 x))))
(if (<= s 7.5e-14)
(/ t_0 (* c (* x (* c (* s (* x s))))))
(if (<= s 3.4e+201)
(/ t_0 (* x (* c (* s (* x (* c s))))))
(/ 1.0 (pow (* c (* x s)) 2.0))))))
double code(double x, double c, double s) {
double t_0 = cos((2.0 * x));
double tmp;
if (s <= 7.5e-14) {
tmp = t_0 / (c * (x * (c * (s * (x * s)))));
} else if (s <= 3.4e+201) {
tmp = t_0 / (x * (c * (s * (x * (c * 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) :: t_0
real(8) :: tmp
t_0 = cos((2.0d0 * x))
if (s <= 7.5d-14) then
tmp = t_0 / (c * (x * (c * (s * (x * s)))))
else if (s <= 3.4d+201) then
tmp = t_0 / (x * (c * (s * (x * (c * 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 t_0 = Math.cos((2.0 * x));
double tmp;
if (s <= 7.5e-14) {
tmp = t_0 / (c * (x * (c * (s * (x * s)))));
} else if (s <= 3.4e+201) {
tmp = t_0 / (x * (c * (s * (x * (c * s)))));
} else {
tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
}
return tmp;
}
def code(x, c, s): t_0 = math.cos((2.0 * x)) tmp = 0 if s <= 7.5e-14: tmp = t_0 / (c * (x * (c * (s * (x * s))))) elif s <= 3.4e+201: tmp = t_0 / (x * (c * (s * (x * (c * s))))) else: tmp = 1.0 / math.pow((c * (x * s)), 2.0) return tmp
function code(x, c, s) t_0 = cos(Float64(2.0 * x)) tmp = 0.0 if (s <= 7.5e-14) tmp = Float64(t_0 / Float64(c * Float64(x * Float64(c * Float64(s * Float64(x * s)))))); elseif (s <= 3.4e+201) tmp = Float64(t_0 / Float64(x * Float64(c * Float64(s * Float64(x * Float64(c * s)))))); else tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)); end return tmp end
function tmp_2 = code(x, c, s) t_0 = cos((2.0 * x)); tmp = 0.0; if (s <= 7.5e-14) tmp = t_0 / (c * (x * (c * (s * (x * s))))); elseif (s <= 3.4e+201) tmp = t_0 / (x * (c * (s * (x * (c * s))))); else tmp = 1.0 / ((c * (x * s)) ^ 2.0); end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[s, 7.5e-14], N[(t$95$0 / N[(c * N[(x * N[(c * N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[s, 3.4e+201], N[(t$95$0 / N[(x * N[(c * N[(s * N[(x * N[(c * 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}
t_0 := \cos \left(2 \cdot x\right)\\
\mathbf{if}\;s \leq 7.5 \cdot 10^{-14}:\\
\;\;\;\;\frac{t_0}{c \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(x \cdot s\right)\right)\right)\right)}\\
\mathbf{elif}\;s \leq 3.4 \cdot 10^{+201}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(c \cdot \left(s \cdot \left(x \cdot \left(c \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 s < 7.4999999999999996e-14Initial program 67.0%
associate-/r*65.9%
remove-double-neg65.9%
distribute-lft-neg-out65.9%
distribute-lft-neg-out65.9%
distribute-rgt-neg-out65.9%
associate-/r*67.0%
associate-*r*67.0%
*-commutative67.0%
associate-*r*66.1%
unpow266.1%
associate-*r*73.1%
*-commutative73.1%
associate-*l*65.0%
sqr-neg65.0%
associate-*r*73.1%
*-commutative73.1%
Simplified73.1%
Taylor expanded in x around 0 67.0%
unpow267.0%
*-commutative67.0%
unpow267.0%
associate-*l*74.4%
*-commutative74.4%
associate-*r*79.4%
Simplified79.4%
Taylor expanded in x around 0 59.9%
unpow259.9%
associate-*r*67.0%
unpow267.0%
associate-*r*73.5%
associate-*l*72.1%
unpow272.1%
associate-*r*79.4%
associate-*l*81.7%
Simplified81.7%
if 7.4999999999999996e-14 < s < 3.4e201Initial program 80.4%
associate-/r*80.4%
remove-double-neg80.4%
distribute-lft-neg-out80.4%
distribute-lft-neg-out80.4%
distribute-rgt-neg-out80.4%
associate-/r*80.4%
associate-*r*80.4%
*-commutative80.4%
associate-*r*80.6%
unpow280.6%
associate-*r*88.7%
*-commutative88.7%
associate-*l*82.8%
sqr-neg82.8%
associate-*r*88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in x around 0 80.4%
unpow280.4%
*-commutative80.4%
unpow280.4%
associate-*l*84.9%
*-commutative84.9%
associate-*r*88.9%
Simplified88.9%
Taylor expanded in c around 0 84.9%
*-commutative84.9%
unpow284.9%
associate-*r*88.9%
associate-*l*94.5%
*-commutative94.5%
associate-*r*98.4%
*-commutative98.4%
Simplified98.4%
if 3.4e201 < s Initial program 65.8%
associate-/r*60.8%
remove-double-neg60.8%
distribute-lft-neg-out60.8%
distribute-lft-neg-out60.8%
distribute-rgt-neg-out60.8%
associate-/r*65.8%
*-commutative65.8%
associate-*r*65.8%
associate-*r*65.8%
associate-*r*65.3%
sqr-neg65.3%
associate-*r*65.8%
*-commutative65.8%
unpow265.8%
sqr-neg65.8%
unpow265.8%
Simplified65.8%
Taylor expanded in x around 0 65.3%
*-commutative65.3%
*-commutative65.3%
unpow265.3%
unpow265.3%
associate-*r*65.8%
unpow265.8%
*-commutative65.8%
associate-*r*65.3%
*-commutative65.3%
swap-sqr70.6%
swap-sqr99.7%
unpow299.7%
Simplified99.7%
Final simplification86.3%
(FPCore (x c s) :precision binary64 (if (<= s 1.1e+145) (/ (cos (* 2.0 x)) (* c (* x (* c (* s (* x s)))))) (/ 1.0 (pow (* c (* x s)) 2.0))))
double code(double x, double c, double s) {
double tmp;
if (s <= 1.1e+145) {
tmp = cos((2.0 * x)) / (c * (x * (c * (s * (x * 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 (s <= 1.1d+145) then
tmp = cos((2.0d0 * x)) / (c * (x * (c * (s * (x * 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 (s <= 1.1e+145) {
tmp = Math.cos((2.0 * x)) / (c * (x * (c * (s * (x * s)))));
} else {
tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 1.1e+145: tmp = math.cos((2.0 * x)) / (c * (x * (c * (s * (x * s))))) else: tmp = 1.0 / math.pow((c * (x * s)), 2.0) return tmp
function code(x, c, s) tmp = 0.0 if (s <= 1.1e+145) tmp = Float64(cos(Float64(2.0 * x)) / Float64(c * Float64(x * Float64(c * Float64(s * Float64(x * 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 (s <= 1.1e+145) tmp = cos((2.0 * x)) / (c * (x * (c * (s * (x * s))))); else tmp = 1.0 / ((c * (x * s)) ^ 2.0); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 1.1e+145], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(c * N[(x * N[(c * N[(s * N[(x * 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}\;s \leq 1.1 \cdot 10^{+145}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{c \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(x \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 s < 1.10000000000000004e145Initial program 70.9%
associate-/r*70.0%
remove-double-neg70.0%
distribute-lft-neg-out70.0%
distribute-lft-neg-out70.0%
distribute-rgt-neg-out70.0%
associate-/r*70.9%
associate-*r*70.9%
*-commutative70.9%
associate-*r*70.2%
unpow270.2%
associate-*r*77.2%
*-commutative77.2%
associate-*l*69.3%
sqr-neg69.3%
associate-*r*77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in x around 0 70.9%
unpow270.9%
*-commutative70.9%
unpow270.9%
associate-*l*77.8%
*-commutative77.8%
associate-*r*82.0%
Simplified82.0%
Taylor expanded in x around 0 64.7%
unpow264.7%
associate-*r*70.9%
unpow270.9%
associate-*r*76.2%
associate-*l*75.1%
unpow275.1%
associate-*r*82.0%
associate-*l*83.9%
Simplified83.9%
if 1.10000000000000004e145 < s Initial program 57.9%
associate-/r*54.3%
remove-double-neg54.3%
distribute-lft-neg-out54.3%
distribute-lft-neg-out54.3%
distribute-rgt-neg-out54.3%
associate-/r*57.9%
*-commutative57.9%
associate-*r*57.8%
associate-*r*57.9%
associate-*r*57.4%
sqr-neg57.4%
associate-*r*57.9%
*-commutative57.9%
unpow257.9%
sqr-neg57.9%
unpow257.9%
Simplified57.9%
Taylor expanded in x around 0 57.4%
*-commutative57.4%
*-commutative57.4%
unpow257.4%
unpow257.4%
associate-*r*57.9%
unpow257.9%
*-commutative57.9%
associate-*r*57.4%
*-commutative57.4%
swap-sqr68.3%
swap-sqr89.8%
unpow289.8%
Simplified89.8%
Final simplification84.5%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))))
(if (<= x 3e-37)
(/ 1.0 (pow t_0 2.0))
(/ (/ (cos (+ x x)) (* t_0 (* x c))) s))))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 3e-37) {
tmp = 1.0 / pow(t_0, 2.0);
} else {
tmp = (cos((x + x)) / (t_0 * (x * c))) / 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) :: t_0
real(8) :: tmp
t_0 = c * (x * s)
if (x <= 3d-37) then
tmp = 1.0d0 / (t_0 ** 2.0d0)
else
tmp = (cos((x + x)) / (t_0 * (x * c))) / s
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 3e-37) {
tmp = 1.0 / Math.pow(t_0, 2.0);
} else {
tmp = (Math.cos((x + x)) / (t_0 * (x * c))) / s;
}
return tmp;
}
def code(x, c, s): t_0 = c * (x * s) tmp = 0 if x <= 3e-37: tmp = 1.0 / math.pow(t_0, 2.0) else: tmp = (math.cos((x + x)) / (t_0 * (x * c))) / s return tmp
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 3e-37) tmp = Float64(1.0 / (t_0 ^ 2.0)); else tmp = Float64(Float64(cos(Float64(x + x)) / Float64(t_0 * Float64(x * c))) / s); end return tmp end
function tmp_2 = code(x, c, s) t_0 = c * (x * s); tmp = 0.0; if (x <= 3e-37) tmp = 1.0 / (t_0 ^ 2.0); else tmp = (cos((x + x)) / (t_0 * (x * c))) / s; end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3e-37], N[(1.0 / N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / s), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 3 \cdot 10^{-37}:\\
\;\;\;\;\frac{1}{{t_0}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x + x\right)}{t_0 \cdot \left(x \cdot c\right)}}{s}\\
\end{array}
\end{array}
if x < 3e-37Initial program 67.6%
associate-/r*67.0%
remove-double-neg67.0%
distribute-lft-neg-out67.0%
distribute-lft-neg-out67.0%
distribute-rgt-neg-out67.0%
associate-/r*67.6%
*-commutative67.6%
associate-*r*67.1%
associate-*r*67.6%
associate-*r*61.6%
sqr-neg61.6%
associate-*r*67.6%
*-commutative67.6%
unpow267.6%
sqr-neg67.6%
unpow267.6%
Simplified68.1%
Taylor expanded in x around 0 57.7%
*-commutative57.7%
*-commutative57.7%
unpow257.7%
unpow257.7%
associate-*r*60.7%
unpow260.7%
*-commutative60.7%
associate-*r*57.7%
*-commutative57.7%
swap-sqr66.7%
swap-sqr81.1%
unpow281.1%
Simplified81.1%
if 3e-37 < x Initial program 74.6%
associate-/r*71.6%
remove-double-neg71.6%
distribute-lft-neg-out71.6%
distribute-lft-neg-out71.6%
distribute-rgt-neg-out71.6%
associate-/r*74.6%
*-commutative74.6%
associate-*r*73.2%
associate-*r*74.6%
associate-*r*70.0%
sqr-neg70.0%
associate-*r*74.6%
*-commutative74.6%
unpow274.6%
sqr-neg74.6%
unpow274.6%
Simplified73.3%
associate-/r*74.1%
associate-*l*77.4%
associate-/r*80.1%
associate-*r*86.8%
associate-*r*93.0%
associate-/r*94.2%
div-inv94.2%
associate-/l/94.2%
count-294.2%
*-commutative94.2%
Applied egg-rr94.2%
associate-*r/94.2%
*-rgt-identity94.2%
associate-/l/94.2%
Simplified94.2%
Final simplification84.6%
(FPCore (x c s) :precision binary64 (if (<= x 5e-23) (/ 1.0 (pow (* c (* x s)) 2.0)) (/ (/ (cos (+ x x)) (* (* x (* c s)) (* x c))) s)))
double code(double x, double c, double s) {
double tmp;
if (x <= 5e-23) {
tmp = 1.0 / pow((c * (x * s)), 2.0);
} else {
tmp = (cos((x + x)) / ((x * (c * s)) * (x * c))) / 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 <= 5d-23) then
tmp = 1.0d0 / ((c * (x * s)) ** 2.0d0)
else
tmp = (cos((x + x)) / ((x * (c * s)) * (x * c))) / s
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (x <= 5e-23) {
tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
} else {
tmp = (Math.cos((x + x)) / ((x * (c * s)) * (x * c))) / s;
}
return tmp;
}
def code(x, c, s): tmp = 0 if x <= 5e-23: tmp = 1.0 / math.pow((c * (x * s)), 2.0) else: tmp = (math.cos((x + x)) / ((x * (c * s)) * (x * c))) / s return tmp
function code(x, c, s) tmp = 0.0 if (x <= 5e-23) tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)); else tmp = Float64(Float64(cos(Float64(x + x)) / Float64(Float64(x * Float64(c * s)) * Float64(x * c))) / s); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (x <= 5e-23) tmp = 1.0 / ((c * (x * s)) ^ 2.0); else tmp = (cos((x + x)) / ((x * (c * s)) * (x * c))) / s; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[x, 5e-23], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[(N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision] * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / s), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-23}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot s\right)\right) \cdot \left(x \cdot c\right)}}{s}\\
\end{array}
\end{array}
if x < 5.0000000000000002e-23Initial program 67.7%
associate-/r*67.2%
remove-double-neg67.2%
distribute-lft-neg-out67.2%
distribute-lft-neg-out67.2%
distribute-rgt-neg-out67.2%
associate-/r*67.7%
*-commutative67.7%
associate-*r*67.2%
associate-*r*67.7%
associate-*r*61.9%
sqr-neg61.9%
associate-*r*67.7%
*-commutative67.7%
unpow267.7%
sqr-neg67.7%
unpow267.7%
Simplified68.3%
Taylor expanded in x around 0 58.0%
*-commutative58.0%
*-commutative58.0%
unpow258.0%
unpow258.0%
associate-*r*61.0%
unpow261.0%
*-commutative61.0%
associate-*r*58.0%
*-commutative58.0%
swap-sqr66.8%
swap-sqr81.5%
unpow281.5%
Simplified81.5%
if 5.0000000000000002e-23 < x Initial program 74.6%
associate-/r*71.5%
remove-double-neg71.5%
distribute-lft-neg-out71.5%
distribute-lft-neg-out71.5%
distribute-rgt-neg-out71.5%
associate-/r*74.6%
*-commutative74.6%
associate-*r*73.1%
associate-*r*74.6%
associate-*r*69.8%
sqr-neg69.8%
associate-*r*74.6%
*-commutative74.6%
unpow274.6%
sqr-neg74.6%
unpow274.6%
Simplified73.2%
associate-/r*74.1%
associate-*l*77.5%
associate-/r*80.4%
associate-*r*87.5%
associate-*r*92.6%
associate-/r*93.9%
div-inv93.9%
associate-/l/93.9%
count-293.9%
*-commutative93.9%
Applied egg-rr93.9%
associate-*r/93.9%
*-rgt-identity93.9%
associate-/l/93.9%
Simplified93.9%
add-sqr-sqrt_binary6442.2%
Applied rewrite-once42.2%
rem-square-sqrt95.8%
associate-*r*96.4%
Simplified94.5%
Final simplification84.8%
(FPCore (x c s) :precision binary64 (if (<= s 1.75e-120) (/ (cos (+ 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 (s <= 1.75e-120) {
tmp = cos((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 (s <= 1.75d-120) then
tmp = cos((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 (s <= 1.75e-120) {
tmp = Math.cos((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 s <= 1.75e-120: tmp = math.cos((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 (s <= 1.75e-120) tmp = Float64(cos(Float64(x + x)) / Float64(Float64(x * Float64(c * 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 (s <= 1.75e-120) tmp = cos((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[s, 1.75e-120], N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[(N[(x * N[(c * c), $MachinePrecision]), $MachinePrecision] * N[(s * s), $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}\;s \leq 1.75 \cdot 10^{-120}:\\
\;\;\;\;\frac{\cos \left(x + x\right)}{\left(x \cdot \left(c \cdot c\right)\right) \cdot \left(s \cdot s\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\end{array}
\end{array}
if s < 1.75e-120Initial program 65.5%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/r*65.5%
*-commutative65.5%
associate-*r*64.9%
associate-*r*65.5%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*65.5%
*-commutative65.5%
unpow265.5%
sqr-neg65.5%
unpow265.5%
Simplified65.6%
Taylor expanded in x around inf 58.2%
associate-*r*58.1%
unpow258.1%
unpow258.1%
associate-*r*63.4%
unpow263.4%
*-commutative63.4%
associate-*r*72.4%
associate-/r*72.5%
*-commutative72.5%
associate-*r*65.0%
unpow265.0%
unpow265.0%
associate-*r*65.5%
unpow265.5%
*-commutative65.5%
unpow265.5%
associate-/r*65.6%
count-265.6%
Simplified70.3%
Applied egg-rr8.7%
distribute-lft-neg-in8.7%
metadata-eval8.7%
log-pow38.1%
unpow238.1%
log-prod8.7%
exp-sum8.7%
rem-exp-log8.7%
rem-exp-log38.1%
Simplified38.1%
if 1.75e-120 < s Initial program 76.5%
associate-/r*75.5%
remove-double-neg75.5%
distribute-lft-neg-out75.5%
distribute-lft-neg-out75.5%
distribute-rgt-neg-out75.5%
associate-/r*76.5%
*-commutative76.5%
associate-*r*75.6%
associate-*r*76.5%
associate-*r*74.2%
sqr-neg74.2%
associate-*r*76.5%
*-commutative76.5%
unpow276.5%
sqr-neg76.5%
unpow276.5%
Simplified76.6%
Taylor expanded in x around 0 70.1%
*-commutative70.1%
*-commutative70.1%
unpow270.1%
unpow270.1%
associate-*r*71.6%
unpow271.6%
*-commutative71.6%
associate-*r*70.1%
*-commutative70.1%
swap-sqr74.9%
swap-sqr85.5%
unpow285.5%
Simplified85.5%
Final simplification55.0%
(FPCore (x c s) :precision binary64 (if (<= s 4.65e-122) (/ (/ (cos (+ x x)) (* s (* x c))) s) (/ 1.0 (pow (* c (* x s)) 2.0))))
double code(double x, double c, double s) {
double tmp;
if (s <= 4.65e-122) {
tmp = (cos((x + x)) / (s * (x * c))) / 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 (s <= 4.65d-122) then
tmp = (cos((x + x)) / (s * (x * c))) / 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 (s <= 4.65e-122) {
tmp = (Math.cos((x + x)) / (s * (x * c))) / s;
} else {
tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 4.65e-122: tmp = (math.cos((x + x)) / (s * (x * c))) / s else: tmp = 1.0 / math.pow((c * (x * s)), 2.0) return tmp
function code(x, c, s) tmp = 0.0 if (s <= 4.65e-122) tmp = Float64(Float64(cos(Float64(x + x)) / Float64(s * Float64(x * c))) / 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 (s <= 4.65e-122) tmp = (cos((x + x)) / (s * (x * c))) / s; else tmp = 1.0 / ((c * (x * s)) ^ 2.0); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 4.65e-122], N[(N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / s), $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}\;s \leq 4.65 \cdot 10^{-122}:\\
\;\;\;\;\frac{\frac{\cos \left(x + x\right)}{s \cdot \left(x \cdot c\right)}}{s}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\end{array}
\end{array}
if s < 4.6499999999999998e-122Initial program 65.5%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/r*65.5%
*-commutative65.5%
associate-*r*64.9%
associate-*r*65.5%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*65.5%
*-commutative65.5%
unpow265.5%
sqr-neg65.5%
unpow265.5%
Simplified65.6%
associate-/r*65.5%
associate-*l*72.6%
associate-/r*74.8%
associate-*r*79.9%
associate-*r*88.7%
associate-/r*88.0%
div-inv88.1%
associate-/l/88.1%
count-288.1%
*-commutative88.1%
Applied egg-rr88.1%
associate-*r/88.1%
*-rgt-identity88.1%
associate-/l/87.7%
Simplified87.7%
Applied egg-rr43.0%
associate-/l*39.1%
associate-/r/43.0%
*-inverses43.0%
*-lft-identity43.0%
Simplified43.0%
if 4.6499999999999998e-122 < s Initial program 76.5%
associate-/r*75.5%
remove-double-neg75.5%
distribute-lft-neg-out75.5%
distribute-lft-neg-out75.5%
distribute-rgt-neg-out75.5%
associate-/r*76.5%
*-commutative76.5%
associate-*r*75.6%
associate-*r*76.5%
associate-*r*74.2%
sqr-neg74.2%
associate-*r*76.5%
*-commutative76.5%
unpow276.5%
sqr-neg76.5%
unpow276.5%
Simplified76.6%
Taylor expanded in x around 0 70.1%
*-commutative70.1%
*-commutative70.1%
unpow270.1%
unpow270.1%
associate-*r*71.6%
unpow271.6%
*-commutative71.6%
associate-*r*70.1%
*-commutative70.1%
swap-sqr74.9%
swap-sqr85.5%
unpow285.5%
Simplified85.5%
Final simplification58.1%
(FPCore (x c s) :precision binary64 (/ 1.0 (pow (* c (* x s)) 2.0)))
double code(double x, double c, double s) {
return 1.0 / pow((c * (x * s)), 2.0);
}
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)) ** 2.0d0)
end function
public static double code(double x, double c, double s) {
return 1.0 / Math.pow((c * (x * s)), 2.0);
}
def code(x, c, s): return 1.0 / math.pow((c * (x * s)), 2.0)
function code(x, c, s) return Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)) end
function tmp = code(x, c, s) tmp = 1.0 / ((c * (x * s)) ^ 2.0); end
code[x_, c_, s_] := N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}
\end{array}
Initial program 69.5%
associate-/r*68.3%
remove-double-neg68.3%
distribute-lft-neg-out68.3%
distribute-lft-neg-out68.3%
distribute-rgt-neg-out68.3%
associate-/r*69.5%
*-commutative69.5%
associate-*r*68.7%
associate-*r*69.5%
associate-*r*63.9%
sqr-neg63.9%
associate-*r*69.5%
*-commutative69.5%
unpow269.5%
sqr-neg69.5%
unpow269.5%
Simplified69.5%
Taylor expanded in x around 0 58.1%
*-commutative58.1%
*-commutative58.1%
unpow258.1%
unpow258.1%
associate-*r*60.9%
unpow260.9%
*-commutative60.9%
associate-*r*58.1%
*-commutative58.1%
swap-sqr66.3%
swap-sqr77.9%
unpow277.9%
Simplified77.9%
Final simplification77.9%
(FPCore (x c s) :precision binary64 (if (<= s 8.5e-122) (* (- (/ 1.0 (* c (* x x))) (/ 2.0 c)) (/ 1.0 (* c (* s s)))) (/ 1.0 (* c (* x (* s (* x (* c s))))))))
double code(double x, double c, double s) {
double tmp;
if (s <= 8.5e-122) {
tmp = ((1.0 / (c * (x * x))) - (2.0 / c)) * (1.0 / (c * (s * s)));
} else {
tmp = 1.0 / (c * (x * (s * (x * (c * 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 (s <= 8.5d-122) then
tmp = ((1.0d0 / (c * (x * x))) - (2.0d0 / c)) * (1.0d0 / (c * (s * s)))
else
tmp = 1.0d0 / (c * (x * (s * (x * (c * s)))))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (s <= 8.5e-122) {
tmp = ((1.0 / (c * (x * x))) - (2.0 / c)) * (1.0 / (c * (s * s)));
} else {
tmp = 1.0 / (c * (x * (s * (x * (c * s)))));
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 8.5e-122: tmp = ((1.0 / (c * (x * x))) - (2.0 / c)) * (1.0 / (c * (s * s))) else: tmp = 1.0 / (c * (x * (s * (x * (c * s))))) return tmp
function code(x, c, s) tmp = 0.0 if (s <= 8.5e-122) tmp = Float64(Float64(Float64(1.0 / Float64(c * Float64(x * x))) - Float64(2.0 / c)) * Float64(1.0 / Float64(c * Float64(s * s)))); else tmp = Float64(1.0 / Float64(c * Float64(x * Float64(s * Float64(x * Float64(c * s)))))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (s <= 8.5e-122) tmp = ((1.0 / (c * (x * x))) - (2.0 / c)) * (1.0 / (c * (s * s))); else tmp = 1.0 / (c * (x * (s * (x * (c * s))))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 8.5e-122], N[(N[(N[(1.0 / N[(c * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 / c), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(c * N[(x * N[(s * N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;s \leq 8.5 \cdot 10^{-122}:\\
\;\;\;\;\left(\frac{1}{c \cdot \left(x \cdot x\right)} - \frac{2}{c}\right) \cdot \frac{1}{c \cdot \left(s \cdot s\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c \cdot \left(x \cdot \left(s \cdot \left(x \cdot \left(c \cdot s\right)\right)\right)\right)}\\
\end{array}
\end{array}
if s < 8.50000000000000003e-122Initial program 65.5%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/r*65.5%
*-commutative65.5%
associate-*r*64.9%
associate-*r*65.5%
associate-*r*58.2%
sqr-neg58.2%
associate-*r*65.5%
*-commutative65.5%
unpow265.5%
sqr-neg65.5%
unpow265.5%
Simplified65.6%
associate-/r*65.5%
associate-*r*65.0%
*-commutative65.0%
associate-*r*71.4%
associate-*r*75.8%
associate-/r*72.5%
div-inv72.1%
cos-272.1%
cos-sum72.1%
*-commutative72.1%
Applied egg-rr72.1%
Taylor expanded in x around 0 54.3%
unpow254.3%
associate-*r/54.3%
metadata-eval54.3%
Simplified54.3%
if 8.50000000000000003e-122 < s Initial program 76.5%
associate-/r*75.5%
remove-double-neg75.5%
distribute-lft-neg-out75.5%
distribute-lft-neg-out75.5%
distribute-rgt-neg-out75.5%
associate-/r*76.5%
*-commutative76.5%
associate-*r*75.6%
associate-*r*76.5%
associate-*r*74.2%
sqr-neg74.2%
associate-*r*76.5%
*-commutative76.5%
unpow276.5%
sqr-neg76.5%
unpow276.5%
Simplified76.6%
associate-/r*77.3%
associate-*l*86.5%
associate-/r*87.5%
associate-*r*89.6%
associate-*r*93.5%
associate-/r*92.5%
div-inv92.5%
associate-/l/92.5%
count-292.5%
*-commutative92.5%
Applied egg-rr92.5%
associate-*r/92.6%
*-rgt-identity92.6%
associate-/l/92.5%
Simplified92.5%
Taylor expanded in x around 0 70.1%
unpow270.1%
associate-*r*71.6%
unpow271.6%
associate-*r*73.8%
associate-*l*73.9%
unpow273.9%
associate-*r*81.0%
associate-*l*81.0%
*-commutative81.0%
associate-*l*82.2%
*-commutative82.2%
associate-*r*82.2%
*-commutative82.2%
Simplified82.2%
Final simplification64.2%
(FPCore (x c s)
:precision binary64
(if (<= x 3.3e-177)
(/ 1.0 (* (- c c) (/ s s)))
(if (<= x 1.2e+133)
(/ 1.0 (* (* s (* x s)) (* c c)))
(/ 1.0 (* c (* s (* x (- s))))))))
double code(double x, double c, double s) {
double tmp;
if (x <= 3.3e-177) {
tmp = 1.0 / ((c - c) * (s / s));
} else if (x <= 1.2e+133) {
tmp = 1.0 / ((s * (x * s)) * (c * c));
} else {
tmp = 1.0 / (c * (s * (x * -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.3d-177) then
tmp = 1.0d0 / ((c - c) * (s / s))
else if (x <= 1.2d+133) then
tmp = 1.0d0 / ((s * (x * s)) * (c * c))
else
tmp = 1.0d0 / (c * (s * (x * -s)))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (x <= 3.3e-177) {
tmp = 1.0 / ((c - c) * (s / s));
} else if (x <= 1.2e+133) {
tmp = 1.0 / ((s * (x * s)) * (c * c));
} else {
tmp = 1.0 / (c * (s * (x * -s)));
}
return tmp;
}
def code(x, c, s): tmp = 0 if x <= 3.3e-177: tmp = 1.0 / ((c - c) * (s / s)) elif x <= 1.2e+133: tmp = 1.0 / ((s * (x * s)) * (c * c)) else: tmp = 1.0 / (c * (s * (x * -s))) return tmp
function code(x, c, s) tmp = 0.0 if (x <= 3.3e-177) tmp = Float64(1.0 / Float64(Float64(c - c) * Float64(s / s))); elseif (x <= 1.2e+133) tmp = Float64(1.0 / Float64(Float64(s * Float64(x * s)) * Float64(c * c))); else tmp = Float64(1.0 / Float64(c * Float64(s * Float64(x * Float64(-s))))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (x <= 3.3e-177) tmp = 1.0 / ((c - c) * (s / s)); elseif (x <= 1.2e+133) tmp = 1.0 / ((s * (x * s)) * (c * c)); else tmp = 1.0 / (c * (s * (x * -s))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[x, 3.3e-177], N[(1.0 / N[(N[(c - c), $MachinePrecision] * N[(s / s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2e+133], N[(1.0 / N[(N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(c * N[(s * N[(x * (-s)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.3 \cdot 10^{-177}:\\
\;\;\;\;\frac{1}{\left(c - c\right) \cdot \frac{s}{s}}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+133}:\\
\;\;\;\;\frac{1}{\left(s \cdot \left(x \cdot s\right)\right) \cdot \left(c \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c \cdot \left(s \cdot \left(x \cdot \left(-s\right)\right)\right)}\\
\end{array}
\end{array}
if x < 3.3e-177Initial program 67.2%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/r*67.2%
*-commutative67.2%
associate-*r*66.7%
associate-*r*67.2%
associate-*r*60.5%
sqr-neg60.5%
associate-*r*67.2%
*-commutative67.2%
unpow267.2%
sqr-neg67.2%
unpow267.2%
Simplified67.9%
Taylor expanded in x around 0 56.0%
unpow256.0%
*-commutative56.0%
unpow256.0%
unpow256.0%
associate-*r*59.4%
associate-*r*58.8%
*-commutative58.8%
associate-*r*59.5%
associate-*r*58.8%
*-commutative58.8%
*-commutative58.8%
associate-*r*61.2%
Simplified61.2%
Applied egg-rr28.6%
Applied egg-rr35.0%
if 3.3e-177 < x < 1.1999999999999999e133Initial program 75.2%
associate-/r*75.1%
remove-double-neg75.1%
distribute-lft-neg-out75.1%
distribute-lft-neg-out75.1%
distribute-rgt-neg-out75.1%
associate-/r*75.2%
*-commutative75.2%
associate-*r*73.4%
associate-*r*75.2%
associate-*r*75.2%
sqr-neg75.2%
associate-*r*75.2%
*-commutative75.2%
unpow275.2%
sqr-neg75.2%
unpow275.2%
Simplified75.1%
Taylor expanded in x around 0 64.4%
unpow264.4%
*-commutative64.4%
unpow264.4%
unpow264.4%
associate-*r*64.4%
associate-*r*64.3%
*-commutative64.3%
associate-*r*64.4%
associate-*r*64.3%
*-commutative64.3%
*-commutative64.3%
associate-*r*66.1%
Simplified66.1%
Applied egg-rr26.6%
distribute-lft-neg-in26.6%
metadata-eval26.6%
count-226.6%
prod-exp26.6%
rem-exp-log26.6%
rem-exp-log55.0%
Simplified55.0%
if 1.1999999999999999e133 < x Initial program 70.5%
associate-/r*64.4%
remove-double-neg64.4%
distribute-lft-neg-out64.4%
distribute-lft-neg-out64.4%
distribute-rgt-neg-out64.4%
associate-/r*70.5%
*-commutative70.5%
associate-*r*70.5%
associate-*r*70.5%
associate-*r*61.0%
sqr-neg61.0%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
sqr-neg70.5%
unpow270.5%
Simplified67.8%
Taylor expanded in x around 0 58.0%
unpow258.0%
*-commutative58.0%
unpow258.0%
unpow258.0%
associate-*r*62.8%
associate-*r*62.8%
*-commutative62.8%
associate-*r*62.4%
associate-*r*62.8%
*-commutative62.8%
*-commutative62.8%
associate-*r*69.4%
Simplified69.4%
Applied egg-rr59.7%
Final simplification42.7%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* s (* x s))))
(if (<= x 3.2e-177)
(/ 1.0 (* (- c c) (/ s s)))
(if (<= x 1.2e+133) (/ 1.0 (* t_0 (* c c))) (/ 1.0 (* t_0 (/ c -2.0)))))))
double code(double x, double c, double s) {
double t_0 = s * (x * s);
double tmp;
if (x <= 3.2e-177) {
tmp = 1.0 / ((c - c) * (s / s));
} else if (x <= 1.2e+133) {
tmp = 1.0 / (t_0 * (c * c));
} else {
tmp = 1.0 / (t_0 * (c / -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) :: t_0
real(8) :: tmp
t_0 = s * (x * s)
if (x <= 3.2d-177) then
tmp = 1.0d0 / ((c - c) * (s / s))
else if (x <= 1.2d+133) then
tmp = 1.0d0 / (t_0 * (c * c))
else
tmp = 1.0d0 / (t_0 * (c / (-2.0d0)))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = s * (x * s);
double tmp;
if (x <= 3.2e-177) {
tmp = 1.0 / ((c - c) * (s / s));
} else if (x <= 1.2e+133) {
tmp = 1.0 / (t_0 * (c * c));
} else {
tmp = 1.0 / (t_0 * (c / -2.0));
}
return tmp;
}
def code(x, c, s): t_0 = s * (x * s) tmp = 0 if x <= 3.2e-177: tmp = 1.0 / ((c - c) * (s / s)) elif x <= 1.2e+133: tmp = 1.0 / (t_0 * (c * c)) else: tmp = 1.0 / (t_0 * (c / -2.0)) return tmp
function code(x, c, s) t_0 = Float64(s * Float64(x * s)) tmp = 0.0 if (x <= 3.2e-177) tmp = Float64(1.0 / Float64(Float64(c - c) * Float64(s / s))); elseif (x <= 1.2e+133) tmp = Float64(1.0 / Float64(t_0 * Float64(c * c))); else tmp = Float64(1.0 / Float64(t_0 * Float64(c / -2.0))); end return tmp end
function tmp_2 = code(x, c, s) t_0 = s * (x * s); tmp = 0.0; if (x <= 3.2e-177) tmp = 1.0 / ((c - c) * (s / s)); elseif (x <= 1.2e+133) tmp = 1.0 / (t_0 * (c * c)); else tmp = 1.0 / (t_0 * (c / -2.0)); end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3.2e-177], N[(1.0 / N[(N[(c - c), $MachinePrecision] * N[(s / s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2e+133], N[(1.0 / N[(t$95$0 * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$0 * N[(c / -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 3.2 \cdot 10^{-177}:\\
\;\;\;\;\frac{1}{\left(c - c\right) \cdot \frac{s}{s}}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+133}:\\
\;\;\;\;\frac{1}{t_0 \cdot \left(c \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0 \cdot \frac{c}{-2}}\\
\end{array}
\end{array}
if x < 3.1999999999999998e-177Initial program 67.2%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/r*67.2%
*-commutative67.2%
associate-*r*66.7%
associate-*r*67.2%
associate-*r*60.5%
sqr-neg60.5%
associate-*r*67.2%
*-commutative67.2%
unpow267.2%
sqr-neg67.2%
unpow267.2%
Simplified67.9%
Taylor expanded in x around 0 56.0%
unpow256.0%
*-commutative56.0%
unpow256.0%
unpow256.0%
associate-*r*59.4%
associate-*r*58.8%
*-commutative58.8%
associate-*r*59.5%
associate-*r*58.8%
*-commutative58.8%
*-commutative58.8%
associate-*r*61.2%
Simplified61.2%
Applied egg-rr28.6%
Applied egg-rr35.0%
if 3.1999999999999998e-177 < x < 1.1999999999999999e133Initial program 75.2%
associate-/r*75.1%
remove-double-neg75.1%
distribute-lft-neg-out75.1%
distribute-lft-neg-out75.1%
distribute-rgt-neg-out75.1%
associate-/r*75.2%
*-commutative75.2%
associate-*r*73.4%
associate-*r*75.2%
associate-*r*75.2%
sqr-neg75.2%
associate-*r*75.2%
*-commutative75.2%
unpow275.2%
sqr-neg75.2%
unpow275.2%
Simplified75.1%
Taylor expanded in x around 0 64.4%
unpow264.4%
*-commutative64.4%
unpow264.4%
unpow264.4%
associate-*r*64.4%
associate-*r*64.3%
*-commutative64.3%
associate-*r*64.4%
associate-*r*64.3%
*-commutative64.3%
*-commutative64.3%
associate-*r*66.1%
Simplified66.1%
Applied egg-rr26.6%
distribute-lft-neg-in26.6%
metadata-eval26.6%
count-226.6%
prod-exp26.6%
rem-exp-log26.6%
rem-exp-log55.0%
Simplified55.0%
if 1.1999999999999999e133 < x Initial program 70.5%
associate-/r*64.4%
remove-double-neg64.4%
distribute-lft-neg-out64.4%
distribute-lft-neg-out64.4%
distribute-rgt-neg-out64.4%
associate-/r*70.5%
*-commutative70.5%
associate-*r*70.5%
associate-*r*70.5%
associate-*r*61.0%
sqr-neg61.0%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
sqr-neg70.5%
unpow270.5%
Simplified67.8%
Taylor expanded in x around 0 58.0%
unpow258.0%
*-commutative58.0%
unpow258.0%
unpow258.0%
associate-*r*62.8%
associate-*r*62.8%
*-commutative62.8%
associate-*r*62.4%
associate-*r*62.8%
*-commutative62.8%
*-commutative62.8%
associate-*r*69.4%
Simplified69.4%
Applied egg-rr59.6%
Final simplification42.7%
(FPCore (x c s) :precision binary64 (/ 1.0 (* c (* x (* c (* s (* x s)))))))
double code(double x, double c, double s) {
return 1.0 / (c * (x * (c * (s * (x * 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 / (c * (x * (c * (s * (x * s)))))
end function
public static double code(double x, double c, double s) {
return 1.0 / (c * (x * (c * (s * (x * s)))));
}
def code(x, c, s): return 1.0 / (c * (x * (c * (s * (x * s)))))
function code(x, c, s) return Float64(1.0 / Float64(c * Float64(x * Float64(c * Float64(s * Float64(x * s)))))) end
function tmp = code(x, c, s) tmp = 1.0 / (c * (x * (c * (s * (x * s))))); end
code[x_, c_, s_] := N[(1.0 / N[(c * N[(x * N[(c * N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{c \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(x \cdot s\right)\right)\right)\right)}
\end{array}
Initial program 69.5%
associate-/r*68.3%
remove-double-neg68.3%
distribute-lft-neg-out68.3%
distribute-lft-neg-out68.3%
distribute-rgt-neg-out68.3%
associate-/r*69.5%
*-commutative69.5%
associate-*r*68.7%
associate-*r*69.5%
associate-*r*63.9%
sqr-neg63.9%
associate-*r*69.5%
*-commutative69.5%
unpow269.5%
sqr-neg69.5%
unpow269.5%
Simplified69.5%
associate-/r*69.7%
associate-*l*77.5%
associate-/r*79.3%
associate-*r*83.4%
associate-*r*90.4%
associate-/r*89.6%
div-inv89.6%
associate-/l/89.7%
count-289.7%
*-commutative89.7%
Applied egg-rr89.7%
associate-*r/89.7%
*-rgt-identity89.7%
associate-/l/89.4%
Simplified89.4%
Taylor expanded in x around 0 58.1%
unpow258.1%
associate-*r*60.9%
unpow260.9%
associate-*r*64.5%
associate-*l*64.1%
unpow264.1%
associate-*r*70.2%
associate-*l*70.7%
Simplified70.7%
Final simplification70.7%
(FPCore (x c s) :precision binary64 (/ 1.0 (* c (* x (* s (* x (* c s)))))))
double code(double x, double c, double s) {
return 1.0 / (c * (x * (s * (x * (c * 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 / (c * (x * (s * (x * (c * s)))))
end function
public static double code(double x, double c, double s) {
return 1.0 / (c * (x * (s * (x * (c * s)))));
}
def code(x, c, s): return 1.0 / (c * (x * (s * (x * (c * s)))))
function code(x, c, s) return Float64(1.0 / Float64(c * Float64(x * Float64(s * Float64(x * Float64(c * s)))))) end
function tmp = code(x, c, s) tmp = 1.0 / (c * (x * (s * (x * (c * s))))); end
code[x_, c_, s_] := N[(1.0 / N[(c * N[(x * N[(s * N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{c \cdot \left(x \cdot \left(s \cdot \left(x \cdot \left(c \cdot s\right)\right)\right)\right)}
\end{array}
Initial program 69.5%
associate-/r*68.3%
remove-double-neg68.3%
distribute-lft-neg-out68.3%
distribute-lft-neg-out68.3%
distribute-rgt-neg-out68.3%
associate-/r*69.5%
*-commutative69.5%
associate-*r*68.7%
associate-*r*69.5%
associate-*r*63.9%
sqr-neg63.9%
associate-*r*69.5%
*-commutative69.5%
unpow269.5%
sqr-neg69.5%
unpow269.5%
Simplified69.5%
associate-/r*69.7%
associate-*l*77.5%
associate-/r*79.3%
associate-*r*83.4%
associate-*r*90.4%
associate-/r*89.6%
div-inv89.6%
associate-/l/89.7%
count-289.7%
*-commutative89.7%
Applied egg-rr89.7%
associate-*r/89.7%
*-rgt-identity89.7%
associate-/l/89.4%
Simplified89.4%
Taylor expanded in x around 0 58.1%
unpow258.1%
associate-*r*60.9%
unpow260.9%
associate-*r*64.5%
associate-*l*64.1%
unpow264.1%
associate-*r*70.2%
associate-*l*70.7%
*-commutative70.7%
associate-*l*75.7%
*-commutative75.7%
associate-*r*75.7%
*-commutative75.7%
Simplified75.7%
Final simplification75.7%
(FPCore (x c s) :precision binary64 (if (<= s 4.1e+95) (/ 1.0 (* (- c c) (/ s s))) 0.0))
double code(double x, double c, double s) {
double tmp;
if (s <= 4.1e+95) {
tmp = 1.0 / ((c - c) * (s / s));
} else {
tmp = 0.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 (s <= 4.1d+95) then
tmp = 1.0d0 / ((c - c) * (s / s))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (s <= 4.1e+95) {
tmp = 1.0 / ((c - c) * (s / s));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 4.1e+95: tmp = 1.0 / ((c - c) * (s / s)) else: tmp = 0.0 return tmp
function code(x, c, s) tmp = 0.0 if (s <= 4.1e+95) tmp = Float64(1.0 / Float64(Float64(c - c) * Float64(s / s))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (s <= 4.1e+95) tmp = 1.0 / ((c - c) * (s / s)); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 4.1e+95], N[(1.0 / N[(N[(c - c), $MachinePrecision] * N[(s / s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;s \leq 4.1 \cdot 10^{+95}:\\
\;\;\;\;\frac{1}{\left(c - c\right) \cdot \frac{s}{s}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if s < 4.09999999999999986e95Initial program 70.5%
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*70.5%
*-commutative70.5%
associate-*r*70.1%
associate-*r*70.5%
associate-*r*63.9%
sqr-neg63.9%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
sqr-neg70.5%
unpow270.5%
Simplified70.6%
Taylor expanded in x around 0 57.4%
unpow257.4%
*-commutative57.4%
unpow257.4%
unpow257.4%
associate-*r*60.7%
associate-*r*60.7%
*-commutative60.7%
associate-*r*60.8%
associate-*r*60.7%
*-commutative60.7%
*-commutative60.7%
associate-*r*63.6%
Simplified63.6%
Applied egg-rr35.3%
Applied egg-rr34.0%
if 4.09999999999999986e95 < s Initial program 64.1%
associate-/r*61.8%
remove-double-neg61.8%
distribute-lft-neg-out61.8%
distribute-lft-neg-out61.8%
distribute-rgt-neg-out61.8%
associate-/r*64.1%
*-commutative64.1%
associate-*r*61.9%
associate-*r*64.1%
associate-*r*63.8%
sqr-neg63.8%
associate-*r*64.1%
*-commutative64.1%
unpow264.1%
sqr-neg64.1%
unpow264.1%
Simplified64.1%
associate-/r*65.5%
associate-*l*77.7%
associate-/r*77.6%
associate-*r*82.1%
associate-*r*88.8%
associate-/r*88.8%
div-inv88.7%
associate-/l/88.7%
count-288.7%
*-commutative88.7%
Applied egg-rr88.7%
associate-*r/88.8%
*-rgt-identity88.8%
associate-/l/88.8%
Simplified88.8%
Applied egg-rr62.7%
+-inverses62.7%
Simplified62.7%
Final simplification38.8%
(FPCore (x c s) :precision binary64 (if (<= s 5.1e+95) (/ 1.0 (* c (* x c))) 0.0))
double code(double x, double c, double s) {
double tmp;
if (s <= 5.1e+95) {
tmp = 1.0 / (c * (x * c));
} else {
tmp = 0.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 (s <= 5.1d+95) then
tmp = 1.0d0 / (c * (x * c))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (s <= 5.1e+95) {
tmp = 1.0 / (c * (x * c));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 5.1e+95: tmp = 1.0 / (c * (x * c)) else: tmp = 0.0 return tmp
function code(x, c, s) tmp = 0.0 if (s <= 5.1e+95) tmp = Float64(1.0 / Float64(c * Float64(x * c))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (s <= 5.1e+95) tmp = 1.0 / (c * (x * c)); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 5.1e+95], N[(1.0 / N[(c * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;s \leq 5.1 \cdot 10^{+95}:\\
\;\;\;\;\frac{1}{c \cdot \left(x \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if s < 5.10000000000000003e95Initial program 70.5%
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*70.5%
*-commutative70.5%
associate-*r*70.1%
associate-*r*70.5%
associate-*r*63.9%
sqr-neg63.9%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
sqr-neg70.5%
unpow270.5%
Simplified70.6%
Taylor expanded in x around 0 57.4%
unpow257.4%
*-commutative57.4%
unpow257.4%
unpow257.4%
associate-*r*60.7%
associate-*r*60.7%
*-commutative60.7%
associate-*r*60.8%
associate-*r*60.7%
*-commutative60.7%
*-commutative60.7%
associate-*r*63.6%
Simplified63.6%
Applied egg-rr35.3%
Taylor expanded in c around 0 35.3%
unpow235.3%
associate-*l*32.8%
Simplified32.8%
if 5.10000000000000003e95 < s Initial program 64.1%
associate-/r*61.8%
remove-double-neg61.8%
distribute-lft-neg-out61.8%
distribute-lft-neg-out61.8%
distribute-rgt-neg-out61.8%
associate-/r*64.1%
*-commutative64.1%
associate-*r*61.9%
associate-*r*64.1%
associate-*r*63.8%
sqr-neg63.8%
associate-*r*64.1%
*-commutative64.1%
unpow264.1%
sqr-neg64.1%
unpow264.1%
Simplified64.1%
associate-/r*65.5%
associate-*l*77.7%
associate-/r*77.6%
associate-*r*82.1%
associate-*r*88.8%
associate-/r*88.8%
div-inv88.7%
associate-/l/88.7%
count-288.7%
*-commutative88.7%
Applied egg-rr88.7%
associate-*r/88.8%
*-rgt-identity88.8%
associate-/l/88.8%
Simplified88.8%
Applied egg-rr62.7%
+-inverses62.7%
Simplified62.7%
Final simplification37.8%
(FPCore (x c s) :precision binary64 (if (<= s 5.4e+95) (/ (/ 1.0 x) (* c c)) 0.0))
double code(double x, double c, double s) {
double tmp;
if (s <= 5.4e+95) {
tmp = (1.0 / x) / (c * c);
} else {
tmp = 0.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 (s <= 5.4d+95) then
tmp = (1.0d0 / x) / (c * c)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (s <= 5.4e+95) {
tmp = (1.0 / x) / (c * c);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 5.4e+95: tmp = (1.0 / x) / (c * c) else: tmp = 0.0 return tmp
function code(x, c, s) tmp = 0.0 if (s <= 5.4e+95) tmp = Float64(Float64(1.0 / x) / Float64(c * c)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (s <= 5.4e+95) tmp = (1.0 / x) / (c * c); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 5.4e+95], N[(N[(1.0 / x), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;s \leq 5.4 \cdot 10^{+95}:\\
\;\;\;\;\frac{\frac{1}{x}}{c \cdot c}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if s < 5.4e95Initial program 70.5%
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*70.5%
*-commutative70.5%
associate-*r*70.1%
associate-*r*70.5%
associate-*r*63.9%
sqr-neg63.9%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
sqr-neg70.5%
unpow270.5%
Simplified70.6%
Taylor expanded in x around 0 57.4%
unpow257.4%
*-commutative57.4%
unpow257.4%
unpow257.4%
associate-*r*60.7%
associate-*r*60.7%
*-commutative60.7%
associate-*r*60.8%
associate-*r*60.7%
*-commutative60.7%
*-commutative60.7%
associate-*r*63.6%
Simplified63.6%
Applied egg-rr35.3%
Taylor expanded in c around 0 35.3%
associate-/l/35.3%
unpow235.3%
Simplified35.3%
if 5.4e95 < s Initial program 64.1%
associate-/r*61.8%
remove-double-neg61.8%
distribute-lft-neg-out61.8%
distribute-lft-neg-out61.8%
distribute-rgt-neg-out61.8%
associate-/r*64.1%
*-commutative64.1%
associate-*r*61.9%
associate-*r*64.1%
associate-*r*63.8%
sqr-neg63.8%
associate-*r*64.1%
*-commutative64.1%
unpow264.1%
sqr-neg64.1%
unpow264.1%
Simplified64.1%
associate-/r*65.5%
associate-*l*77.7%
associate-/r*77.6%
associate-*r*82.1%
associate-*r*88.8%
associate-/r*88.8%
div-inv88.7%
associate-/l/88.7%
count-288.7%
*-commutative88.7%
Applied egg-rr88.7%
associate-*r/88.8%
*-rgt-identity88.8%
associate-/l/88.8%
Simplified88.8%
Applied egg-rr62.7%
+-inverses62.7%
Simplified62.7%
Final simplification39.9%
(FPCore (x c s) :precision binary64 -0.5)
double code(double x, double c, double s) {
return -0.5;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = -0.5d0
end function
public static double code(double x, double c, double s) {
return -0.5;
}
def code(x, c, s): return -0.5
function code(x, c, s) return -0.5 end
function tmp = code(x, c, s) tmp = -0.5; end
code[x_, c_, s_] := -0.5
\begin{array}{l}
\\
-0.5
\end{array}
Initial program 69.5%
associate-/r*68.3%
remove-double-neg68.3%
distribute-lft-neg-out68.3%
distribute-lft-neg-out68.3%
distribute-rgt-neg-out68.3%
associate-/r*69.5%
*-commutative69.5%
associate-*r*68.7%
associate-*r*69.5%
associate-*r*63.9%
sqr-neg63.9%
associate-*r*69.5%
*-commutative69.5%
unpow269.5%
sqr-neg69.5%
unpow269.5%
Simplified69.5%
Taylor expanded in x around 0 58.1%
unpow258.1%
*-commutative58.1%
unpow258.1%
unpow258.1%
associate-*r*60.9%
associate-*r*60.5%
*-commutative60.5%
associate-*r*61.0%
associate-*r*60.5%
*-commutative60.5%
*-commutative60.5%
associate-*r*63.4%
Simplified63.4%
Applied egg-rr34.5%
Applied egg-rr3.3%
Taylor expanded in c around 0 2.2%
Final simplification2.2%
(FPCore (x c s) :precision binary64 0.0)
double code(double x, double c, double s) {
return 0.0;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 0.0d0
end function
public static double code(double x, double c, double s) {
return 0.0;
}
def code(x, c, s): return 0.0
function code(x, c, s) return 0.0 end
function tmp = code(x, c, s) tmp = 0.0; end
code[x_, c_, s_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 69.5%
associate-/r*68.3%
remove-double-neg68.3%
distribute-lft-neg-out68.3%
distribute-lft-neg-out68.3%
distribute-rgt-neg-out68.3%
associate-/r*69.5%
*-commutative69.5%
associate-*r*68.7%
associate-*r*69.5%
associate-*r*63.9%
sqr-neg63.9%
associate-*r*69.5%
*-commutative69.5%
unpow269.5%
sqr-neg69.5%
unpow269.5%
Simplified69.5%
associate-/r*69.7%
associate-*l*77.5%
associate-/r*79.3%
associate-*r*83.4%
associate-*r*90.4%
associate-/r*89.6%
div-inv89.6%
associate-/l/89.7%
count-289.7%
*-commutative89.7%
Applied egg-rr89.7%
associate-*r/89.7%
*-rgt-identity89.7%
associate-/l/89.4%
Simplified89.4%
Applied egg-rr35.2%
+-inverses35.2%
Simplified35.2%
Final simplification35.2%
herbie shell --seed 2023297
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))