
(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 15 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}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (* 2.0 x))))
(if (<= x 5.2e-18)
(/ -1.0 (* (* c (* x s)) (* c (* x (- s)))))
(if (<= x 1e+125)
(/ (/ t_0 (* c s)) (* x (* x (* c s))))
(/ t_0 (* (* (* x c) (* x c)) (* s s)))))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = cos((2.0 * x));
double tmp;
if (x <= 5.2e-18) {
tmp = -1.0 / ((c * (x * s)) * (c * (x * -s)));
} else if (x <= 1e+125) {
tmp = (t_0 / (c * s)) / (x * (x * (c * s)));
} else {
tmp = t_0 / (((x * c) * (x * c)) * (s * s));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 (x <= 5.2d-18) then
tmp = (-1.0d0) / ((c * (x * s)) * (c * (x * -s)))
else if (x <= 1d+125) then
tmp = (t_0 / (c * s)) / (x * (x * (c * s)))
else
tmp = t_0 / (((x * c) * (x * c)) * (s * s))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = Math.cos((2.0 * x));
double tmp;
if (x <= 5.2e-18) {
tmp = -1.0 / ((c * (x * s)) * (c * (x * -s)));
} else if (x <= 1e+125) {
tmp = (t_0 / (c * s)) / (x * (x * (c * s)));
} else {
tmp = t_0 / (((x * c) * (x * c)) * (s * s));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = math.cos((2.0 * x)) tmp = 0 if x <= 5.2e-18: tmp = -1.0 / ((c * (x * s)) * (c * (x * -s))) elif x <= 1e+125: tmp = (t_0 / (c * s)) / (x * (x * (c * s))) else: tmp = t_0 / (((x * c) * (x * c)) * (s * s)) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = cos(Float64(2.0 * x)) tmp = 0.0 if (x <= 5.2e-18) tmp = Float64(-1.0 / Float64(Float64(c * Float64(x * s)) * Float64(c * Float64(x * Float64(-s))))); elseif (x <= 1e+125) tmp = Float64(Float64(t_0 / Float64(c * s)) / Float64(x * Float64(x * Float64(c * s)))); else tmp = Float64(t_0 / Float64(Float64(Float64(x * c) * Float64(x * c)) * Float64(s * s))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = cos((2.0 * x));
tmp = 0.0;
if (x <= 5.2e-18)
tmp = -1.0 / ((c * (x * s)) * (c * (x * -s)));
elseif (x <= 1e+125)
tmp = (t_0 / (c * s)) / (x * (x * (c * s)));
else
tmp = t_0 / (((x * c) * (x * c)) * (s * s));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 5.2e-18], N[(-1.0 / N[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(c * N[(x * (-s)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e+125], N[(N[(t$95$0 / N[(c * s), $MachinePrecision]), $MachinePrecision] / N[(x * N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(N[(N[(x * c), $MachinePrecision] * N[(x * c), $MachinePrecision]), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \cos \left(2 \cdot x\right)\\
\mathbf{if}\;x \leq 5.2 \cdot 10^{-18}:\\
\;\;\;\;\frac{-1}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(c \cdot \left(x \cdot \left(-s\right)\right)\right)}\\
\mathbf{elif}\;x \leq 10^{+125}:\\
\;\;\;\;\frac{\frac{t_0}{c \cdot s}}{x \cdot \left(x \cdot \left(c \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{\left(\left(x \cdot c\right) \cdot \left(x \cdot c\right)\right) \cdot \left(s \cdot s\right)}\\
\end{array}
\end{array}
if x < 5.2000000000000001e-18Initial program 64.5%
associate-/r*64.0%
remove-double-neg64.0%
distribute-lft-neg-out64.0%
distribute-lft-neg-out64.0%
distribute-rgt-neg-out64.0%
associate-/l/64.5%
distribute-rgt-neg-out64.5%
distribute-lft-neg-out64.5%
associate-*l*67.3%
distribute-lft-neg-in67.3%
distribute-lft-neg-out67.3%
remove-double-neg67.3%
associate-*r*67.1%
*-commutative67.1%
associate-*r*65.2%
Simplified65.2%
associate-/r*65.2%
swap-sqr85.5%
associate-/r*74.1%
associate-/r*73.7%
associate-/r*74.6%
*-un-lft-identity74.6%
add-sqr-sqrt74.5%
times-frac74.5%
Applied egg-rr97.2%
Taylor expanded in x around 0 85.0%
associate-/r*85.0%
Simplified85.0%
associate-/r*85.0%
frac-2neg85.0%
metadata-eval85.0%
*-commutative85.0%
frac-times85.1%
metadata-eval85.1%
*-commutative85.1%
Applied egg-rr85.1%
if 5.2000000000000001e-18 < x < 9.9999999999999992e124Initial program 68.2%
associate-/r*68.2%
remove-double-neg68.2%
distribute-lft-neg-out68.2%
distribute-lft-neg-out68.2%
distribute-rgt-neg-out68.2%
associate-/l/68.2%
distribute-rgt-neg-out68.2%
distribute-lft-neg-out68.2%
associate-*l*68.3%
distribute-lft-neg-in68.3%
distribute-lft-neg-out68.3%
remove-double-neg68.3%
associate-*r*60.3%
*-commutative60.3%
associate-*r*60.3%
Simplified65.5%
Taylor expanded in x around 0 68.2%
unpow268.2%
unpow268.2%
unpow268.2%
swap-sqr68.2%
swap-sqr95.5%
unpow295.5%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
*-commutative99.7%
*-un-lft-identity99.7%
unpow299.7%
unswap-sqr91.5%
associate-*r*99.6%
times-frac99.6%
Applied egg-rr99.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
Simplified99.6%
if 9.9999999999999992e124 < x Initial program 65.4%
associate-/r*63.6%
remove-double-neg63.6%
distribute-lft-neg-out63.6%
distribute-lft-neg-out63.6%
distribute-rgt-neg-out63.6%
associate-/l/65.4%
distribute-rgt-neg-out65.4%
distribute-lft-neg-out65.4%
associate-*l*67.3%
distribute-lft-neg-in67.3%
distribute-lft-neg-out67.3%
remove-double-neg67.3%
associate-*r*65.5%
*-commutative65.5%
associate-*r*63.5%
Simplified66.0%
Taylor expanded in x around 0 52.9%
unpow252.9%
unpow252.9%
unpow252.9%
swap-sqr87.5%
swap-sqr99.5%
unpow299.5%
associate-*r*97.2%
*-commutative97.2%
Simplified97.2%
unpow297.2%
associate-*r*92.8%
associate-*r*95.2%
swap-sqr72.8%
Applied egg-rr72.8%
Final simplification84.4%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (pow (* x (* c s)) 2.0)))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return cos((2.0 * x)) / pow((x * (c * s)), 2.0);
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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)) / ((x * (c * s)) ** 2.0d0)
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / Math.pow((x * (c * s)), 2.0);
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return math.cos((2.0 * x)) / math.pow((x * (c * s)), 2.0)
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / (Float64(x * Float64(c * s)) ^ 2.0)) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = cos((2.0 * x)) / ((x * (c * s)) ^ 2.0);
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[Power[N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\cos \left(2 \cdot x\right)}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}
\end{array}
Initial program 65.0%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/l/65.0%
distribute-rgt-neg-out65.0%
distribute-lft-neg-out65.0%
associate-*l*67.4%
distribute-lft-neg-in67.4%
distribute-lft-neg-out67.4%
remove-double-neg67.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*64.5%
Simplified70.4%
Taylor expanded in x around 0 58.6%
unpow258.6%
unpow258.6%
unpow258.6%
swap-sqr76.5%
swap-sqr97.5%
unpow297.5%
associate-*r*97.7%
*-commutative97.7%
Simplified97.7%
Final simplification97.7%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (pow (* c (* x s)) 2.0)))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return cos((2.0 * x)) / pow((c * (x * s)), 2.0);
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 * (x * s)) ** 2.0d0)
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / Math.pow((c * (x * s)), 2.0);
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return math.cos((2.0 * x)) / math.pow((c * (x * s)), 2.0)
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / (Float64(c * Float64(x * s)) ^ 2.0)) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = cos((2.0 * x)) / ((c * (x * s)) ^ 2.0);
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\cos \left(2 \cdot x\right)}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}
\end{array}
Initial program 65.0%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/l/65.0%
distribute-rgt-neg-out65.0%
distribute-lft-neg-out65.0%
associate-*l*67.4%
distribute-lft-neg-in67.4%
distribute-lft-neg-out67.4%
remove-double-neg67.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*64.5%
Simplified70.4%
associate-*r*64.5%
*-commutative64.5%
associate-*r*66.2%
associate-*l*65.0%
*-commutative65.0%
add-sqr-sqrt64.9%
pow264.9%
sqrt-prod64.9%
sqrt-prod35.3%
add-sqr-sqrt70.6%
associate-*r*63.4%
sqrt-prod65.8%
sqrt-prod35.5%
add-sqr-sqrt78.0%
sqrt-prod47.5%
add-sqr-sqrt97.5%
*-commutative97.5%
Applied egg-rr97.5%
Final simplification97.5%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))))
(if (<= x 0.01)
(/ (+ 1.0 (* -2.0 (* x x))) (* t_0 t_0))
(/ (cos (* 2.0 x)) (* x (* x (* c (* c (* s s)))))))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 0.01) {
tmp = (1.0 + (-2.0 * (x * x))) / (t_0 * t_0);
} else {
tmp = cos((2.0 * x)) / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 <= 0.01d0) then
tmp = (1.0d0 + ((-2.0d0) * (x * x))) / (t_0 * t_0)
else
tmp = cos((2.0d0 * x)) / (x * (x * (c * (c * (s * s)))))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 0.01) {
tmp = (1.0 + (-2.0 * (x * x))) / (t_0 * t_0);
} else {
tmp = Math.cos((2.0 * x)) / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (x * s) tmp = 0 if x <= 0.01: tmp = (1.0 + (-2.0 * (x * x))) / (t_0 * t_0) else: tmp = math.cos((2.0 * x)) / (x * (x * (c * (c * (s * s))))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 0.01) tmp = Float64(Float64(1.0 + Float64(-2.0 * Float64(x * x))) / Float64(t_0 * t_0)); else tmp = Float64(cos(Float64(2.0 * x)) / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = c * (x * s);
tmp = 0.0;
if (x <= 0.01)
tmp = (1.0 + (-2.0 * (x * x))) / (t_0 * t_0);
else
tmp = cos((2.0 * x)) / (x * (x * (c * (c * (s * s)))));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.01], N[(N[(1.0 + N[(-2.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 0.01:\\
\;\;\;\;\frac{1 + -2 \cdot \left(x \cdot x\right)}{t_0 \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\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 < 0.0100000000000000002Initial program 64.4%
associate-/r*63.9%
*-commutative63.9%
associate-*l*58.1%
unpow258.1%
unpow258.1%
associate-*r*63.7%
associate-/r*65.6%
associate-/l/65.6%
associate-/l/65.6%
*-commutative65.6%
associate-*l*64.8%
unpow264.8%
associate-*l*59.4%
unpow259.4%
unswap-sqr74.8%
*-commutative74.8%
*-commutative74.8%
Simplified74.8%
Taylor expanded in x around 0 60.0%
unpow260.0%
Simplified60.0%
unswap-sqr74.6%
unpow274.6%
*-commutative74.6%
associate-*r*75.2%
*-commutative75.2%
Applied egg-rr75.2%
unpow275.2%
Applied egg-rr75.2%
if 0.0100000000000000002 < x Initial program 66.8%
associate-/r*65.7%
remove-double-neg65.7%
distribute-lft-neg-out65.7%
distribute-lft-neg-out65.7%
distribute-rgt-neg-out65.7%
associate-/l/66.8%
distribute-rgt-neg-out66.8%
distribute-lft-neg-out66.8%
associate-*l*68.2%
distribute-lft-neg-in68.2%
distribute-lft-neg-out68.2%
remove-double-neg68.2%
associate-*r*64.1%
*-commutative64.1%
associate-*r*62.7%
Simplified66.3%
Final simplification73.1%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= x 4.2e-17) (/ -1.0 (* (* c (* x s)) (* c (* x (- s))))) (/ (cos (* 2.0 x)) (* x (* x (* c (* s (* c s))))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 4.2e-17) {
tmp = -1.0 / ((c * (x * s)) * (c * (x * -s)));
} else {
tmp = cos((2.0 * x)) / (x * (x * (c * (s * (c * s)))));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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.2d-17) then
tmp = (-1.0d0) / ((c * (x * s)) * (c * (x * -s)))
else
tmp = cos((2.0d0 * x)) / (x * (x * (c * (s * (c * s)))))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 4.2e-17) {
tmp = -1.0 / ((c * (x * s)) * (c * (x * -s)));
} else {
tmp = Math.cos((2.0 * x)) / (x * (x * (c * (s * (c * s)))));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 4.2e-17: tmp = -1.0 / ((c * (x * s)) * (c * (x * -s))) else: tmp = math.cos((2.0 * x)) / (x * (x * (c * (s * (c * s))))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 4.2e-17) tmp = Float64(-1.0 / Float64(Float64(c * Float64(x * s)) * Float64(c * Float64(x * Float64(-s))))); else tmp = Float64(cos(Float64(2.0 * x)) / Float64(x * Float64(x * Float64(c * Float64(s * Float64(c * s)))))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 4.2e-17)
tmp = -1.0 / ((c * (x * s)) * (c * (x * -s)));
else
tmp = cos((2.0 * x)) / (x * (x * (c * (s * (c * s)))));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 4.2e-17], N[(-1.0 / N[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(c * N[(x * (-s)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(c * N[(s * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.2 \cdot 10^{-17}:\\
\;\;\;\;\frac{-1}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(c \cdot \left(x \cdot \left(-s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(c \cdot s\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 4.19999999999999984e-17Initial program 64.5%
associate-/r*64.0%
remove-double-neg64.0%
distribute-lft-neg-out64.0%
distribute-lft-neg-out64.0%
distribute-rgt-neg-out64.0%
associate-/l/64.5%
distribute-rgt-neg-out64.5%
distribute-lft-neg-out64.5%
associate-*l*67.3%
distribute-lft-neg-in67.3%
distribute-lft-neg-out67.3%
remove-double-neg67.3%
associate-*r*67.1%
*-commutative67.1%
associate-*r*65.2%
Simplified65.2%
associate-/r*65.2%
swap-sqr85.5%
associate-/r*74.1%
associate-/r*73.7%
associate-/r*74.6%
*-un-lft-identity74.6%
add-sqr-sqrt74.5%
times-frac74.5%
Applied egg-rr97.2%
Taylor expanded in x around 0 85.0%
associate-/r*85.0%
Simplified85.0%
associate-/r*85.0%
frac-2neg85.0%
metadata-eval85.0%
*-commutative85.0%
frac-times85.1%
metadata-eval85.1%
*-commutative85.1%
Applied egg-rr85.1%
if 4.19999999999999984e-17 < x Initial program 66.3%
associate-/r*65.2%
remove-double-neg65.2%
distribute-lft-neg-out65.2%
distribute-lft-neg-out65.2%
distribute-rgt-neg-out65.2%
associate-/l/66.3%
distribute-rgt-neg-out66.3%
distribute-lft-neg-out66.3%
associate-*l*67.7%
distribute-lft-neg-in67.7%
distribute-lft-neg-out67.7%
remove-double-neg67.7%
associate-*r*63.7%
*-commutative63.7%
associate-*r*62.3%
Simplified65.9%
Taylor expanded in c around 0 65.9%
unpow255.0%
associate-*r*62.0%
*-commutative62.0%
Simplified81.5%
Final simplification84.2%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))))
(if (<= x 1.6e-60)
(/ (/ 1.0 c) (* (* x s) t_0))
(/ (cos (* 2.0 x)) (* s (* t_0 (* x c)))))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 1.6e-60) {
tmp = (1.0 / c) / ((x * s) * t_0);
} else {
tmp = cos((2.0 * x)) / (s * (t_0 * (x * c)));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 <= 1.6d-60) then
tmp = (1.0d0 / c) / ((x * s) * t_0)
else
tmp = cos((2.0d0 * x)) / (s * (t_0 * (x * c)))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 1.6e-60) {
tmp = (1.0 / c) / ((x * s) * t_0);
} else {
tmp = Math.cos((2.0 * x)) / (s * (t_0 * (x * c)));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (x * s) tmp = 0 if x <= 1.6e-60: tmp = (1.0 / c) / ((x * s) * t_0) else: tmp = math.cos((2.0 * x)) / (s * (t_0 * (x * c))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 1.6e-60) tmp = Float64(Float64(1.0 / c) / Float64(Float64(x * s) * t_0)); else tmp = Float64(cos(Float64(2.0 * x)) / Float64(s * Float64(t_0 * Float64(x * c)))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = c * (x * s);
tmp = 0.0;
if (x <= 1.6e-60)
tmp = (1.0 / c) / ((x * s) * t_0);
else
tmp = cos((2.0 * x)) / (s * (t_0 * (x * c)));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.6e-60], N[(N[(1.0 / c), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(s * N[(t$95$0 * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 1.6 \cdot 10^{-60}:\\
\;\;\;\;\frac{\frac{1}{c}}{\left(x \cdot s\right) \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{s \cdot \left(t_0 \cdot \left(x \cdot c\right)\right)}\\
\end{array}
\end{array}
if x < 1.6000000000000001e-60Initial program 64.4%
associate-/r*63.9%
remove-double-neg63.9%
distribute-lft-neg-out63.9%
distribute-lft-neg-out63.9%
distribute-rgt-neg-out63.9%
associate-/l/64.4%
distribute-rgt-neg-out64.4%
distribute-lft-neg-out64.4%
associate-*l*66.8%
distribute-lft-neg-in66.8%
distribute-lft-neg-out66.8%
remove-double-neg66.8%
associate-*r*66.6%
*-commutative66.6%
associate-*r*64.6%
Simplified64.6%
associate-/r*64.6%
swap-sqr84.8%
associate-/r*72.9%
associate-/r*72.5%
associate-/r*73.4%
*-un-lft-identity73.4%
add-sqr-sqrt73.3%
times-frac73.3%
Applied egg-rr97.1%
Taylor expanded in x around 0 84.3%
associate-/r*84.4%
Simplified84.4%
frac-times82.1%
*-un-lft-identity82.1%
*-commutative82.1%
*-commutative82.1%
Applied egg-rr82.1%
if 1.6000000000000001e-60 < x Initial program 66.4%
associate-/r*65.5%
remove-double-neg65.5%
distribute-lft-neg-out65.5%
distribute-lft-neg-out65.5%
distribute-rgt-neg-out65.5%
associate-/l/66.4%
distribute-rgt-neg-out66.4%
distribute-lft-neg-out66.4%
associate-*l*68.9%
distribute-lft-neg-in68.9%
distribute-lft-neg-out68.9%
remove-double-neg68.9%
associate-*r*65.5%
*-commutative65.5%
associate-*r*64.3%
Simplified68.8%
Taylor expanded in x around 0 59.4%
unpow259.4%
unpow259.4%
unpow259.4%
swap-sqr78.9%
swap-sqr98.2%
unpow298.2%
associate-*r*98.3%
*-commutative98.3%
Simplified98.3%
unpow298.3%
*-commutative98.3%
associate-*r*97.0%
associate-*r*95.9%
associate-*r*93.4%
*-commutative93.4%
Applied egg-rr93.4%
Final simplification85.3%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (* c (* x s)))) (/ (/ (cos (* 2.0 x)) t_0) t_0)))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (x * s);
return (cos((2.0 * x)) / t_0) / t_0;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 = c * (x * s)
code = (cos((2.0d0 * x)) / t_0) / t_0
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
return (Math.cos((2.0 * x)) / t_0) / t_0;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (x * s) return (math.cos((2.0 * x)) / t_0) / t_0
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(x * s)) return Float64(Float64(cos(Float64(2.0 * x)) / t_0) / t_0) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = c * (x * s);
tmp = (cos((2.0 * x)) / t_0) / t_0;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{\frac{\cos \left(2 \cdot x\right)}{t_0}}{t_0}
\end{array}
\end{array}
Initial program 65.0%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/l/65.0%
distribute-rgt-neg-out65.0%
distribute-lft-neg-out65.0%
associate-*l*67.4%
distribute-lft-neg-in67.4%
distribute-lft-neg-out67.4%
remove-double-neg67.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*64.5%
Simplified64.5%
associate-/r*64.5%
swap-sqr85.1%
associate-/r*73.6%
associate-/r*73.3%
associate-/r*73.9%
*-un-lft-identity73.9%
add-sqr-sqrt73.9%
times-frac73.9%
Applied egg-rr97.4%
associate-*l/97.4%
*-un-lft-identity97.4%
*-commutative97.4%
*-commutative97.4%
Applied egg-rr97.4%
Final simplification97.4%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))))
(if (<= x 1e-16)
(/ -1.0 (* t_0 (* c (* x (- s)))))
(if (<= x 3.6e+122)
(/ (+ 1.0 (* -2.0 (* x x))) (* x (* x (* c (* s (* c s))))))
(/ (/ 1.0 (* s t_0)) (* x c))))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 1e-16) {
tmp = -1.0 / (t_0 * (c * (x * -s)));
} else if (x <= 3.6e+122) {
tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (s * (c * s)))));
} else {
tmp = (1.0 / (s * t_0)) / (x * c);
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 <= 1d-16) then
tmp = (-1.0d0) / (t_0 * (c * (x * -s)))
else if (x <= 3.6d+122) then
tmp = (1.0d0 + ((-2.0d0) * (x * x))) / (x * (x * (c * (s * (c * s)))))
else
tmp = (1.0d0 / (s * t_0)) / (x * c)
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 1e-16) {
tmp = -1.0 / (t_0 * (c * (x * -s)));
} else if (x <= 3.6e+122) {
tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (s * (c * s)))));
} else {
tmp = (1.0 / (s * t_0)) / (x * c);
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (x * s) tmp = 0 if x <= 1e-16: tmp = -1.0 / (t_0 * (c * (x * -s))) elif x <= 3.6e+122: tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (s * (c * s))))) else: tmp = (1.0 / (s * t_0)) / (x * c) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 1e-16) tmp = Float64(-1.0 / Float64(t_0 * Float64(c * Float64(x * Float64(-s))))); elseif (x <= 3.6e+122) tmp = Float64(Float64(1.0 + Float64(-2.0 * Float64(x * x))) / Float64(x * Float64(x * Float64(c * Float64(s * Float64(c * s)))))); else tmp = Float64(Float64(1.0 / Float64(s * t_0)) / Float64(x * c)); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = c * (x * s);
tmp = 0.0;
if (x <= 1e-16)
tmp = -1.0 / (t_0 * (c * (x * -s)));
elseif (x <= 3.6e+122)
tmp = (1.0 + (-2.0 * (x * x))) / (x * (x * (c * (s * (c * s)))));
else
tmp = (1.0 / (s * t_0)) / (x * c);
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1e-16], N[(-1.0 / N[(t$95$0 * N[(c * N[(x * (-s)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.6e+122], N[(N[(1.0 + N[(-2.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(x * N[(c * N[(s * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(s * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x * c), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 10^{-16}:\\
\;\;\;\;\frac{-1}{t_0 \cdot \left(c \cdot \left(x \cdot \left(-s\right)\right)\right)}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+122}:\\
\;\;\;\;\frac{1 + -2 \cdot \left(x \cdot x\right)}{x \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(c \cdot s\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s \cdot t_0}}{x \cdot c}\\
\end{array}
\end{array}
if x < 9.9999999999999998e-17Initial program 64.5%
associate-/r*64.0%
remove-double-neg64.0%
distribute-lft-neg-out64.0%
distribute-lft-neg-out64.0%
distribute-rgt-neg-out64.0%
associate-/l/64.5%
distribute-rgt-neg-out64.5%
distribute-lft-neg-out64.5%
associate-*l*67.3%
distribute-lft-neg-in67.3%
distribute-lft-neg-out67.3%
remove-double-neg67.3%
associate-*r*67.1%
*-commutative67.1%
associate-*r*65.2%
Simplified65.2%
associate-/r*65.2%
swap-sqr85.5%
associate-/r*74.1%
associate-/r*73.7%
associate-/r*74.6%
*-un-lft-identity74.6%
add-sqr-sqrt74.5%
times-frac74.5%
Applied egg-rr97.2%
Taylor expanded in x around 0 85.0%
associate-/r*85.0%
Simplified85.0%
associate-/r*85.0%
frac-2neg85.0%
metadata-eval85.0%
*-commutative85.0%
frac-times85.1%
metadata-eval85.1%
*-commutative85.1%
Applied egg-rr85.1%
if 9.9999999999999998e-17 < x < 3.6000000000000003e122Initial program 71.4%
associate-/r*71.5%
remove-double-neg71.5%
distribute-lft-neg-out71.5%
distribute-lft-neg-out71.5%
distribute-rgt-neg-out71.5%
associate-/l/71.4%
distribute-rgt-neg-out71.4%
distribute-lft-neg-out71.4%
associate-*l*71.6%
distribute-lft-neg-in71.6%
distribute-lft-neg-out71.6%
remove-double-neg71.6%
associate-*r*63.2%
*-commutative63.2%
associate-*r*63.2%
Simplified68.5%
Taylor expanded in x around 0 58.1%
unpow263.0%
Simplified58.1%
Taylor expanded in c around 0 58.1%
unpow245.6%
associate-*r*49.7%
*-commutative49.7%
Simplified63.0%
if 3.6000000000000003e122 < x Initial program 63.8%
associate-/r*62.0%
remove-double-neg62.0%
distribute-lft-neg-out62.0%
distribute-lft-neg-out62.0%
distribute-rgt-neg-out62.0%
associate-/l/63.8%
distribute-rgt-neg-out63.8%
distribute-lft-neg-out63.8%
associate-*l*65.7%
distribute-lft-neg-in65.7%
distribute-lft-neg-out65.7%
remove-double-neg65.7%
associate-*r*63.9%
*-commutative63.9%
associate-*r*61.9%
Simplified64.5%
Taylor expanded in x around 0 51.6%
unpow251.6%
unpow251.6%
unpow251.6%
swap-sqr85.3%
swap-sqr99.5%
unpow299.5%
associate-*r*97.3%
*-commutative97.3%
Simplified97.3%
*-commutative97.3%
*-un-lft-identity97.3%
*-commutative97.3%
associate-*r*99.5%
pow299.5%
frac-times99.5%
associate-*l/99.6%
associate-*r*97.4%
*-commutative97.4%
associate-*r*95.5%
times-frac93.2%
*-commutative93.2%
Applied egg-rr93.2%
associate-*l/93.2%
*-lft-identity93.2%
associate-/l/93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in x around 0 70.8%
Final simplification81.0%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))))
(if (<= x 3.6e+122)
(/ (+ 1.0 (* -2.0 (* x x))) (* t_0 t_0))
(/ (/ 1.0 (* s t_0)) (* x c)))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 3.6e+122) {
tmp = (1.0 + (-2.0 * (x * x))) / (t_0 * t_0);
} else {
tmp = (1.0 / (s * t_0)) / (x * c);
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 <= 3.6d+122) then
tmp = (1.0d0 + ((-2.0d0) * (x * x))) / (t_0 * t_0)
else
tmp = (1.0d0 / (s * t_0)) / (x * c)
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 3.6e+122) {
tmp = (1.0 + (-2.0 * (x * x))) / (t_0 * t_0);
} else {
tmp = (1.0 / (s * t_0)) / (x * c);
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (x * s) tmp = 0 if x <= 3.6e+122: tmp = (1.0 + (-2.0 * (x * x))) / (t_0 * t_0) else: tmp = (1.0 / (s * t_0)) / (x * c) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 3.6e+122) tmp = Float64(Float64(1.0 + Float64(-2.0 * Float64(x * x))) / Float64(t_0 * t_0)); else tmp = Float64(Float64(1.0 / Float64(s * t_0)) / Float64(x * c)); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = c * (x * s);
tmp = 0.0;
if (x <= 3.6e+122)
tmp = (1.0 + (-2.0 * (x * x))) / (t_0 * t_0);
else
tmp = (1.0 / (s * t_0)) / (x * c);
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3.6e+122], N[(N[(1.0 + N[(-2.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(s * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x * c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 3.6 \cdot 10^{+122}:\\
\;\;\;\;\frac{1 + -2 \cdot \left(x \cdot x\right)}{t_0 \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s \cdot t_0}}{x \cdot c}\\
\end{array}
\end{array}
if x < 3.6000000000000003e122Initial program 65.2%
associate-/r*64.8%
*-commutative64.8%
associate-*l*59.5%
unpow259.5%
unpow259.5%
associate-*r*64.6%
associate-/r*66.3%
associate-/l/66.3%
associate-/l/66.3%
*-commutative66.3%
associate-*l*64.8%
unpow264.8%
associate-*l*59.8%
unpow259.8%
unswap-sqr76.2%
*-commutative76.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in x around 0 59.9%
unpow259.9%
Simplified59.9%
unswap-sqr73.3%
unpow273.3%
*-commutative73.3%
associate-*r*73.8%
*-commutative73.8%
Applied egg-rr73.8%
unpow273.8%
Applied egg-rr73.8%
if 3.6000000000000003e122 < x Initial program 63.8%
associate-/r*62.0%
remove-double-neg62.0%
distribute-lft-neg-out62.0%
distribute-lft-neg-out62.0%
distribute-rgt-neg-out62.0%
associate-/l/63.8%
distribute-rgt-neg-out63.8%
distribute-lft-neg-out63.8%
associate-*l*65.7%
distribute-lft-neg-in65.7%
distribute-lft-neg-out65.7%
remove-double-neg65.7%
associate-*r*63.9%
*-commutative63.9%
associate-*r*61.9%
Simplified64.5%
Taylor expanded in x around 0 51.6%
unpow251.6%
unpow251.6%
unpow251.6%
swap-sqr85.3%
swap-sqr99.5%
unpow299.5%
associate-*r*97.3%
*-commutative97.3%
Simplified97.3%
*-commutative97.3%
*-un-lft-identity97.3%
*-commutative97.3%
associate-*r*99.5%
pow299.5%
frac-times99.5%
associate-*l/99.6%
associate-*r*97.4%
*-commutative97.4%
associate-*r*95.5%
times-frac93.2%
*-commutative93.2%
Applied egg-rr93.2%
associate-*l/93.2%
*-lft-identity93.2%
associate-/l/93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in x around 0 70.8%
Final simplification73.3%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ -1.0 (* (* c (* x s)) (* c (* x (- s))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return -1.0 / ((c * (x * s)) * (c * (x * -s)));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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)) * (c * (x * -s)))
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return -1.0 / ((c * (x * s)) * (c * (x * -s)));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return -1.0 / ((c * (x * s)) * (c * (x * -s)))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(-1.0 / Float64(Float64(c * Float64(x * s)) * Float64(c * Float64(x * Float64(-s))))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = -1.0 / ((c * (x * s)) * (c * (x * -s)));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(-1.0 / N[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(c * N[(x * (-s)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{-1}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(c \cdot \left(x \cdot \left(-s\right)\right)\right)}
\end{array}
Initial program 65.0%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/l/65.0%
distribute-rgt-neg-out65.0%
distribute-lft-neg-out65.0%
associate-*l*67.4%
distribute-lft-neg-in67.4%
distribute-lft-neg-out67.4%
remove-double-neg67.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*64.5%
Simplified64.5%
associate-/r*64.5%
swap-sqr85.1%
associate-/r*73.6%
associate-/r*73.3%
associate-/r*73.9%
*-un-lft-identity73.9%
add-sqr-sqrt73.9%
times-frac73.9%
Applied egg-rr97.4%
Taylor expanded in x around 0 79.9%
associate-/r*80.0%
Simplified80.0%
associate-/r*79.9%
frac-2neg79.9%
metadata-eval79.9%
*-commutative79.9%
frac-times80.0%
metadata-eval80.0%
*-commutative80.0%
Applied egg-rr80.0%
Final simplification80.0%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* x (* x (* c (* c (* s s)))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (c * (s * s)))));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (c * (s * s)))));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (x * (x * (c * (c * (s * s)))))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (x * (x * (c * (c * (s * s)))));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. 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}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\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 65.0%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/l/65.0%
distribute-rgt-neg-out65.0%
distribute-lft-neg-out65.0%
associate-*l*67.4%
distribute-lft-neg-in67.4%
distribute-lft-neg-out67.4%
remove-double-neg67.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*64.5%
Simplified70.4%
Taylor expanded in x around 0 63.5%
Final simplification63.5%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* x (* x (* c (* s (* c s)))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (s * (c * s)))));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 * (s * (c * s)))))
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (s * (c * s)))));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / (x * (x * (c * (s * (c * s)))))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(x * Float64(x * Float64(c * Float64(s * Float64(c * s)))))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / (x * (x * (c * (s * (c * s)))));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(1.0 / N[(x * N[(x * N[(c * N[(s * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{x \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(c \cdot s\right)\right)\right)\right)}
\end{array}
Initial program 65.0%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/l/65.0%
distribute-rgt-neg-out65.0%
distribute-lft-neg-out65.0%
associate-*l*67.4%
distribute-lft-neg-in67.4%
distribute-lft-neg-out67.4%
remove-double-neg67.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*64.5%
Simplified70.4%
Taylor expanded in x around 0 63.5%
Taylor expanded in c around 0 63.5%
unpow263.5%
associate-*r*70.8%
*-commutative70.8%
Simplified70.8%
Final simplification70.8%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ (/ 1.0 c) (* (* x s) (* c (* x s)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return (1.0 / c) / ((x * s) * (c * (x * s)));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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) * (c * (x * s)))
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return (1.0 / c) / ((x * s) * (c * (x * s)));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return (1.0 / c) / ((x * s) * (c * (x * s)))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(1.0 / c) / Float64(Float64(x * s) * Float64(c * Float64(x * s)))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (1.0 / c) / ((x * s) * (c * (x * s)));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(N[(1.0 / c), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{1}{c}}{\left(x \cdot s\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)}
\end{array}
Initial program 65.0%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/l/65.0%
distribute-rgt-neg-out65.0%
distribute-lft-neg-out65.0%
associate-*l*67.4%
distribute-lft-neg-in67.4%
distribute-lft-neg-out67.4%
remove-double-neg67.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*64.5%
Simplified64.5%
associate-/r*64.5%
swap-sqr85.1%
associate-/r*73.6%
associate-/r*73.3%
associate-/r*73.9%
*-un-lft-identity73.9%
add-sqr-sqrt73.9%
times-frac73.9%
Applied egg-rr97.4%
Taylor expanded in x around 0 79.9%
associate-/r*80.0%
Simplified80.0%
frac-times78.2%
*-un-lft-identity78.2%
*-commutative78.2%
*-commutative78.2%
Applied egg-rr78.2%
Final simplification78.2%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (let* ((t_0 (* c (* x s)))) (/ (/ 1.0 t_0) t_0)))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (x * s);
return (1.0 / t_0) / t_0;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 = c * (x * s)
code = (1.0d0 / t_0) / t_0
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
return (1.0 / t_0) / t_0;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (x * s) return (1.0 / t_0) / t_0
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(x * s)) return Float64(Float64(1.0 / t_0) / t_0) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = c * (x * s);
tmp = (1.0 / t_0) / t_0;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{\frac{1}{t_0}}{t_0}
\end{array}
\end{array}
Initial program 65.0%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/l/65.0%
distribute-rgt-neg-out65.0%
distribute-lft-neg-out65.0%
associate-*l*67.4%
distribute-lft-neg-in67.4%
distribute-lft-neg-out67.4%
remove-double-neg67.4%
associate-*r*66.3%
*-commutative66.3%
associate-*r*64.5%
Simplified64.5%
associate-/r*64.5%
swap-sqr85.1%
associate-/r*73.6%
associate-/r*73.3%
associate-/r*73.9%
*-un-lft-identity73.9%
add-sqr-sqrt73.9%
times-frac73.9%
Applied egg-rr97.4%
associate-*l/97.4%
*-un-lft-identity97.4%
*-commutative97.4%
*-commutative97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 80.0%
Final simplification80.0%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ -2.0 (* (* s s) (* c c))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return -2.0 / ((s * s) * (c * c));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return -2.0 / ((s * s) * (c * c));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return -2.0 / ((s * s) * (c * c))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(-2.0 / Float64(Float64(s * s) * Float64(c * c))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = -2.0 / ((s * s) * (c * c));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(-2.0 / N[(N[(s * s), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{-2}{\left(s \cdot s\right) \cdot \left(c \cdot c\right)}
\end{array}
Initial program 65.0%
associate-/r*64.3%
*-commutative64.3%
associate-*l*58.2%
unpow258.2%
unpow258.2%
associate-*r*63.8%
associate-/r*65.3%
associate-/l/65.2%
associate-/l/65.2%
*-commutative65.2%
associate-*l*63.6%
unpow263.6%
associate-*l*58.1%
unpow258.1%
unswap-sqr73.9%
*-commutative73.9%
*-commutative73.9%
Simplified73.9%
Taylor expanded in x around 0 51.1%
unpow251.1%
Simplified51.1%
Taylor expanded in x around inf 26.9%
unpow226.9%
unpow226.9%
Simplified26.9%
Final simplification26.9%
herbie shell --seed 2023287
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))