Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
135 user(s) are online (123 user(s) are browsing Forums)

Members: 0
Guests: 135

more...

Support us!

Headlines

 
  Register To Post  

Float64 printing?
Just can't stay away
Just can't stay away


See User information
How do I correctly print a float64? Is it possible with printf, or do I need to look for some other kind of conversion routine?

Go to top
Re: Float64 printing?
Supreme Council
Supreme Council


See User information
@alfkil

Well %f prints a float, so I would assume %llf for a 64bit version.

In the past I have had problems printing 64bit numbers unless they are "aligned", so make sure the 64bit argument is the first or at least aligned, like so:

printf("number: %lld\n", num );

whereas:

printf("number 1: %ld number 2: %lld\n", longnum, longlongnum );

will print the 64bit number incorrectly.

Simon


Edited by Rigo on 2010/9/29 16:16:20
Comments made in any post are personal opinion, and are in no-way representative of any commercial entity unless specifically stated as such.
----
http://codebench.co.uk
Go to top
Re: Float64 printing?
Just can't stay away
Just can't stay away


See User information
@Rigo

Ok, that was very helpful, thanks!

Go to top
Re: Float64 printing?
Just popping in
Just popping in


See User information
@alfkil

Quote:

alfkil wrote:
How do I correctly print a float64? Is it possible with printf, or do I need to look for some other kind of conversion routine?


'float64' is not a built-in 'C' data type. Can you check what it actually represents? I guess it might just be the old "double" type (double precision IEEE 754 floating point number), which according to the standard is a 64 bit entity.

As such printf("%f",...) should work just fine.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project