atof returning a different floating value

" piR = atoi(str); "
" piD = atof(str); "

Ascii to Integer!

Try with atol (ascii to Long)

Had a fit with proper return values and printing floats with atoi & itoa....