Hi Steve, I entered a decimal number such as 1,287,789 and the answer was: 1 ==> I Obviously, my input was not acceptable, but it took it. Joe Wilkins PS -- I'm planning a math page in "the Book" and was interested in these as examples. "Steven J. Stratford" wrote: > As a standalone, worked fine. When I made it a subroutine in my CGI > framework, the results were erroneous until I dimmed all the variables > (particularly "result") as non-register variables. Don't know why, any idea? > > Both conversions are online at > http://www.internetyx.com/tcgi/cgidemo/tromnumtest.html > > --Steve > > On a date/time in the near or far past, I received an email from Jay Reeve > <jktr@...> that said something like this: > > >> Anybody have a Roman Numeral to Decimal conversion snippet? > >> > >> Enjoy. > >> > >> --Steve > >> > > I threw this together in about 15 min, but I think it works. Please let > > me know if you find a problem with it. > > > > 0"0 > > =J= a y > > " > > > > local fn roman2Decimal(roman$) > > // by Jay A. Reeve > > //Converts roman numerals from I - MMMDCCCLXXXVIII > > //to decimal equivalents > > > > dim result,last,r,temp > > > > roman$ = ucase$(roman$) > > last = 0 > > for r = roman$[0] to 1 step -1 > > select roman$[r] > > case _"I":temp = 1 > > case _"V":temp = 5 > > case _"X":temp = 10 > > case _"L":temp = 50 > > case _"C":temp = 100 > > case _"D":temp = 500 > > case _"M":temp = 1000 > > case else:temp = 0 > > END SELECT > > long if temp => last > > result += temp > > last = temp > > xelse > > result -= temp > > end if > > next > > end fn = result > > > > do > > input roman$ > > print fn roman2Decimal(roman$) > > until roman$ = "" > > > > > > -- > > To unsubscribe, send ANY message to <futurebasic-unsubscribe@...> > > > > --Steve > > _____________________________ > Steven J. Stratford, InterNetyx.com > Visit The CGI Store for Mac/WebStar Servers! > http://www.internetyx.com > Need custom CGI programming for Mac/WebStar? > Email me: sstrat@... > _____________________________ > > -- > To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>