Page 2 of 2

Re: Kind of "overflow" in integers

Posted: Thu Dec 31, 2020 10:19 pm
by Boub65
grsbanks wrote:
Thu Dec 31, 2020 8:54 pm
Did you set the word size to something greater than 36 bits?
No, I did nothing!
What should I do then?

EDIT: RTFM Boub!
WSIZE? returns 36 and 64 XEQ "WSIZE" works just fine! 👍
2^63-1 AND 1 works 👏

Re: Kind of "overflow" in integers

Posted: Fri Jan 01, 2021 12:04 am
by reavy
I discovered something like this when using the rotate function. The calculator considers only the integer part of the number and coverts that to binary.

viewtopic.php?f=17&t=2705

Re: Kind of "overflow" in integers

Posted: Fri Jan 01, 2021 11:02 am
by Boub65
Thank you all for your replies.

I think that both free42 and DM42 documentation should be updated with some of this, especially mentioning the upper limit of WSIZE (64 bits) because the behavior is different from HP42s (limited to 36bits).

There is no reference to WSIZE, WSIZE? (and Integer operations in general) in both documentations.

Now... question to @ThomasOkken?
I understand why hp42s went to 36bits.... can't free42 and DM42 go up to 128bits? Because 128bits is the nearest integer to 1e34 (in fact 112bits)...

Re: Kind of "overflow" in integers

Posted: Fri Jan 01, 2021 12:12 pm
by grsbanks
Boub65 wrote:
Fri Jan 01, 2021 11:02 am
There is no reference to WSIZE, WSIZE? (and Integer operations in general) in both documentations.
See the section entitled "BASE enhancements" here: https://thomasokken.com/free42/

Re: Kind of "overflow" in integers

Posted: Sat Jan 02, 2021 12:32 am
by Thomas Okken
Boub65 wrote:
Fri Jan 01, 2021 11:02 am
can't free42 and DM42 go up to 128bits? Because 128bits is the nearest integer to 1e34 (in fact 112bits)...
Bumping the maximum WSIZE up to 112 would require a significant amount of work because the current code for binary functions in Free42 makes heavy use of 64-bit integers. Since 128-bit integers are not universally supported yet in C++, the code would have to be implemented using pairs of 64-bit integers. That's no fun and for my own purposes at least, 64 bits tends to be sufficient anyway. And if I needed more, chances are I'd need 128, not 112.

If I ever implement a proper type system in Free42, this might be something to revisit, but that's not something that will happen anytime soon, if ever...

Re: Kind of "overflow" in integers

Posted: Sat Jan 02, 2021 9:31 am
by Over_score
Thomas Okken wrote:
Sat Jan 02, 2021 12:32 am
Bumping the maximum WSIZE up to 112 would require a significant amount of work because the current code for binary functions in Free42 makes heavy use of 64-bit integers. Since 128-bit integers are not universally supported yet in C++, the code would have to be implemented using pairs of 64-bit integers. That's no fun and for my own purposes at least, 64 bits tends to be sufficient anyway. And if I needed more, chances are I'd need 128, not 112.
1+
1+
1+
1+

:)

Re: Kind of "overflow" in integers

Posted: Sat Jan 02, 2021 11:40 am
by Boub65
Thank you @ThomasOkken for taking your time to reply...
Thomas Okken wrote:
Sat Jan 02, 2021 12:32 am
If I ever implement a proper type system in Free42, this might be something to revisit, but that's not something that will happen anytime soon, if ever...
I will wait 😜