Sample Header Ad - 728x90

Can Any MySQL Numeric Types Represent Negative Zero?

3 votes
1 answer
155 views
I have a column of data that I need to save in a database. It looks like a series of signed integers, but then I came across "-0" and I had a facepalm moment. After checking with a colleague, it was confirmed as a valid data point that needs to be saved. The obvious choice is to use a VARCHAR type column instead of SMALLINT or similar. But I'd really like to know if negative zero exists in MySQL? I found only one reference to it in the manual that said when '-1e+52' is saved and selected from a FLOAT column, it is returned as either -inf or -0 depending on the platform.
Asked by Robert Chapin (143 rep)
May 6, 2025, 09:23 PM
Last activity: May 6, 2025, 09:58 PM