[Nickle] printf/scanf for rationals?

Keith Packard keithp at keithp.com
Sat Dec 24 01:27:50 PST 2005


On Sat, 2005-12-24 at 00:56 -0800, Barton C Massey wrote:
> There appears to be no current way to printf() a rational so
> that it can be read back in accurately with scanf(). 

You can use %.-g, which will use an arbitrary number of digits after the
decimal, so that scanf can read it back in.

There isn't a scanf format that reads the fractional form.

-keith

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : /pipermail/nickle/attachments/20051224/ad6b3f01/attachment.pgp


More information about the Nickle mailing list