At 05:49 PM 4/9/02 +0200, Svensson, B.A.T. (HKG) wrote: >The number '2' I now have, was it - to be extreme - it '1,1' (a sealing >function) or was it '2,9' (a floor function) before? You can never really >tell...
If it was by the rule we've settled on below, then if you have 2, then the number you previously had was >=1.5 and < 2.5. :) >Which integer is "nearest" for 1,5? 1 or 2? To round a decimal number is not >as straight forward as it might appear in the first case. 1.5 is the only special case. >In the bitter end this choice is up to the API writers own whim, but in most >case I guess (s)he ignore this case, and I would guess that most rounding >function then perform a floor function in the case of ==5 (????). As far as I know, .5 always gets rounded up, not down. In school we were taught, "Four to the floor, Five to the sky". :) >Because of this I believe it a bit ambiguous to say "normal" since it hardly >can't exist a "normal" way to perform a rounding. Or?? I guess. The dictionary defines normal, though, as "Conforming with, adhering to, or constituting a norm, standard, pattern, level, or type; typical". So if there is a standard, typical, etc. way that rounding is done, then you can certainly make a case that there is a normal kind of rounding. In ALL of my experiences, rounding has been defined as going to the nearest integer, and rounding UP on .5. And, like I said, all programming languages I have encountered perform a standard rounding the same way. That's why we as societies settle on norms -- so we can communicate without having to resort to academic analyses of every term we use. :) There's no need to feel the need to one-up everything I say. :) >Secondly, because of this "phenomena" some programmers might frequently find >them self having to answers question from customer like: > >"Why does we miss $xxxx in this last summary report?". Hehe.. brings to mind the movie "Office Space". -Mike -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php