Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
7f77ea04
Commit
7f77ea04
authored
Mar 24, 2023
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 sigma函数没有检测数据范围
parent
7df48248
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
MyMath.cs
Project.FLY.Misc/MISC/MyMath.cs
+7
-3
No files found.
Project.FLY.Misc/MISC/MyMath.cs
View file @
7f77ea04
...
@@ -283,6 +283,7 @@ namespace Misc
...
@@ -283,6 +283,7 @@ namespace Misc
/// <returns></returns>
/// <returns></returns>
public
static
double
Sigma
(
IEnumerable
<
double
>
buf
,
int
first
,
int
last
)
public
static
double
Sigma
(
IEnumerable
<
double
>
buf
,
int
first
,
int
last
)
{
{
double
avg
=
Avg
(
buf
,
first
,
last
);
double
avg
=
Avg
(
buf
,
first
,
last
);
if
(
double
.
IsNaN
(
avg
))
if
(
double
.
IsNaN
(
avg
))
return
double
.
NaN
;
return
double
.
NaN
;
...
@@ -291,6 +292,8 @@ namespace Misc
...
@@ -291,6 +292,8 @@ namespace Misc
int
cnt
=
0
;
int
cnt
=
0
;
for
(
int
i
=
first
;
i
<=
last
;
i
++)
for
(
int
i
=
first
;
i
<=
last
;
i
++)
{
if
((
i
>=
0
)
&&
(
i
<
buf
.
Count
()))
{
{
if
(!
double
.
IsNaN
(
buf
.
ElementAt
(
i
)))
if
(!
double
.
IsNaN
(
buf
.
ElementAt
(
i
)))
{
{
...
@@ -298,6 +301,7 @@ namespace Misc
...
@@ -298,6 +301,7 @@ namespace Misc
cnt
++;
cnt
++;
}
}
}
}
}
if
(
cnt
>=
3
)
if
(
cnt
>=
3
)
return
(
Math
.
Sqrt
(
sum
/
(
cnt
-
1
)));
return
(
Math
.
Sqrt
(
sum
/
(
cnt
-
1
)));
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment