(11C) (15C) Very fast binary converter + fast modulo
|
03-16-2018, 01:08 PM
(This post was last modified: 03-16-2018 01:10 PM by Dieter.)
Post: #2
|
|||
|
|||
RE: (11C) Very fast binary converter + fast modulo
(03-14-2018 10:07 PM)michaelzinn Wrote: This program can convert numbers to binary quickly by using a lookup table to convert 4 bits at once. That's a nice idea which results in a significantly faster program. (03-14-2018 10:07 PM)michaelzinn Wrote: Internally, it also uses a fast modulo calculation. The program uses this routine at LBL D for calculating x mod 2. This works well with the implemented method, calculating 2 · frac(x/2), but it's not a good idea for a general modulo function: try 25 mod 7 to get 3,999999997 instead of 4. A better method for a mod b is a – b · int(a/b): Code: LBL D Of course this is slower than the frac method, but it yields better results. If you want to stay with the original method: this can be done without using a data register: Code: LBL D Oh, I just notice this is your first post here. So, welcome to the forum. :-) Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)