Error with decimal field

Hello guys I’m having a problem here… I’ve a field with table.decimal(“amount”, 10, 7); but when I try to save 1234.1234 for example it saves 999.9999999

when I save 123.1234 it saves right, I can’t use more than 4 numbers before the point =/

I tried with another version of de database and got ER_WARN_DATA_OUT_OF_RANGE: Out of range value for column ‘amount’

What DB and driver are you using?

Try to increase the precision argument from 10 to 19.

The declaration syntax for a DECIMAL column is DECIMAL(M , D ). The ranges of values for the arguments are as follows:

  • M is the maximum number of digits (the precision). It has a range of 1 to 65.
  • D is the number of digits to the right of the decimal point (the scale). It has a range of 0 to 30 and must be no larger than M .

Ref: https://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html

Cheers!