Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 38760 invoked from network); 11 Nov 2009 01:03:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Nov 2009 01:03:59 -0000 Received: (qmail 14933 invoked by uid 500); 11 Nov 2009 01:03:58 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 14874 invoked by uid 500); 11 Nov 2009 01:03:58 -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 14864 invoked by uid 99); 11 Nov 2009 01:03:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2009 01:03:58 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of adam.kocoloski@gmail.com designates 74.125.92.25 as permitted sender) Received: from [74.125.92.25] (HELO qw-out-2122.google.com) (74.125.92.25) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2009 01:03:48 +0000 Received: by qw-out-2122.google.com with SMTP id 9so102654qwb.29 for ; Tue, 10 Nov 2009 17:03:28 -0800 (PST) Received: by 10.224.113.96 with SMTP id z32mr452550qap.112.1257901407673; Tue, 10 Nov 2009 17:03:27 -0800 (PST) Received: from ?10.0.1.9? (c-71-232-49-44.hsd1.ma.comcast.net [71.232.49.44]) by mx.google.com with ESMTPS id 23sm903672qyk.11.2009.11.10.17.03.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 10 Nov 2009 17:03:27 -0800 (PST) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Mime-Version: 1.0 (Apple Message framework v1076) Subject: Re: Silent corruption of large numbers From: Adam Kocoloski In-Reply-To: Date: Tue, 10 Nov 2009 20:03:25 -0500 Content-Transfer-Encoding: 7bit Message-Id: <417958F7-9DF4-44D7-963D-9489BED6AE22@apache.org> References: <4AF8797B.6090206@rogerbinns.com> <20091110200536.GA18411@uk.tiscali.com> <4AFA03EB.3070609@rogerbinns.com> <714754FC-3270-4E0A-99F5-CE88709BD2F6@tumbolia.org> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1076) X-Virus-Checked: Checked by ClamAV on apache.org On Nov 10, 2009, at 8:00 PM, Noah Slater wrote: > > On 11 Nov 2009, at 00:52, Adam Kocoloski wrote: >> >> Hi Noah, I think the part you're missing is that JavaScript does >> not actually have integers. All numbers are internally represented >> using double-precision floating point. So in fact a number that >> looks like an integer can be corrupted. Easiest way to see this, >> as Roger pointed out, is to try to enter something like >> >> 9223372036854775807 >> >> as the value for a field in Futon. You can't do it, Futon will >> corrupt it and give you back >> >> 9223372036854776000 > > Isn't it just the case that there is a ceiling for representable > integers, then? Yes, that's correct. The awkward part is that if you exceed that ceiling JS doesn't complain, it just starts rounding. A surprising result for a developer coming from, well, any other language that I know of. Adam