#Strange return with simple porcentage calculus
21 messages · Page 1 of 1 (latest)
what is the type of counter and total?
so let's say total is 100 and counter is 99, what would you expect the result of int(99) / int(100) to be given that the result of this operation is itself an int?
a float?
is a float an int?
but I got what you are trying to say me
so how would you solve it?
it becomes an int when I multiply per 100, correct?
var counter float
var total float
it never becomes an int, it's always an int given that you are dividing 2 int
understood
that's one way, what if you had to keep those as int?
could you spell it out? It's easy to get it wrong and I want to make sure you understand
solved
👍
casting the ints in (float32(a) / float32(b))