Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73773 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5234 invoked from network); 24 Apr 2014 11:12:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2014 11:12:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=park.framework@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=park.framework@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.67 as permitted sender) X-PHP-List-Original-Sender: park.framework@gmail.com X-Host-Fingerprint: 74.125.83.67 mail-ee0-f67.google.com Received: from [74.125.83.67] ([74.125.83.67:55702] helo=mail-ee0-f67.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/A2-13812-281F8535 for ; Thu, 24 Apr 2014 07:12:03 -0400 Received: by mail-ee0-f67.google.com with SMTP id t10so1158936eei.6 for ; Thu, 24 Apr 2014 04:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9IQx6kaCq0ba8cO1f59gKNygNLVGfRKU+xoqCtXezFc=; b=OLaIfsEl9IxZsby35O0NZnW2USLMuNHl2icxEjUDoddi7MfcQGBrFdmqphSN74QWxV 5lalEfJJAq/MMs1CdWIOYqqF/RKV+J/RXZ3HR8FDRdwxDsZWP/OsHAGb/ePbzr8FEAPz KK96yTKtOZPIEaIs1fsalAgEIZ4f6mfrU8r5uG7udp1SgLK0oxp+4M5KI93qr8ZYsVpB 1dQZyJNdKmvR2Ya6seT7M1VC9dAriVTaspRFxakn8OMkVl6ZJkSDlMoIWeBa/cEB9whP Ld7cwJWCKJW7t/o60rmdRlQwfwWGCQsqiC/qAOqux+i17WI0BFt3gH63S39chm5yMhga v0uQ== MIME-Version: 1.0 X-Received: by 10.14.193.201 with SMTP id k49mr1727134een.50.1398337919269; Thu, 24 Apr 2014 04:11:59 -0700 (PDT) Received: by 10.14.107.199 with HTTP; Thu, 24 Apr 2014 04:11:59 -0700 (PDT) In-Reply-To: References: Date: Thu, 24 Apr 2014 14:11:59 +0300 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7b3440d0f43f2204f7c7ea25 Subject: Re: [PHP-DEV] [RFC] Floating Point support in GMP extension From: park.framework@gmail.com (Park Framework) --047d7b3440d0f43f2204f7c7ea25 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Yes, now I understand better the sense in GMPInt, you are right that there should be different classes. We use BCMath, but bulky code BCMath: bcmul(bcadd($a, $b, $scale), 2, $scale) I want to write simple: $a + $b * 2 I'm looking forward to implementing GMPFloat 2014-04-24 11:17 GMT+03:00 Nikita Popov : > On Mon, Apr 21, 2014 at 10:40 PM, Park Framework > wrote: > >> Concept is simple. >> Need, remove GMPInt, leave only GMPFloat. >> For backward compatibility in php.ini set default values >> =E2=80=8B=E2=80=8Bgmp.default_precision =3D 0 >> Anyone who wants to work with float, must specify precision > 0 >> What do you think about this? >> > > This is not possible, because GMP integers and GMP floats are > fundamentally and inherently different types. > > A GMP integer isn't just a GMP float with zero precision. Actually, what = I > think you're missing here is that the GMP floating point type is just tha= t: > A **floating** point type. This means that it is **not** precise. What yo= u > specify as the GMP float precision actually translates to the size of the > mantissa/significand, not the number of places after the comma. > > GMP integers on the other hand are precises. Furthermore a primary > application for GMP integers are computations over cyclic groups, as well > as other number theoretic computations. The operations for these are not = a > available for the floating point type (and frankly, wouldn't really make > sense). > > Maybe you're looking for the BCMath extension? > > Nikita > --047d7b3440d0f43f2204f7c7ea25--