Fair notice there is apparently another topic that talks about this: Printf width specifier to maintain precision of floating-point value But the information there is too complicated for me to get. I'm kinda new to this.
The task I have is to print the answer to some calucations. However the answers vary in their precision.
%f - prints only 6 symbols and doesn't give me the exact numbers.
%.10f - or another precision modifier doesn't give me the exact number because for some reason somehow it gives even greater presionion than it should be able to. A result of 12442.2442010256 somehow became 12442.244201025640.
%s - also did not work and I don't quite understand why. It should have printed this 569.668717948718 but it print 569.66871794872. No rounding or spcifying anything here.
Than I tried round() but it got overwritten by format specifiers of printf() so I removed them.
$result = round($result, 16);
printf($result);
This also did not work as most of the results I got were 1 shorter than accurate results due to the rounding I suppect.
Than I had the idea to somehow set it to a high precision like 16, than convert it to string, than trim the zeroes and than print that, but I have no idea how to do that.
And here we are. Advice is greatly appreciated and I'll be very thankful if its in simpler terms than the other topic.