In addition, the assumption that the reference voltage is exactly 5.0V is extremely unlikely to be correct.
However, the error in dividing by 1023 instead of the correct value 1024 is probably smaller than assuming that the reference voltage is exactly 5.0V.
Most people don’t understand how a successive approximation ADC (as found in the typical MCU) actually works, and are confused by the fact that when presented with an input equal to the reference voltage, the ADC reports 1023 (for a 10 bit ADC).
What that report actually means is that the input voltage is greater than or equal to (1023/1024)*Vref.
it is 1023… as zero is also included. Let’s use 2^3 as an example which is 8 steps/ values: 0, 1,2,3,4,5,6,7 . If it would count to 8 it would be 9 steps/values which is not correct. Same is true for 2^10.
The same argument goes for using 1024, rather than incorrectly dividing by the maximum value of the count.
The math is really simple and obvious, once you understand how a successive approximation ADC works. Many people don’t.
If an 8 step successive approximation ADC reports “7”, the ONLY correct interpretation of that value is that Vin is equal to or greater than (7/8)*Vref.