I have this piece of code:
if self.mp ~= var then
print(type(self.mp).."::"..type(var))
self.mp = lerp(FrameTime() * 3, self.mp, var)
mpnl:Show()
end
This constantly gives me this output: number::number
then I modify it to
if self.mp ~= var then
print(self.mp.."::"..var)
self.mp = lerp(FrameTime() * 3, self.mp, var)
mpnl:Show()
end
which gives me long interpolated output of
26.080000000002::26.08
26.080000000002::26.08
26.080000000002::26.08
26.080000000002::26.08
26.080000000002::26.08
26.080000000002::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.080000000001::26.08
26.08::26.08
26.08::26.08
The question is: how in the world is that possible that self.mp and var are both equal to 26.08 but this code is still running? Who is retarded here? Me or GLua? How to fix? I'm pretty mad now.
This stuff is running inside PANEL:Think() function and self.mp stands here for multiplier of draw.RoundedBox's width inside PANEL:Paint() function.
You're using floating point numbers, while they may seem the same, they're probably not.
Okay... Is there a cheap way to make them being same, not only look?
if (math.abs(self.mp - var) < .01) then self.mp = var end
Sorry, you need to Log In to post a reply to this thread.