[Flashforth-devel] Free form number
Brought to you by:
oh2aun
From: Herman A. <exp...@vn...> - 2014-03-26 08:52:37
|
Hi Mike and all, I have an old idea, that would be fine to do in FF. In general text frequently used representation of numbers using delimiter characters to separate the groups of digits. 1,048,576 32'768 ff00 fd12 1001 0010 1110 In this form of a long number is well readable, but unusable directly in forth. We need a forth word to remove all non-number character from the string, then convert the result string to a number. Maybe give the human readable format in a string, then posteriorly convert it: s" 1100 1001" >>number Often would be better solution using a word wich collect the real digits from the input stream until a terminal character, then convert it to a number according to the given base or current base. Example form: #{ 1,048,576} \ decimal ${ ff00 fd12} \ hex %{ 1001 0010 1110} \ binary n{ 32'768} \ in current base All above words leave the result on the stack. What do you think about my conception? BR Attila |