Sample Header Ad - 728x90

Handling MySQL length=22 and decimals=31

0 votes
1 answer
251 views
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: CREATE TABLE test ( 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?
Asked by DemCodeLines (101 rep)
Jun 22, 2019, 06:22 PM
Last activity: May 28, 2025, 08:09 AM