From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 Date: Mon, 16 Aug 2010 18:30:26 +0200 Message-ID: From: hugo rivera To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: [9fans] print conversions Topicbox-Message-UUID: 48aabffa-ead6-11e9-9d60-3106f5b1d025 Hi, I'm trying to print floating point numbers, but I get one extra digit when I use the g verb. Quoting from print(2), "... and precision is the maximum number of significant digits for g and G conversions."; so I expect print("%.2g\n", 1234.567); to produce 1.2e+03 but I get 1.23e+03 it seems that print(2) uses printf rules for setting the number of decimals, which will produce the number of significant digits plus one. I guess that the man page or the implementation needs to be corrected, but I could be wrong. Saludos -- Hugo