Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
When you use only integers in a division, you will get integer division. When you use (at least one) double or float, you will get floating point division (and the answer you want to get).
So you can declare one or both of the variables as float/double
cast one or both of the variables to float/double.
Do not just cast the result of the integer division to double: the division was already performed as integer division, so the numbers behind the decimal are already lost.
from: https://stackoverflow.com/questions/1666407/sql-server-division-returns-zero
Not an issue.
Old question, but since there's no answer yet:
That's how arithmetic operations work in most programming languages, and sql. If you have an operation, e.g. "+" on two different types, the runtime tries to match the types, usually by casting the "lower precision" type value to the "higher precision" type. The result is then of the common higher precision type. If you transform (or better cast) one value to a data type with higher precision, the other operand will be casted automatically to match. (e.g. int + int = int, float + int = float, float + double = double) If such a conversion is not possible you get an error.
This comment is hidden because it contains spoiler information about the solution