How to do sensor math the right way