Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1039

RangeError in bson_int32? with large numbers

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: bson-3.2.4
    • Component/s: BSON
    • Environment:
      Linux debian-jessie 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux
    • Fully Compatible

      Using `bson_int32?` on an adequately large number crashes with a RangeError.

      ```
      irb(main):001:0> require 'bson'
      => true
      irb(main):002:0> 9237164310713597997.bson_int32?
      RangeError: bignum too big to convert into `long'
      from (irb):2:in `bson_int32?'
      from (irb):2
      from /usr/local/rbenv/versions/2.2.3/bin/irb:11:in `<main>'
      ```

      As a stopgap solution, I'm using Strings to store these numbers instead, but it's highly space-inefficient.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            uppfinnarn uppfinnarn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: