[Mono-devel-list] Comments for NumberFormatter

Ben Maurer bmaurer at ximian.com
Sat Feb 26 19:44:28 EST 2005


On Sat, 2005-02-26 at 23:13 +0100, Andreas Nahr wrote:
> Hi,
> 
> I checked through the new NumberFormatter Class and found a few points that 
> could perhaps be improved:
> 
> * The internal class Numberstore contains things like that at several 
> places:
> if (v >= 1000000000000000000)
> 					i = 18;
> 				else if (v >= 100000000000000000)
> 					i = 17;
> 				else if (v >= 10000000000000000)
> 					i = 16;
> ...
> I Think it would make sense to revert the order here because a) in real 
> world small numbers are more common than large ones. This code is called 
> from other functions which deliver e.g. an byte, which surely never can get 
> this big.

Or even better, binary search...




More information about the Mono-devel-list mailing list