Codea 2.3 and numbers

I have updated codea to the latest update however this has caused all the numbers in my project to go from 1 to 1.0 is there a reason why?


@JonoGaming00 you will need to be more specific. Do you mean when you print the numbers?

@JonoGaming00, try using math.floor(val)

I have a number, let’s say 1 being drawn using the text command on the screen. It displays as 1.0 and if I use math.floor(BL) (BL being the number) it flickers between 1 and 1.0 very quickly. This didn’t happen before I updated the app.

I also think it’s a little strange that the new integer type is represented as, eg “7.0” rather than just “7”. Eg print(39.9//5) --prints 7.0

I’ve also noticed this, when using text() with integers it will display a .0 after your integer.

Do you have the background set to a color? Sometimes not setting it can cause strange things. If you do, make sure the text() line comes after the background() one. Hope this helps

I think everything is working OK with integers. The reason you’re getting 7.0 in the 39.9//5 example is you’re doing an integer division on a floating point number, giving an integer value as floating point. If you do 39//5 you get 7 because none of the values are floating point.

Hi Dave, how should one best divide a known float by a known integer and get an integer back? floor after the divide? floor before?

(So far, I’ve not much cared whether I had a float or an integer. Maybe I never will care. The formatting change is a bit surprising though.)

@RonJeffries The code below prints an integer value of 7


@dave1707 you were correct in your earlier post

print(39//5)    --prints 7
print(39.9//5) --prints 7.0

@Nathan I have set my background to a color and it is above all the other commands in my project.