1. odd printf results
- Posted by John McAdam <john.mcadam at MAIL.TELEPAC.PT>
Mar 08, 2000
-
Last edited Mar 09, 2000
I was just programming along very nicely, writing stuff to a file
to help debug the code and reading it back again when I found
that a line something like this:
printf(filenum,"value %d\n",buffer[x])
produced this line in the file:
value inf
or sometimes:
value nan
I suppose they mean "too big" and "too small" respectively.
Just a little suprise. I expected a number since I had specified
an integer (%d), not a string. Maybe its in the documentation
and I didn't see it. I'll turn off the 'without warning' and run it again.
JOHN
2. Re: odd printf results
- Posted by Brian Broker <bkb at CNW.COM>
Mar 08, 2000
-
Last edited Mar 09, 2000
On Wed, 8 Mar 2000 23:43:16 -0000, John McAdam wrote:
>printf(filenum,"value %d\n",buffer[x])
>
>produced this line in the file:
>
>value inf
>
>or sometimes:
>
>value nan
>
>I suppose they mean "too big" and "too small" respectively.
>Just a little suprise. I expected a number since I had specified
>an integer (%d), not a string. Maybe its in the documentation
>and I didn't see it.
inf = infinity
nan = not a number
Discussion on these values can be found in section 2.2.3 "Arithmetic
Operators"
-- Brian