Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70923 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39694 invoked from network); 30 Dec 2013 19:36:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Dec 2013 19:36:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.41 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.41 mail-la0-f41.google.com Received: from [209.85.215.41] ([209.85.215.41:60996] helo=mail-la0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5F/E0-33070-F2BC1C25 for ; Mon, 30 Dec 2013 14:36:17 -0500 Received: by mail-la0-f41.google.com with SMTP id c6so618937lan.14 for ; Mon, 30 Dec 2013 11:36:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=8HFFuN8km+b5j6IiOrWkEjqJTH7FgQ2kB1XwNUh8HgQ=; b=UhnNsy235t7L5PGjgLUov8iXDdEMu1oFku4Ki84bL1YPS3bx2WzDXrPcbF9DNzcLQK 1mkvBQ3ICsJgQcynt3NQf30U9Wrr4tgkwTGb0+Uwaq40Zq3ZZUMSV4bH/5aby020XD2x 32ltLUZC4RKogHXxKxV5cPSUe7PtKvvd1eEfz8cVs/xzu7U389r3Aab0rhzOr/sNE190 KCrk9eeCxoWzxPD+L18fKDYau8jOErZ8ffJ4vd1M1aFUKCbjh5DqiWomjytenIVWCD4O OMJilMPg5NorKb0qdyugYQXRCwjiXUsd97euFj3hjjXIyKXZqkG/ag4nUUnQeGFO9ks4 gHzw== X-Received: by 10.112.139.72 with SMTP id qw8mr26830038lbb.16.1388432171443; Mon, 30 Dec 2013 11:36:11 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.6.68 with HTTP; Mon, 30 Dec 2013 11:35:31 -0800 (PST) In-Reply-To: References: Date: Tue, 31 Dec 2013 04:35:31 +0900 X-Google-Sender-Auth: mdEsMvpeW6TEhGBL2R6yQ4NS16k Message-ID: To: Nikita Popov Cc: Tjerk Meesters , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e0112c1ba5fac9c04eec58e51 Subject: Re: [PHP-DEV] Re: GMP and empty() From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e0112c1ba5fac9c04eec58e51 Content-Type: text/plain; charset=UTF-8 Hi Nikita, On Mon, Dec 30, 2013 at 11:19 PM, Nikita Popov wrote: > On Mon, Dec 30, 2013 at 11:36 AM, Yasuo Ohgaki wrote: > >> I would like to have float support rather than this dirty patch. >> We may implement GMP float support. It would be easier with object. >> >> Regards, >> > > Current GMP ext exposes mpz functionality. It can be used for discrete > mathematics, e.g. modular arithmetic in the context of asymmetric crypto. > The mpq and mpf functionality also provided by gmp/mpir are something > completely separate. If you like, you can expose them to PHP as GmpRational > and GmpFloat, but you must keep them separate, otherwise you'll render the > gmp ext useless for the purposes it is currently used for. Before doing > that I would recommend to think about whether you really want bignum > rationals and floats or whether you are looking for decimals (something > traditionally provided by bcmath, but could also be implemented on top of > mpz). > I agree most of your argument. GMP int and GMP float/rational have different purpose and usage. However, users can use them separately even if we add float support in GMP. For example, when arithmetic contains with GMP int or int, then GMP int should use GMP int only. When arithmetic contains GMP float, then GMP int/PHP float may be promoted to GMP float, like PHP int is promoted to GMP int. If users are careful about data types in arithmetic, they can do GMP int math as it is now. For math functions, we may implement GMP float support, but we may down grade GMP float to PHP float. (for the time being) PHP is weakly typed language and promoting/converting value to other types is nature of PHP. Therefore, adding GMP float/rational to current GMP module is natural to me. IMHO. I might misreading your sentence "but you must keep them separate". Does "separate" mean what I wrote here? I have to work on session module with limited amount of time. If anyone is willing to work on GMP float support, I appreciate it. If nobody is willing to do, I may work on this. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e0112c1ba5fac9c04eec58e51--