[Nickle] Re: What does "0.{511432343" in Nickle?
Keith Packard
keithp at keithp.com
Tue Aug 3 15:00:29 PDT 2004
Around 9 o'clock on Aug 3, Barton C Massey wrote:
> The curly brace is the start of a repeating decimal that's
> too long to print in full. There should be a format
> character you can use to stop that, but I don't know that
> there is.
Formats in nickle are kinda a mess. They follow libc printf (kinda) and some
require specific argument types.
s strings
d or D integers in base 10
b or B integers in base 2
o or O integers in base 8
x or X integers in base 16
e, E, f or F numbers in base 10 with exponent
A few others exist that don't require specific argument types (!):
v any value, print so the lexer could re-read it exactly
g any value, print in a "reasonable" format.
The behaviour of any format letter aside from these is undefined (!).
The top level read/eval/print loop uses the 'format' variable to control
how values are displayed. By default, 'format' is "%g", which (probably
unfortunately) displays rational numbers with the { } brace notation.
Use '%f' if you want to display numbers without the braces.
We could fix 'g' to avoid braces as well; that makes a lot of sense...
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : /pipermail/nickle/attachments/20040803/0d40d02b/attachment.pgp
More information about the Nickle
mailing list