Skip to content
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

feat: add more unit tests for float parsing #36

Merged
merged 2 commits into from
Aug 10, 2024
Merged

Conversation

louiscaron
Copy link
Contributor

the float parser change had removed some negative tests.

reintroduced some negative tests, and some more formatting tests.

the float parser change had removed some negative tests.

reintroduced some negative tests, and some more formatting
tests.
@DanielT
Copy link
Owner

DanielT commented Aug 10, 2024

After looking the tests you added, I'm not entirely sure your previous change is correct.

I played around with a floating point converter.
According to this, the hexadecimal value 0x11 is equal to 2.4e-44: all exponent bits are zero so the two bits in the mantissa only make a very small value. The equivalent of 11.0 in hexadecimal notation would be 0x41300000.

Of course it might be the case that the Autosar tool you mentioned in the previous pull request actually only represents the decimal part of a float value as hex, and is not using the in-memory format of an ieee754 number. In that case your change would be correct after all, but it might be good to add a comment explaining this.

@louiscaron
Copy link
Contributor Author

I have added some comments in the code, i hope this is what you are expecting

@DanielT
Copy link
Owner

DanielT commented Aug 10, 2024

Yes, that neatly explains what is going on here

@DanielT DanielT merged commit e7b3a4e into DanielT:main Aug 10, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants