I need the result of a division between an INT and a FLOAT to be a FLOAT, but it turns into a RATIONAL, and I can’t find a way to convert it into a FLOAT.
Could you try this? (Changing the 99’s while Keeping the *1.0 intact)
MyNumber:float=99*1.0/99.0
(post deleted by author)
Variables aren’t unknown since you always have to pre-write what type it is either in the parameters of a function or when declaring it, do you have an example of a function maybe in the code where it doesn’t work?
OOOOH sorry I get it now, you are right, thank you!
The example was really good but I will leave this here in case someone is slow like me, it helped me understand a little better:
X : float = Y * 1.0 / Z
X - Your variable (a float that will receive the expression result)
Y - Your integer number
Z - Your float number
- Make sure to put .0 or .f64 as sufix for floats when declaring them
whats .f64?
It’s a way to declare floats if you don’t want to type the decimal
I found it by mistake trying to declare floats like in other languages (1f, 0.5f etc)