Lesson 3a: Better Temperature Conversion Words
We can write better temperature conversion words than we did at the end of the last lesson. If you thought that the words using /MOD were contrived to introduce /MOD , you were mostly on target. To obviate the necessity of using /MOD , all we need to do is to manage the dividend before division by adding half of the divisor. As before, we must adjust the sign of the rounding term to match the sign of the dividend and adjust the conversion formula such that the rounding term is an integer.
For TC>TF , the rounding formula is
and, for an integer rounding term, we have
Now, we can write the new definition for TC>TF :
Similarly, for TF>TC :
and, the new definition for TF>TC :
It would be a good exercise for you to walk through the execution and track the stack contents for each of the above words, much as we did in Lesson 3.
As always, I need your feedback to make this tutorial more useful.
- 3
1 Comment
Recommended Comments