Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Reviewing SQL and numbers
So you think you can count
6. Binary arithmetic is not exact
Round and other functions
Review and practice

Instruction

Ooops… something went wrong. Why did we get something so odd?

The type of columns weight and height is real, which is a floating point number. The internal representation here is binary arithmetic. It means that not all decimal numbers can be represented exactly. The computations are also not performed exactly - as we can see.

What can be done about it? Nothing :) That's the way binary arithmetic works. If you need exact computations, you have to use a decimal type.

Something to remember: When you deal with money values, you should always use a decimal type. Floating point numbers are for "scientific" computations on various measurements, like weight and height.

Exercise

Click Next exercise to continue.