I’m working on a project that involves decimal point numbers (floats). Now my question is, do you think it would be a good idea to just store the floats as strings in varchar fields, and then convert them when I want to perform math on them?
Or should I store them into REAL fields? (which is what I’m doing right now).
I’d really just like some opinions on the subject and maybe some pros and cons.
In the general case, you should store numbers as numbers.
It’s faster, uses less space, avoids rounding errors, and prevents your code from showing up on The Daily WTF.
There might be specific cases where storing numbers as text would make sense due to some very unusual constraints of your project, with without telling us about your project, you’re asking us to invent such constraints.
So, there a no pros.