Sackling
Sackling

Reputation: 1820

Float type adding extra digit in database structure

My database structure for a currency table has one row for the value of the currency

I am trying to set it at 1.2000000 but after I do it changes to 1.20000005

This is causing my some grief with some other parts of my code that checks for decimals.

the structure is set to: float(13,8)

Upvotes: 0

Views: 202

Answers (1)

rafwlaz
rafwlaz

Reputation: 484

Change the type in database from float to decimal if You need to hold the value of currency

Please check better explanation why not to use floats Use Float or Decimal for Accounting Application Dollar Amount?

Upvotes: 3

Related Questions