From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] double->string conversion From: rog@vitanuova.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20011029135247.B5F69199E8@mail.cse.psu.edu> Date: Mon, 29 Oct 2001 14:05:49 +0000 Topicbox-Message-UUID: 101b3612-eaca-11e9-9e20-41e7f4b1d025 > doesn't print("%g") do it? nope. for example, double xmin, xmax; [...] print("%g %g; difference: %g\n", xmin, xmax, xmax - xmin); print("hex: %ullx %ullx\n", *(vlong *)&xmin, *(vlong *)&xmax); prints: -.9909985 -.9909985 difference: 4.551914e-15 hex: bfefb6429008c02c bfefb6429008c003 > The %f, %g, strtod functions in both Inferno and 3rd edition Plan 9 > are intended to be accurate. (The version in 2nd edition is known > to be less exact.) what parameters does the %g conversion need to ensure that a later strtod will produce the same value? rog.