Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 26511 invoked from network); 23 Mar 2009 02:35:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Mar 2009 02:35:10 -0000 Received: (qmail 7609 invoked by uid 500); 23 Mar 2009 02:35:08 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 7527 invoked by uid 500); 23 Mar 2009 02:35:08 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 7517 invoked by uid 99); 23 Mar 2009 02:35:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Mar 2009 02:35:08 +0000 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gcdcu-couchdb-user@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Mar 2009 02:34:58 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LlZzn-000779-Jj for user@couchdb.apache.org; Mon, 23 Mar 2009 02:34:35 +0000 Received: from d75-155-96-24.bchsia.telus.net ([75.155.96.24]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 23 Mar 2009 02:34:35 +0000 Received: from lists by d75-155-96-24.bchsia.telus.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 23 Mar 2009 02:34:35 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: user@couchdb.apache.org From: Daniel Friesen Subject: Re: json/couchdb integer min max values Date: Sun, 22 Mar 2009 19:34:24 -0700 Lines: 64 Message-ID: References: <49C6B67A.50403@michevan.id.au> <320C65C6-93C7-44D4-99DF-5F382A18BE3E@apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: d75-155-96-24.bchsia.telus.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 ThunderBrowse/3.2.1.9 Mnenhy/0.7.5.666 In-Reply-To: <320C65C6-93C7-44D4-99DF-5F382A18BE3E@apache.org> Sender: news X-Virus-Checked: Checked by ClamAV on apache.org I mean store your numbers as strings; "5" "500" "50000000000000005" then in your view left0 pad those. (Then you don't have to worry about putting the 0 padding in all documents. ~Daniel Friesen (Dantman, Nadir-Seen-Fire) Adam Kocoloski wrote: > Hi Daniel, I think you won't be able to do the padding inside a > (JavaScript) view because at that point you'll already be working with > a floating point number, right? > > Adam > > On Mar 22, 2009, at 6:23 PM, Daniel Friesen wrote: > >> The easiest way to check should just be to throw a few documents with >> really large numbers in them. >> Also do some views, I think the real issue will be the standard >> floating point number limitation inside of JavaScript. >> >> If you have numbers that are too large, the catch all way to handle >> that would probably be to use a string instead and left 0 pad >> numbers. Though you could probably do that inside of a view itself. >> >> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) >> >> Paul Davis wrote: >>> IIRC, the JSON RFC either doesn't mention limits whatsoever or only >>> mentions that there is no limit. >>> >>> A quick glance at mochijson2.erl which is CouchDB's JSON decoder looks >>> like its using list_to_integer for its conversion routine. The docs at >>> [1] on list_to_integer don't mention limits. I'm not at all certain, >>> but I think that erlang has builtin large number support so it may >>> Just Work ™. But tracking down any caveats on list_to_integer/1 >>> should give you what you need. >>> >>> HTH, >>> Paul Davis >>> >>> [1] http://erlang.org/doc/man/erlang.html >>> >>> On Sun, Mar 22, 2009 at 6:06 PM, Evan McLean >>> wrote: >>> >>>> Is it documented anywhere what the minimum and maximum values for >>>> an int >>>> are in couchdb and/or json? >>>> >>>> Based on a 32 bit integer? >>>> >>>> I had a quick scan through the json RFC and couldn't find anything. >>>> >>>> How would you go about efficiently handling very large numbers, >>>> especially if you wanted to use them in (sorted) keys? >>>> >>>> E. >>>> >>>> >>> >>> >> > >