Where the numbers come from is going to be different with each device and app. They all have their own programming on how to do that. I know that Garmin doesn't just accept the raw data the GPS spits out, it does some post processing for better results. An app running on a phone or tablet is using an API to request location from an operating system, at whatever its polling rate, and interpreting the answers however it's programmed to.