Greetings,
I've made a system that calculates percentages;
<<set $RandomValuePreliminary to 0.29>>
<<set $RandomValueActual to $RandomValuePreliminary * 100>>
The problem therein, is that $RandomValueActual is not simply the value "29", but is in fact " 28.999999999999996 ", which does not coincide with what my calculator says, nor do I think it possible in the first place (I know my math is bad, but I don't think it could be so bad as to return this number). I've tried to rectify the problem with this;
<<set $RandomValueActual to Math.trunc($RandomValueActual)>>
But this actually does not round the value up to the nearest whole number, instead it seems to round it down, in this case back down to 28. This does not happen with every number however, only specific numbers including this one, and seemingly other odd numbers like this one. I'm completely stumped as to an explanation here. Anyone else have anything? I have absolutely no idea. I'd appreciate any help anyone can offer on the subject. Thank you.