From 51e19d21496ec977843f1c10c229c5370cd381b4 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sun, 25 Jan 2015 13:27:20 +0100 Subject: Integer::MAX Integer::MIN --- lib/zipf/misc.rb | 8 ++++++++ 1 file changed, 8 insertions(+) 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 + -- cgit v1.2.3