Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24772 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10841 invoked by uid 1010); 20 Jul 2006 19:41:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 10825 invoked from network); 20 Jul 2006 19:41:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2006 19:41:02 -0000 X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:55397] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id EC/36-29121-B97DFB44 for ; Thu, 20 Jul 2006 15:21:00 -0400 Received: from baumbart.mbo (dslb-084-063-032-043.pools.arcor-ip.net [84.63.32.43]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id D768C35C206; Thu, 20 Jul 2006 21:20:56 +0200 (CEST) Date: Thu, 20 Jul 2006 21:21:12 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <105846538.20060720212112@marcus-boerger.de> To: Matt W Cc: internals@lists.php.net In-Reply-To: <018101c6abf6$ee273810$0201a8c0@pc1> References: <018101c6abf6$ee273810$0201a8c0@pc1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [v][sf]printf additions (#, E, g, G) From: helly@php.net (Marcus Boerger) Hello Matt, Thursday, July 20, 2006, 2:20:46 PM, you wrote: > Hi, > I've wished there was a *printf() float specifier that wouldn't include > trailing zeros/point, as simply converting to string (echo, %s, etc.) can > result in scientific notation, which I *don't* want (%g in > convert_to_string()). The only other way that would result in what I want > is number_format() with my "no-extra-zeros option" patch. ;-) So I was > originally looking for how to NOT pad %f to the specified precision, then I > thought why not add more of the stuff from C? (And I see it's marked "not > done" in formatted_print.c.) > Can/should I go ahead and add support for the # flag/specifier, g/G, and E > (the missing compliment to e)? Make everything work like C, except # used > with f/F, which would mean "remove trailing 0's/point" -- as C's behavior > with # and f (add point even when precision=0?) can be done in PHP. (I > assume C's is for when precision is specified with * + parameter?) Having more conversion specifiers here won't hurt. If it can be done in a way compatible to other languages especially like C it should be done in that way. If PHP has already closed the way by choosing opposite defaults the opposite should everntually also work. Best regards, Marcus