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

Round the number before converting it to a BigInt for ModBus #1325

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

Abestanis
Copy link
Contributor

@Abestanis Abestanis commented Aug 20, 2024

Hi, thank you for this awesome project, this is an incredible powerful software!

I ran into a problem while trying to use a Divisor with an Int64 ModBus value. Reading the value works fine, but writing was throwing the following error:

RangeError: The number 9999.99998 cannot be converted to a BigInt because it is not an integer

BigInt only accepts integers, so in my opinion the correct behavior should be to round the value to the closest integer when toCast is true, which is only the case for integer types so this won't affect float types. I tested it with these changes and it fixed the problem for me.

There is also some whitespace changes from my editor, let me know if you want me to remove them.

@unocelli unocelli merged commit 3403fe7 into frangoteam:master Aug 28, 2024
@unocelli
Copy link
Member

Good job, Thanks a lot

@Abestanis Abestanis deleted the fix/bigint_with_divisor branch August 28, 2024 18:51
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