[Nickle] printf/scanf for rationals?
Bart Massey
bart at po8.org
Sat Dec 24 01:46:43 PST 2005
Unfortunately, the output of printf("%.-g", 1/3) is
0.{3}, which can't be read back in by current scanf() at all
(as near as I can tell). I think it probably *should*...
Bart
In message <1135416471.23187.5.camel at evo.keithp.com> you wrote:
> 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().=20
>
> 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.
More information about the Nickle
mailing list