mattt / SkyLab

Multivariate & A/B Testing for iOS and Mac

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overflow in expression; result is -2147483648 with type 'int'

maxcabral opened this issue · comments

This warning is emanated from SkyLab.m line 67:

double r = (random() % (INT_MAX + 1)) * (total / INT_MAX);

I assume INT_MAX + 1 is supposed to be INT_MIN? Or is the overflow intentional?

Is the overflow intentional?

Nope, I'm just a dummy. This is definitely one of those cases where I revisit a piece of code after a while and think "did I really write this?".

Fixed as of 179279f. Thanks for pointing this out. I'll push out a new release soon.

Haha no worries we all have those days. Thanks!