summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-01-25 13:27:20 +0100
committerPatrick Simianer <p@simianer.de>2015-01-25 13:27:20 +0100
commit51e19d21496ec977843f1c10c229c5370cd381b4 (patch)
tree4a133cc6cfa374ad15d81d8fbe33c07982a69974
parent72825c33ced300f3977a8679b2a46d3dda3d1da5 (diff)
Integer::MAX Integer::MIN
-rw-r--r--lib/zipf/misc.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/zipf/misc.rb b/lib/zipf/misc.rb
index 4d29a06..02291c7 100644
--- a/lib/zipf/misc.rb
+++ b/lib/zipf/misc.rb
@@ -111,3 +111,11 @@ def read_config fn
return cfg
end
+# https://gist.github.com/pithyless/9738125
+class Integer
+ N_BYTES = [42].pack('i').size
+ N_BITS = N_BYTES * 16
+ MAX = 2 ** (N_BITS - 2) - 1
+ MIN = -MAX - 1
+end
+