1) The value in memory is double precision, but is being printed as float.

^^^ I think that's it...

"This would be strange. printf has been part of C for decades and the format string is standard."

That was the reason why i was confused - i did not expect that - apart from my knowledge gaps in floating point arithmetic.

The manual says: "For printing float variables with the %f placeholder, typecast them to (var) or (double) (f.i. printf("Profit: %.2f",(var)TradeProfit);). "

But as you can see in my examples, typecasting to (var) or (double) does not work.

Code
var t1 = 0.1;

file_append("Data/test-write.csv",strf("%i,%.14f,%.14f,%.14f\n",Bar,t1,(var)t1,(double)t1),0);

result: 10,0.10000000149012,0.10000000149012,0.10000000149012

If i printf a (var) I'll expect a (var==double) to be printed, precision depending on the format string like "%.8f"...

Even writing into a csv with double precision is not possible at the moment - or am I wrong?

Maybe jcl can explain it in easy words, what's correct and why it is like it is?

Last edited by laz; 09/05/19 22:39.