tiny_outcome 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tiny_outcome.rb +2 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3611d8970ea3a209328e2149c518dc2c8ea0e15c8297ec6951d63c0d2c9d2ce1
4
- data.tar.gz: 0bb76d7481157879e2d7a4e0b0d3edfc87bb96af5a85c5c3dc64187e9b53c6af
3
+ metadata.gz: 8f59aa2f60029e67a708ba51b4606394a230ced1f2dbea6c001f01a9012499eb
4
+ data.tar.gz: 3e9158d65ccbc0a0d47646684fbe5379fbfd4b3c55b5b17725dde691ac8e9852
5
5
  SHA512:
6
- metadata.gz: 10d7cea58b4f4bdf02988ff2ab3fcb91ee3f28dea1df19ddaa2e0fff2d3f7090e39dd4f696985926e688ae320128dab7d96708aee3f87c3cb8bff026d075c353
7
- data.tar.gz: 5646f503b6998e99df4d68e21a10f70344d3e9e9f0aa363e9b751d2def1664924a286319c022867fc0019cce5f2f40ee74b0792bf18ef67c156af88681805da8
6
+ metadata.gz: 898c64f22f9c0b4b193f06097ddd6a23e135088b33bb594123a20b2acc4ea8bada2fdfdda0998d25e5818a6cf4a1051f1eeb46a628b1bdafb84e4800d207ff60
7
+ data.tar.gz: 63a96dea1d7cbf4d768a4701048307e6feb61a4cced5fb56a80cba84986be0790931c3d20a3c7cd0f1a4a3be7683240f3fae876d6e91da04ad371dbf74fb41b6
data/lib/tiny_outcome.rb CHANGED
@@ -86,7 +86,8 @@ class TinyOutcome
86
86
  # probabilty = ---------------
87
87
  # total samples
88
88
  def probability
89
- (value.to_s(2).count('1') / samples.to_f).round(2)
89
+ return 0.0 if samples == 0
90
+ value.to_s(2).count('1') / samples.to_f
90
91
  end
91
92
 
92
93
  # true if we've received at least warmup number of samples
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_outcome
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-30 00:00:00.000000000 Z
11
+ date: 2023-08-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: a tiny outcome tracker with almost no features
14
14
  email: jefflunt@gmail.com