03tsw
April 1, 2019, 12:56am
1
Hi, I’m trying to display an integer i’ve created called shootval, like so:
while(1)
{
Brain.Screen.printAt( 10, 20, "value: %f" , shootval);
}
However, when I try doing this, it displays
value: 4294967295.4294967295
Could someone tell me the correct format of displaying integers on the screen? Thanks.
Barin
April 1, 2019, 12:59am
2
mvas
April 1, 2019, 1:08am
3
If you want to display decimals but round to the nearest hundredth or tenth then it would be:
Brain.Screen.printAt( 10, 20, “value: %.2f” , shootval);
Brain.Screen.printAt( 10, 20, “value: %.1f” , shootval);
gbr
April 1, 2019, 1:18am
4
Our students have noticed that too. Much of the VCS API Reference has %f in the documentation, like the following link:. VCS API Reference
They have been fixing it switching to %d, instead.
yea, I need to remind them again to fix those code snippets.
any method that returns int32_t
should use %d and not %f. Only methods returning double
should be using %f
2 Likes