On 18 Dec 2015 at 00:06, Keith Medcalf <kmedcalf at dessus.com> wrote:
>> I was taught "Round [only] before printing.". These days it would be >> something like "Round [only] before your API returns to the calling >> program. > > Those are not the same. Round only before printing (whether to the screen or > to a printer). In other words, rounding is a way to make things palatable for > humans. Therefore, the rounding function should only be used when the next > step is presenting the value to a human. > > If the value is not being directly presented to a human, then you should not > be rounding (yet). > > In other words, you do not apply the rounding when your API returns (for > example, in the sin() function). You apply rounding only when the next > consumer is a human. If there is the slightest possibility that the next > consumer is not a human, you should not be rounding. And the rounded value should *only* be used for that purpose. It should not be kept for future calculations. -- Cheers -- Tim