Jinx wrote: > I would like to cater for any format of i/p the user chooses, so > the only significant character is the "." (or lack thereof, implying > an integer). ie 0022, 022, 22, 22.0, 22.00 must all be interpreted > by the PIC as plain 22. I realise that the more latitude I give the > user, the more comprehensive the interpreter needs to be, but I'm > prepared to go the extra mile for the sake of user-friendliness This is really not hard if you break it into two algorithms, one before the point and one after. Before the point initialize the value to 0. For each digit, multiply the current value by 10, then add the digit. After the point init a scale factor to .1. For each digit, multiply the digit value by the scale factor, add that into the accumulated value, then multiply the scale factor by .1. ****************************************************************** Embed Inc, Littleton Massachusetts, (978) 742-9014. #1 PIC consultant in 2004 program year. http://www.embedinc.com/products -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist