-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP "float" serialization loses precision #8165
Comments
I haven't done the math carefully but this sounds like it could be just caused by the fact that the protobuf |
Yes, Adam is correct. The bug here is with pure-PHP, which should truncate this to float precision in the setter. |
@haberman So are we saying this is an issue in the Pure-PHP protobuf library, and the way to fix it is to update float setters to truncate to single precision? |
I added a fix in #8187 that passes for my test suites |
This was fixed in #8187. |
In both the protobuf native PHP library and PHP C-extension, I am seeing a loss of precision with floats:
When the C-Extension is enabled, the loss of precision happens immediately. When the C-extension is not enabled, the loss of precision happens when the message is serialized and deserialized:
The text was updated successfully, but these errors were encountered: