| 10:52 pm on Feb 26, 2010 (gmt 0)|
float shuold work.. have you tried DOUBLE?
| 11:03 pm on Feb 26, 2010 (gmt 0)|
Neither double nor float worked and both reset the number to -12.
| 11:10 pm on Feb 26, 2010 (gmt 0)|
obviously you tried setting it as DOUBLE(4,2)
which is what i use to store small currency amounts with 2 decimal places, works for me although i don't have negatives
| 11:22 pm on Feb 26, 2010 (gmt 0)|
hmm... If you specify that it is UNSIGNED that it will disallow negatives according to MySQL's docs. I wonder if that is your issue.
You can also try DECIMAL.
Make sure when you define the data type you passing 2 values.
If M and D are omitted, values are stored to the limits allowed by the hardware, M is the total number of digits and D is the number of digits following the decimal point. It could be your hardware limit is low if you didn't specify these values.
| 11:31 pm on Feb 26, 2010 (gmt 0)|
@topr8 Not obvious if it's my first time working with non-whole numbers.
Apparently floats are intended for smaller numbers and doubles for larger numbers according to a site that comes up for the search, 'MySQL data types'.
Turns out after testing the length of a value that what I wanted was float(4,2) which I'm using to store time zone unless any one has a better suggestion for that?
Thanks for your replies! :)
| 11:37 pm on Feb 26, 2010 (gmt 0)|
That is what I would use... glad you got it working, just make sure the values won't go higher than 9999.99 as anything higher or lower won't fit.
| 11:49 pm on Feb 26, 2010 (gmt 0)|
Well unless the world's rotation drastically slows in our lifetime I think this will work just fine. :)