Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14731 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91775 invoked by uid 1010); 8 Feb 2005 23:27:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 91750 invoked from network); 8 Feb 2005 23:27:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2005 23:27:00 -0000 X-Host-Fingerprint: 83.97.50.139 jan.prima.de FreeBSD 4.6-4.9 Received: from ([83.97.50.139:1808] helo=jan.prima.de) by pb1.pair.com (ecelerity HEAD (r4105:4106)) with SMTP id 4F/92-28885-2CA49024 for ; Tue, 08 Feb 2005 18:26:59 -0500 Received: from BAUMBART (pD95F85D3.dip.t-dialin.net [::ffff:217.95.133.211]) (IDENT: HydraIRC, AUTH: LOGIN tobi) by jan.prima.de with esmtp; Tue, 08 Feb 2005 23:26:54 +0000 Date: Wed, 9 Feb 2005 00:24:46 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <719431098.20050209002446@marcus-boerger.de> To: Ron Korving CC: internals@lists.php.net In-Reply-To: <20050208191532.36752.qmail@lists.php.net> References: <20050208191532.36752.qmail@lists.php.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] 'double' / 'float' revised.. think about it. From: helly@php.net (Marcus Boerger) Hello Ron, it doesn't matter how accurate your floating or whatever you call it is. Financial applications require native support which can be realized using bcmath. Whatever you think besides that - the problem is that any errors accumulate - that's the nature of float. If you would like to know whats IEEE 754 read this http://docs.sun.com/source/806-3568/ncg_goldberg.html best regards marcus Tuesday, February 8, 2005, 8:15:31 PM, you wrote: > Personal recent frustrating float issues made me think of the following... > At the moment apparently the C-type double is used for PHP's float (or > double if you please) storage. I believe it is the philosophy of PHP to make > things easy for its users, and in this perspective I was thinking.. hasn't > the time come to reimplement the PHP float type in a decimal-safe way? Of > course it would be a small performance hit, but not too noticable I think, > especially when utilizing simd instructions which a compiler may or may not > already do. I think, especially with todays powerful systems, performance > (although still a big concern) is no longer the only primary concern. > Shouldn't PHP abandon the speed of the double in C on this one, and > implement a custom implementation of the floating point type which is much > more accurate, even at the cost of a few extra bytes and cycles? > Userfriendlyness over performance. I think it would be one hell of a feature > for PHP to be mathematically correct, a world in which 1.5555 is really > 1.5555 and not something that approaches it, and where (for example) > rounding it would result in expected behaviour. I think PHP would > automagically be more suitable for various (financial for example) > applications which could potentially result in more popularity for PHP as a > whole. > I know there are alternatives for accurate mathematics, but they (naturally) > depend on strings which make them a lot slower than a native solution would > be, and besides that, they are less nice to use compared to +,-,/,*,% > operators. > It's just an idea of course, and I'm curious if there are others who feel > the same way about this. > Ron -- Best regards, Marcus mailto:helly@php.net