Performing Floating-Point Division in SQLite
When dividing integers in SQLite, the result is returned as an integer. This can be problematic if you want to calculate a real value. To resolve this issue, you can cast one of the numbers to a real number by multiplying it by 1.0.
For example, the following query returns an integer result:
1 2 3 4 |
|
To obtain the real value of the division result, multiply one of the numbers by 1.0:
1 2 3 4 |
|
The above is the detailed content of How to Perform Accurate Floating-Point Division in SQLite?. For more information, please follow other related articles on the PHP Chinese website!