Revision
So you think you can count
6. Binary arithmetic is not exact
Round and other functions
Revision 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.

A thing 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

Press Next exercise to continue.

Console

Code editor

Result

TableConsole