-
Notifications
You must be signed in to change notification settings - Fork 18
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
math: simplify types conversion #204
Conversation
This PR aims to address some issues presented in Fluent Bit repo: - fluent/fluent-bit#8083 - fluent/fluent-bit#8762 Signed-off-by: Eduardo Silva <[email protected]>
Signed-off-by: Eduardo Silva <[email protected]>
@edsiper I tested this change locally, I am still seeing a similar issue. Is there any reason we are not just casting from uint64_t to a double? We are going to lose precision, but we can just let the compiler handle doing the conversion rather than copying arbitrary memory. It seems to me the issue is that a double is a floating point value and a uint64_t is not. Debug Output:
|
Do u have the original payload that I can use for testing? Ideally we don't want to lose precision since we convert between different formats |
@edsiper |
Are the original values integers or floats/double? |
They are integers. |
So maybe the problem is on another area. Can u provide the code/tool you use for testing? |
Great, we look into that in a couple of hours. So maybe the cast thing can still be handled as it was before |
Yes you are correct @edsiper the issue is not with the encode/decode functions in math.h but actually cmt_decode_opentelemetry.c:455 |
I also checked with the union implementation in cmt_math.h. I can confirm that the issue is with that line as opposed to the original implementation. This PR can be reverted. |
Thanks, I will update the code shortly |
FYI: #205 |
This PR aims to address some issues presented in Fluent Bit repo:
Note that internally we store everything as uint64_t, to deal with floating point numbers we need to avoid losing precision, so this PR consider changes by using memcpy() when storing data.
Other pending thing, we need decide how to handle NaN and Inf values (encoding/decoding)