#The 67% problem
1 messages · Page 1 of 1 (latest)
it's simply
Percent = (k/max); basically. both k and max are floats
Note that it is against our rules to make threads that auto-archive above 24hrs. So don't do that in future thanks
this thread title. so political
but seriously, if you are adding +1 to a float that's at the end of its significant digit accuracy it will floor
public class FloatExample : MonoBehaviour
{
const float max = 25000000;
[Range(0,max)]
public float k;
[Range(0,100)]
public float percentage;
private void OnValidate()
{
percentage = (k / max) * 100;
}
}
which is why you can represent larger numbers, but the accuracy diminishes
so would what Praetor was talking about solve my issue in this case? making percent, max, and k all doubles instead of floats?
in your case 'k' represents an index, so that should stay as an integer
but won't dividing an integer by a double result in the same issue as dividing an int by an int?
or is that not a problem
It will fix the "67%" problem. I don't know if it will solve your actual issue because I still actually don't understand what you're doing
I can't think of any good reason to iterate over every single unit coordinate