Hello all,
I am doing some "big integers" algorithms and I am looking for a way to detect if an operation went from "integer" to "float", and so lost its precision.
I know that I can always check if result is bigger than 1E34 (or something like this).
Any flag or way to detect if a register is an integer or a float number (or "went from" during an operation)?
Thanks,
Sincerely,
Boubker.
Kind of "overflow" in integers
Kind of "overflow" in integers
2xDM15L, DM41L, DM42 SN#00855 (+one lost during shipping), DM41X #00707
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.

 Posts: 894
 Joined: Tue May 02, 2017 5:48 pm
 Location: United States
 Contact:
Re: Kind of "overflow" in integers
The calculator does not keep track of whether numbers are exact or not, so making sure that your results (and all intermediates) are less than 1e34 is the only way to be sure.
Re: Kind of "overflow" in integers
Thanks Thomas for your reply,
is it also the reason we don't have "binary" operations in Free42 (AND OR >> << etc...)?
is it also the reason we don't have "binary" operations in Free42 (AND OR >> << etc...)?
2xDM15L, DM41L, DM42 SN#00855 (+one lost during shipping), DM41X #00707
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.
Re: Kind of "overflow" in integers
The shift operators are not there but AND, OR, XOR and NOT most certainly are. They're in the BASE > LOGIC menu. See p249250 of the manual.
There are only 10 kinds of people in the world: those who understand binary and those who do not.
Re: Kind of "overflow" in integers
Thanks @grsbanks
But I suppose that these functions only work on 36bits integers and not the full 34 digits integers...
Example you can only convert 2^351 in binary, every thing greater gives a <too big> error...
EDIT: in fact all the BASE menu is limited to 36bits operations even in DECM, wierd when 1) you have all the memory/computing power and 2) that free42 went to 34 digits precision...
2xDM15L, DM41L, DM42 SN#00855 (+one lost during shipping), DM41X #00707
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.
Re: Kind of "overflow" in integers
Just FYI, you can use the WP43S for integers up to 64bits with the full function set you may know from the HP16C (DM16) or the WP34S.
DM42 SN: 00041 β
WP 43S running on this device
HP35, HP45, ..., HP35S, WP 34S, WP 31S, DM16L
WP 43S running on this device
HP35, HP45, ..., HP35S, WP 34S, WP 31S, DM16L
Re: Kind of "overflow" in integers
Thanks @Walter, I know and I will try.
2xDM15L, DM41L, DM42 SN#00855 (+one lost during shipping), DM41X #00707
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.
Re: Kind of "overflow" in integers
They work on numbers of whatever word size is in effect (anything up to 64 bits) on Free42 and consequently on the DM42. The original HP42S is indeed limited to 36 bits only.
There are only 10 kinds of people in the world: those who understand binary and those who do not.
Re: Kind of "overflow" in integers
Sorry @grsbank to contradict you on this very end of the year 2020 ...
...but if you do (2^35+1 AND 1)
2
ENTER
35
Y^X
1
+
1
XEQ "AND"
You get an error: "invalid data"...
But it works with 2^34+1 AND 1
En cette fin d'année je vous souhaite mes meilleurs voeux à tous et à vos bienaimés pour la nouvelle année ❤
Last edited by Boub65 on Thu Dec 31, 2020 10:18 pm, edited 1 time in total.
2xDM15L, DM41L, DM42 SN#00855 (+one lost during shipping), DM41X #00707
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.
TI89 titanium, CASIO fxcg50 (to play with micropython)
There are three kinds of people in the world: those who know math and those who don't.
Re: Kind of "overflow" in integers
Did you set the word size to something greater than 36 bits?
There are only 10 kinds of people in the world: those who understand binary and those who do not.