Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46733 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55123 invoked from network); 14 Jan 2010 18:33:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2010 18:33:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=danielc@analysisandsolutions.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=danielc@analysisandsolutions.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain analysisandsolutions.com from 166.84.1.72 cause and error) X-PHP-List-Original-Sender: danielc@analysisandsolutions.com X-Host-Fingerprint: 166.84.1.72 mail1.panix.com Received: from [166.84.1.72] ([166.84.1.72:51539] helo=mail1.panix.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/D9-00773-B536F4B4 for ; Thu, 14 Jan 2010 13:33:00 -0500 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mail1.panix.com (Postfix) with ESMTP id 720401F083; Thu, 14 Jan 2010 13:32:57 -0500 (EST) Received: by panix5.panix.com (Postfix, from userid 14662) id 62D342423E; Thu, 14 Jan 2010 13:32:57 -0500 (EST) Date: Thu, 14 Jan 2010 13:32:57 -0500 To: Ralph Schindler Cc: internals Message-ID: <20100114183257.GA28492@panix.com> References: <4B4E658C.7080908@smashlabs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B4E658C.7080908@smashlabs.com> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [PHP-DEV] Int to float precision loss in 64bit environment From: danielc@analysisandsolutions.com (Daniel Convissor) Hi Ralph: On Wed, Jan 13, 2010 at 06:30:04PM -0600, Ralph Schindler wrote: > In talking with Stas, it seems that since PHP_INT_MAX+1 is pushed into a > (float) and since float values are stuffed into 52bit mantissa / 11 bits > for exponents, we are loosing some precision. That lost precisions is > causing the above to fail in one platform, and work in another. > > Is this noted somewhere? Is there a workaround? Or, is this something > that can be fixed for 64 bit platforms (somehow)? It's not really documented, that I've seen. I'll put this on my todo list. There was a discussion about this in March/April of last year. In short, it's not easily fixable. Christian Seiler's post on 2009-04-07 is very interesting. The MARC archive split the thread in two: http://marc.info/?t=123704116800002&r=1&w=2 http://marc.info/?t=123865732900002&r=1&w=2 I imagine the workarounds are the BC Math and GMP functions. --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409