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

Bug in the function SigDig #1429

Open
Wiljea opened this issue Mar 13, 2025 · 2 comments
Open

Bug in the function SigDig #1429

Wiljea opened this issue Mar 13, 2025 · 2 comments
Labels
bug Something isn't working user Reported by an actual user, yay!

Comments

@Wiljea
Copy link

Wiljea commented Mar 13, 2025

I discover the following bug about the function SigDig to compute the number of significant digits for number greater than "0" having trailing "0":
7 SigDig = 1 OK
70 SigDig = 1 OK
700 SigDig = 1 OK
7000 SigDig = 3 NOT OK, should be 1
70000 SigDig = 3 NOT OK, should be 1
700000 SigDig = 3 NOT OK, should still be 1
...

@c3d c3d added bug Something isn't working user Reported by an actual user, yay! labels Mar 13, 2025
@c3d
Copy link
Owner

c3d commented Mar 13, 2025

Good catch, @Wiljea. This issue only happens when an integer to decimal conversion happens. In other words, 7000. SigDig returns 1 as intended.

There is a bug in that integer to decimal conversion, which can be reduced to the following case:

7000 TODECIMAL BYTES
@ Produces #AF02 0428h 6

7000. BYTES
@ Produces #AF01 0428h 5

In the first case, we produce a decimal number where the trailing zeroes are not correctly stripped. The internal representation otherwise remains correct, so the rest of the computations will not be affected, but it throws SigDig off.

@Wiljea
Copy link
Author

Wiljea commented Mar 14, 2025

But it seems that, in some case, SigDig doesn't produce the right result even with a decimal number:
70000. SigDig => 1 OK
70000 →NUM SigDig => 3 NOT OK even if after →NUM, we have 70000. on the stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working user Reported by an actual user, yay!
Projects
None yet
Development

No branches or pull requests

2 participants