Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98760 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64020 invoked from network); 10 Apr 2017 16:00:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Apr 2017 16:00:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@beccati.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=php@beccati.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain beccati.com designates 176.9.123.236 as permitted sender) X-PHP-List-Original-Sender: php@beccati.com X-Host-Fingerprint: 176.9.123.236 box.beccati.com Received: from [176.9.123.236] ([176.9.123.236:43443] helo=box.beccati.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/E4-22499-73CABE85 for ; Mon, 10 Apr 2017 12:00:56 -0400 Received: from authenticated-user (box.beccati.com [176.9.123.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by box.beccati.com (Postfix) with ESMTPSA id E21AC20009F; Mon, 10 Apr 2017 18:00:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=beccati.com; s=mail; t=1491840053; bh=86oX5im7nIuSMj48SWWJbSVisZpCLNXdfx8h6PPbg74=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=InL1/wuuNp56jnlo9pcW+QrW45OSkMAdZYUzZT0P6w+TE2S5+yt/CWVpKt+ewZEAH lrAvy6fKc2UHi5AZAFeL0qoZIU8WKUNxT//iKJColgsc4rQCxSAsYYefH1jYLmzZM5 4tc8H0TlTksILvqi4vFp6PtYrpMSWUb6JqcuCox+ou3DfR+4NFyhYWArHSwzqfjyUx 8x4UeUD80exMJhyxHgrBjwcPkLbg4opuuHTzL1Lym1Dx1ijuBQghllNlQ5yKKJlS0h crI1mKJRDkKdAV5glix2m5zUGxVmLHATzh2l+3IF6ilWngXSPPGi+UkOi94VD/cV3y xORIr5nf/hZ4w== To: Adam Baratz References: <5e3e3e9b-f5b9-a19e-c4cb-6af0f5985d94@beccati.com> Cc: "internals@lists.php.net" Message-ID: Date: Mon, 10 Apr 2017 18:00:50 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] PDO Float Type From: php@beccati.com (Matteo Beccati) Hi Adam, On 10/04/2017 17:42, Adam Baratz wrote: > Just so I understand your concern, it's that fixed-precision types are > meaningfully different and there could be clashes with other types of > floats? I agree with you on that, but I'm not sure what the right > solution is. There isn't a C type for fixed-precision floats, or even a > PHP type. How would the flow of data work so nothing's lost/altered > along the way? My general thought would be that if fixed-precision > matters, then you should be storing values as strings, that there'd be a > whole other set of pitfalls opened up with a PDO::PARAM_NUMERIC type. > > I realize this is all downsides, which isn't the most constructive way > to respond. Happy to talk through details if you have specific > suggestions for how this type would work in practice. My concern is that numeric/decimal types should be treated/sent as strings (and eventually dealt with using e.g. bcmath) and not converted to floats, unless one seeks trouble and loves rounding errors, while the new PDO::PARAM_FLOAT const could instead be seen as a good fit to many unexperienced (and some experienced) people. Hence my suggestion of a PDO::PARAM_NUMERIC const that could in fact just be an alias for PDO::PARAM_STR for most of the drivers. The most important thing to me is to discourage the misuse of PDO::PARAM_FLOAT for types that are not actually floating points. Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/