probability_to_friendly_string 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3593585eb866ea1da80396ec1d860a33e0c7910f
4
- data.tar.gz: cc800c83ece8650d8845d2b3c4ea52761aca2164
3
+ metadata.gz: 7059a95d77157d0d310e2333bb4cbff4a4094fc7
4
+ data.tar.gz: 9f8e25d6c29c9f21f0803ca9df3980bded8cb6e9
5
5
  SHA512:
6
- metadata.gz: 3908e471317c8b18de71d56bc5219f9e018c1e237efb5002cb21d2b6589b422cca887331d4a1ee353d7f7502a8adeda76dc7871cc57f54c50fb1e7f939fc371d
7
- data.tar.gz: fe35bf7fe7cb03bc58e361c7c515f00426c4849e2eae488e369514ef20f5f59d6d7ffffeff596fee19f94fb39a56bd65aadf4906ec6900a9d88a12fdc894d03b
6
+ metadata.gz: d94985123fab4059d642c6f1ce7060493ddbf49f14bce6981d160e445c332ae90ceb4125be29d54fd169ba5823366f3c6aac85254a69adc694e438f59e197523
7
+ data.tar.gz: 5a455957440123a35aedbbc2784929a67313fca06dd6750ca9898a35956886d182a5c6e2a82f6981985f512e854abc188d90dd97469e02b878aed5e9a347859f
@@ -1,4 +1,5 @@
1
1
  module ProbabilityToFriendlyString
2
+ # Represents probability represented in a friendly manner.
2
3
  class FriendlyProbability
3
4
  include Comparable
4
5
  attr_reader :numerator, :denominator, :friendlyString
@@ -36,6 +37,10 @@ module ProbabilityToFriendlyString
36
37
  @@fractionsData = fractionsData.sort
37
38
  end
38
39
 
40
+ # Creates a FriendlyProbability from a double
41
+ #
42
+ # @param f [Numeric] a probability between 0 and 1
43
+ # @return [FriendlyProbability] a FriendlyProbability that is closest to #f
39
44
  def self.fromProbability(f)
40
45
  if f < 0 or f > 1
41
46
  raise RangeError, "f is less than 0 or greater than 1"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: probability_to_friendly_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Stoll