Damm algorithm: Difference between revisions

Content deleted Content added
→‎static table: simplified and optimized the code.
m →‎static table: added wording to the REXX section header.
Line 1,210: Line 1,210:
112940 is not ok, check-digit should be 6 (instead of 0)</pre>
112940 is not ok, check-digit should be 6 (instead of 0)</pre>


===static table===
=== static table ===
Using a static table is over four times faster than manufacturing one.
<lang rexx>/*REXX pgm uses H. Michael Damm's algorithm to validate numbers with suffixed check sum.*/
<lang rexx>/*REXX pgm uses H. Michael Damm's algorithm to validate numbers with suffixed check sum.*/
@.0= 0317598642; @.1= 7092154863; @.2= 4206871359; @.3= 1750983426; @.4= 6123045978
@.0= 0317598642; @.1= 7092154863; @.2= 4206871359; @.3= 1750983426; @.4= 6123045978