Character conversion string

    d1=strtod(sz,&pEnd);

According to http://www.cplusplus.com/reference/clibrary/cstdlib/strtod/, the first argument is supposed to be a string - a NULL terminated array of characters, not a character. Of course the output is not what you expect when the input is not what it expects. Pay attention to this sort of thing. It'll bite you in the ass again if you don't.