## Question:

When I stored floating point numbers sometimes I get back a number that is not quite the same as what I stored. Why?

## Answer:

This happens due to the way decimal numbers are represented inside the computer. The fractional part of the number cannnot be stored exactly unless the fraction is an exact power of two, such as one half, one fourth, one eight, etc. If your data has fixed number of places after the decimal point, and you are using a dialect 3 database, you can work around this limitation by using a NUMERIC datatype, in which InterBase stores the decimal as an integer, and keeps track of where the decimal point goes.

For more information on binary storage of decimal numbers see the InterBase Knowledgebase article Accuracy of the NUMERIC and DECIMAL data types .

For more information on the InterBase NUMERIC datatype please see the "InterBase Data Definition Guide", chapter 4, "Specifying Datatypes".

For more information on binary storage of decimal numbers see the InterBase Knowledgebase article Accuracy of the NUMERIC and DECIMAL data types .

For more information on the InterBase NUMERIC datatype please see the "InterBase Data Definition Guide", chapter 4, "Specifying Datatypes".