Phenomena and background of the problem
I use python3.9 socket, Windows system, utf-8 to send floating point and integer strings from client to server.
On the client side, I use to_string() method to send floats and integers after strings.
On the server side, I extract floating-point numbers and integers from string parsing, and keep comparing them to see if there are any duplicates. If there are no duplicates, add them to a list.
Why sometimes two floating-point numbers or integers that are equal to the naked eye are not equal using '=='?How can I solve this problem?
Problem related code, please do not paste screenshot
# client def to_string(self): return f"price,{self.__price},type,{self.__type},volume,{self.__volume}"# server if price == value: return Ture