Re: Why won't THIS work? (2)

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Mon, 10 Mar 1997 15:58:12 -0500 Joseph Martin <jam at EXIS.NET> writes:
>
>I have the sequence real with real[3] = 6.000000.
>When I use printf() to print it as a floating number it
>displays correctly.
>
>printf(1, "%f", real[3]) gives
>6.000000
>
>BUT when I give this command:
>printf(1, "%d", real[3]) I get 5 as the output.
>
>Does anyone know why this occurs and what I can do about it?
>
>|**************************************|
>|          Joseph Martin               |
>|    http://sailfish.exis.net/~jam/    |
>|**************************************|
>
I don't know why it occurs but I do know what you can do
about it. STOP WHINNING !!  I'm kidding.  I hate those kind of
bugs too.

USE:

printf(1, "%1f", real[3])--this will produce 6

It will not give you 6.0 or anything like that
If you want 6.0 or 6.00 then use "%1.1f" or %1.2f"

Enjoy and continue the good questions.
I love to answer trivial questions. :)
--Lucius Lamar Hilley III
--  E-mail at luciuslhilleyiii at juno.com
--  I support transfering of files less than 64K.
--  I can Decode both UU and Base64 format.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu