Kind of "overflow" in integers

Discussion around the Swiss Micros DM42 calculator.
Boub65
Posts: 124
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Kind of "overflow" in integers

Post 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 👏
2xDM15L, DM41L, DM42 SN#00855 (+one lost during shipping), DM41X #00707
TI-89 titanium, CASIO fx-cg50 (to play with micropython)

There are three kinds of people in the world: those who know math and those who don't.
reavy
Posts: 83
Joined: Tue Feb 06, 2018 9:08 pm
Location: Phoenix, AZ

Re: Kind of "overflow" in integers

Post 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
Boub65
Posts: 124
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Kind of "overflow" in integers

Post 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)...
2xDM15L, DM41L, DM42 SN#00855 (+one lost during shipping), DM41X #00707
TI-89 titanium, CASIO fx-cg50 (to play with micropython)

There are three kinds of people in the world: those who know math and those who don't.
grsbanks
Posts: 1105
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

Re: Kind of "overflow" in integers

Post 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/
There are only 10 kinds of people in the world: those who understand binary and those who do not.
Thomas Okken
Posts: 925
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Kind of "overflow" in integers

Post 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...
User avatar
Over_score
Posts: 121
Joined: Fri May 05, 2017 9:37 pm
Location: France

Re: Kind of "overflow" in integers

Post 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+

:)
DM42 SN00284 running free42 & SN03835 running WP43S, DM15L, HP41CV, HP42S, HP35s, WP34S, HP Prime
Boub65
Posts: 124
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Kind of "overflow" in integers

Post 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 😜
2xDM15L, DM41L, DM42 SN#00855 (+one lost during shipping), DM41X #00707
TI-89 titanium, CASIO fx-cg50 (to play with micropython)

There are three kinds of people in the world: those who know math and those who don't.
Post Reply