-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves standardDeviation: to correct morph
- Loading branch information
1 parent
709b03b
commit fb5973d
Showing
3 changed files
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/Babylonian-UI.package/BPProfilingValuesMorph.class/instance/standardDeviation..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
helpers | ||
standardDeviation: aCollection | ||
|
||
| avg sample sum | | ||
avg := aCollection average. | ||
sample := aCollection anyOne. | ||
sum := aCollection inject: sample into: [ :accum :each | accum + (each - avg) squared ]. | ||
sum := sum - sample. | ||
^ sum = 0 | ||
ifTrue: [0] | ||
ifFalse: [((sum / (aCollection size - 1)) sqrt) asScaledDecimal roundTo: 0.01] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters