Doc #77451 [Ver]: %g format for printf & sprintf is misdocumented

From: Date: Tue, 12 Feb 2019 23:15:32 +0000
Subject: Doc #77451 [Ver]: %g format for printf & sprintf is misdocumented
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16407@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77451&edit=1 ID: 77451 Updated by: girgias@php.net Reported by: markamery at btinternet dot com Summary: %g format for printf & sprintf is misdocumented Status: Verified Type: Documentation Problem Package: Strings related PHP Version: Irrelevant -Assigned To: girgias +Assigned To: cmb Block user comment: N Private report: N New Comment: Wrote a patch to improve the sprintf doc: http://edit.php.net/?patchID=3291&project=PHP @cmb I was thinking to maybe move the examples out of the format parameter and then move the format parameter XML into an entity and include this entity in all the other related functions (such as printf or fscanf for example). Oh also I couldn't try it out as I haven't managed to download the Doc Block Rendering system onto my Linux Sub System so not totally sure how this patch looks like. Previous Comments: ------------------------------------------------------------------------ [2019-02-12 16:05:00] cmb@php.net Related To: Bug #77529 ------------------------------------------------------------------------ [2019-01-14 04:44:34] girgias@php.net Thanks for noticing this, you can also submit a patch to fix the documentation by using the online editor located at https://edit.php.net ------------------------------------------------------------------------ [2019-01-12 18:26:51] markamery at btinternet dot com Description: ------------ At http://php.net/manual/en/function.sprintf.php, the %g specifier is documented as follows: shorter of %e and %f. This isn't true. %g often uses scientific notation even though it'd be shorter not to, and what's more, its output may differ from BOTH %e and %f, since it strips trailing zeros and %f and %e don't. See https://stackoverflow.com/q/54162152/1709587 where I explore this point at length. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77451&edit=1

« previous php.doc.bugs (#16407) next »