replacing a solution
Erich: you've replaced a working REXX version (Rosetta Code task: Modular exponentiation) with a version that has less functionality (only supports 100 digits). I re-instated the original (as version 1) and added your copy as version 2. Also, the original version had section header comments about the REXX language limitations (as per huge integers), and addressed the limitations of REXX (in regarding the algorithm must work for any integers a, b, m where b≥0 and m>0).
You made a comment that the original version didn't work with 1000**1, but I saw no evidence of that. 1000**1 = 1000, and the last forty digits of that is: 1000 (which is what the REXX program shows).
Also note that almost all of the computer programming examples use 10^40 for m.
It is true that your version is simpler, but that's no reason to delete the original. Plus the original version also had multiple examples, examples that version 2 (as it is coded) wouldn't work correctly because of lack of enough numeric digits. In any case, hopefully I've (re-)added it correctly as I had to do a cut-'n-paste after the undo. -- Gerard Schildberger (talk) 21:11, 24 October 2014 (UTC)
- Hi Gerald, for some reason I seem to have stepped on your toes, which was not the intention. Reading the task and comparing REXX against other language entries, I saw some issues (10^m vs. m; 1000^1 mod 10 returns 1000), unnecessary dependencies (linesize), language ("stick a fork"), and overall length that made REXX look complicated and warrant a complete rewrite as simple and straight as the other language examples are. As the task requests, the _algorithm_ works with arbitrary numbers, so I intentionally left the numeric digits setting to the calling code. I didn't know that you owned the original code - glad you could recover it. As my intention was improvement and not dispute, I'll remove everything I did. ErichSt
- (There's no L in Gerard) ··· not stepped on my toes, but on the programming example. The original example did not use 10 (as in mod 10, but instead 1040, as did almost all of the other programming entries/solutions) for its programming solution --- it had to use 1040 so as to return the last forty digits of the answer as per the task's requirements, so it didn't have a problem with your first issue. However, if it was used, it did return the correct answer of 9, which is the last digit of the answer when the full product (number) was mod'ed with 101. There isn't a dependency on the linesize BIF per se, it was just used to nicely format the output (titles/headers) to fit the width of the current screen (or window, if you prefer). [As an aside, Regina REXX is the only Classic REXX that I have that doesn't support the linesize BIF, but, as you saw, I did include (via a link) a LINESIZE REXX program that mimicked it's function.] The language I used (I think you meant to use the word comment) is just a comment, and indicted that the REXX program was finished normal executing (as to stopping/halting execution because of some error). I can understand your concern about the overall length, but I programmed the original REXX entry to handle any sized numbers, and that ruled out a predefined amount of numeric digits. Indeed, the original version adjusted the precision (numeric digits) on the fly, accomplishing what some other computer programming languages do automatically. Under Rosetta Code, nobody owns the code (as I understand it, but there are a few authors that add their name to the program source, making it harder to add/change the original source without some kind of explanation and/or code-comments), but of what I've observed of what other authors have done is such instances is they just wrote (added) another version(s), especially in the case of creating another example that has less functionality (and less examples). Another thing that contributes to the program's bulk are (by most standards) are copious (mostly program statement) comments. This particular program has fewer comments than what I normally write, and I'll be correcting that shortly. If less functionality is argumentative and/or perjorative, then that's a strong reason to just enter another version instead of wiping the slate clean, including the section header comments that went along with the program entry explaining the REXX language limitations. Every programming example may show some functionality or capability of the language (even at the expense of adding bulk to the example), or use a different interpretation/implementation of the algorithm(s). I'm a firm believer of programming a solution (to automatically adjust the amount of numeric digits) instead of relying on the reader to change the source code to use a larger amount of digits --- especially in this case, where it was specifically stated that any sized integers were to be used. [This, and many other automagical code to handle the screen width (and/or depth) for displays (or windows) and the like.] The inclusion of code to handle adjustable numeric digits did, indeed, add bulk to the original REXX programming example. Whereas it's much simpler to merely include a fixed amount of numeric digits, it goes against the Rosetta Code's task requirements to must work for any integers a, b, m. -- Gerard Schildberger (talk) 20:23, 25 October 2014 (UTC)