cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

Problem printing doubles

Anonymous
Not applicable
Hello

I’m printing variables using acapi_writereport..
Today I just couldn’t print doubles. Whenever I print a double (using %d), it just gives me huge random numbers.. not even doubles (without . In the number)
For testint I even tried to set double t=0.1 and then to print it, it was still a huge number.. it used to be fine so all I can guess is to delete cache files/refresh things or something like this..

Thanks..
1 ACCEPTED SOLUTION
3 REPLIES 3

Solution
Akos Somorjai
Graphisoft
Graphisoft
Hi,

%d is for printing integers, please use %g or %f for that. You can even specify the number of decimals (2 in this example): %5.2f

Best, Akos

Anonymous
Not applicable
Thanks.. Is there a document that sums those things up? Maybe a guide on the best way to debug?

Erenford
Booster
Tomer1 wrote:
Thanks.. Is there a document that sums those things up? Maybe a guide on the best way to debug?
just do a web search for "printf format"
https://en.wikipedia.org/wiki/Printf_format_string
http://www.cplusplus.com/reference/cstdio/printf/
Archicad 25 5010 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit
Intel Core i7-4790 CPU @ 3.60GHz

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!