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
Sincèrement, Sincerely, 73,
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
-
- Posts: 1102
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- 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...)?
Sincèrement, Sincerely, 73,
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
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 p249-250 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^35-1 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...
Sincèrement, Sincerely, 73,
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
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 HP-16C (DM16) or the WP34S.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Re: Kind of "overflow" in integers
Thanks @Walter, I know and I will try.
Sincèrement, Sincerely, 73,
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
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 bien-aimés pour la nouvelle année ❤
Last edited by Boub65 on Thu Dec 31, 2020 10:18 pm, edited 1 time in total.
Sincèrement, Sincerely, 73,
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
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.