Page 1 of 1

floats

Posted: Mon Sep 08, 2003 11:11 am
by m3rajk
i'm adding two feilds to the statistics (stats table): 'past votes total' and 'past vote count'
since votes range from 1 to 10 inclusive in .5 increments, there's a need for a float. this is so that i can reset the votes, because one of the complaints i've heard about other places is that people can only vote once, another one is that one place it's once a day and the downvoters seem terrible there, so i figure once a month resetting the vote table would be a happy medium)

i need to use a float for that, but i don't know how many spaces a float can have. i don't see anything on the site and the book says it can be a number like 1.175494351e+38 but i don't know if they mean 10 spaces total or 48 (38 plus the ten shown)

Posted: Mon Sep 08, 2003 1:43 pm
by JAM
In mysql I think that 1.175494351e+38 = 1.175494351 * 10 ^ 38 so i guess the actual num is 1 (int) + 9 (dec.).

But I'm not 100% so anyone else might want to add their thoughts.

Cant you use floor() or ceil() and round it abit for easier reading (and probably easier working with)? Looks wierd with those range. ;)

Posted: Mon Sep 08, 2003 7:40 pm
by m3rajk
well the number i'll be workign with is only going to have one spot of percision (float(?,1)) the question really is, would 10 be the max, or does the book i have not give me the 38 places but use e+38 for their convience?