I'm using MySQL's C api to determine the maximum possible value that can be stored in a specific field.

I have the following table:

    f1 double(4,2),
    f2 double

When I get the field information for f1 and f2 using the API, here is what I see:

f1: { [...], length = 4, decimals = 2 }

f2: { [...], length = 22, decimals = 31 }

I understand that the maximum value that f1 can store is 99.99 (total length = 4, so 4-2=2 digits before the decimal and 2 digits after the decimal).

Is it safe to assume that if a column type is DOUBLE, its length is 22 and its decimal is 31, then there is no (m, d) specified? If so, then can we also assume that the maximum value this column can store is 1.7976931348623157E+308 (as per the docs)? Can this value ever change between different machines/operating systems?

1 Answer 1


Do not use (m,n) on FLOAT or DOUBLE. It is virtually useless and leads to double-roundings.

DOUBLE is an IEEE-754 "Double", which includes 53 significant bits and a range that tops out at that number given (over 1.E+308). This is universal to nearly all languages, and machines.

There are virtually no machines / OSs today that deviate from IEEE754 in the representation of numbers. In theory, you could see differences, but I doubt that you will.

The "22" in information_schema.COLUMNS.numeric_precision may come from how many characters it takes to display (but even that does not make sense). I don't know where you got the "31".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.