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

Many digit floating point numbers break scpi_parse_numeric() #8

Open
palmerr23 opened this issue Jan 1, 2022 · 2 comments
Open

Many digit floating point numbers break scpi_parse_numeric() #8

palmerr23 opened this issue Jan 1, 2022 · 2 comments

Comments

@palmerr23
Copy link

When passed numeric arguments with more than ten significant digits, exponent_multiplier overflows. The mantissa is then multiplied by 1073441896 instead of the correct multiplier.

Changing exponent_multiplier from long to float fixes the issue, with only a trivial loss of precision.

@LachlanGunn
Copy link
Owner

Thanks for this. I'm a bit wary of switching to float, but then again I guess it is uncommon to need more than ten digits of precision. I'm a bit snowed under at the moment, but will have a look when I can to see if there is another solution that doesn't require floating-point, otherwise switch exponent_multiplier to float as you suggest.

@palmerr23
Copy link
Author

Thanks for the respoinse.

I didn't choose 10 digits! I was using TestController to generate automated test values and it produced the 10 digit numbers. I found a function in TC to trim the number of digits, so all is well.

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

No branches or pull requests

2 participants