Inside a previous project, I observed the cost area had been saved being an int, instead of like a float. This is accomplished by spreading the particular value by 100, it is because ended up being to avoid encountering floating point problems.

Is a sensible practice which i should follow or perhaps is it unnecessary and just helps make the data less transparent?

Interesting question.

I would not really choose float within the mysql atmosphere. A lot of problems previously with precision with this datatype.

In my experience, the option could be between int and decimal(18,4).

I have seen real life good examples integers accustomed to represent floating point values. The internals of JD Edwards datatables all do that. Amounts are usually divided by 10000. While I am sure it's faster and more compact in-table, it simply implies that we are always needing to CAST the ints to some decimal value to so something with them, especially division.

From the programming perspective, I'd always prefer to utilize decimal for cost ( or money in RDBMSs that support it ).

Although it would help you save float-related issues, getting prices saved as integers could trigger an issue in which you finish up charging 100 occasions the cost to some customer. It might also confuse other developers.

I've come across both solution used effectively on medium-size ecommerce websites, but my preference would go to using floats.

I believe [cde] will work for this use.

Floating point errors might cause you problems if you're spreading large amounts. Generally, financial information will not be completed with floating point amounts where possible.