dc compatibility notes

Adam Roach discovered that some dc's have different semantics for the P command (print as ascii the current stack item in some dc versions). Unfortunately at least one dc will refuse to print characters above 0x63 hex = 99.

Also another reason for not using P is that the GNU dc does something different, and more similar to p, not printing ascii, but numerical value. This was Adam Roach's dc code (does the conversion from hex to ascii text in dc too via P command), this would have saved on the s/\W//g stuff:


$v sv16dio1[lm*]sz\U$k $m $n\Esnsm[d2%Sa2/d0<x+d*La1=zln%0]dsxx+
10lv^%[d100%Sc100/d0<pLcP]dspx

Figure that out if you can! Would have been well cool if not for the dc compatibility problems and the limit of 99 decimal.

Anyway you have been warned, don't use P!


Comments, html bugs to me (Adam Back) at <adam@cypherspace.org>