Rounding errors when mimicking Mod() with FP()
|
03-13-2016, 03:56 PM
(This post was last modified: 03-13-2016 04:07 PM by StephanP.)
Post: #1
|
|||
|
|||
Rounding errors when mimicking Mod() with FP()
In an earlier thread, I've learned that modulo calculations are supported in CAS through the %% operator.
Still not quite familiar within the CAS environment, I tried the following in normal mode. I've used the following to generate the subgroup H=<10> of G=Z13* Which gave me the following results: Starting x=2 on the Emulator and x=5 on the HP Prime, the list shows results with rounding errors. This does not occur with the TI-84 or the Casio CG-20. |
|||
03-13-2016, 06:34 PM
Post: #2
|
|||
|
|||
RE: Rounding errors when mimicking Mod() with FP()
Entering 10^X MOD 13 should produce what you'd expect. Also, the MOD operator will produce results beyond 12 where the FP becomes 0.
|
|||
03-14-2016, 07:30 AM
Post: #3
|
|||
|
|||
RE: Rounding errors when mimicking Mod() with FP()
Ah, I've found it in the Catalog.
Thanks |
|||
03-14-2016, 08:14 AM
Post: #4
|
|||
|
|||
RE: Rounding errors when mimicking Mod() with FP()
Hello
Similar rounding errors are inevitable when working with floating point numbers. Various floating point (FP) systems will behave differently depending on their implementation (binary/decimal, number of internal/external digits used for precision). Some system will try to hide the "problems" (which itself causes other issues), other will not. Some will hide it by hiding the real value of numbers (which means that subsequent calculations are technically OK, but yield a 'strange' result), some by modifying the numbers... Fixing a given system for a given case usually breaks it for another case :-) Here, you want to do exact arithmetics. This can be done using binary integers or the CAS. use #10d^R->B(X) MOD #13d for example for F1(X) and you get the result that you want (warning, the function is only defined for integer X.). You can go to the num setup, set step to 1 and got to NUM view to see the data. irem(10^X,13) should also do what you want (this is a CAS function, integer remener). Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. |
|||
03-14-2016, 11:18 AM
Post: #5
|
|||
|
|||
RE: Rounding errors when mimicking Mod() with FP() | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)