Legitimate Uses of the Antipattern
FLOAT is a good data type when you need real number values with a greater range than INTEGER or NUMERIC data types support. Scientific applications are often the best use of a FLOAT. For example, if you store daily temperature data in a database, the fractional values will vary, and will seldom be a whole degree. It’s okay to store a temperature value with a billionth of a degree, because the common use of those data is to make aggregate calculations, like MIN(), MAX(), or AVG(). You might also search for rows where the temperature is in a range of values, and a query using inequality or BETWEEN will work fine with inexact numerics. But you’re not likely to search for the row where the temperature is exactly ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access