Just in case there is any misunderstanding about Robin2's post...
GoForSmoke:
Analog read returns an int 0 to 1023.
Yup.
Dividing buffer by 1024.0 is one error.
Nope.
Divide by 1023.0 to get the proper range.
Nope.
1024 while "intuitive" is wrong.
Nope.
Don't feel so bad...
Yup.
...I did that too.
You need to keep doing it.
Have any doubts? Check the datasheet.
The value returned from analogRead is divided by 1024. And, yes, that means it is impossible to reach the reference voltage. That's the way successive approximation converters work.