I vote for the NumberFormatter. It adds another layer, which can be a pain, but gives you much more flexibility. Plus it decouples the formatting from all of the number classes. VA Smalltalk has something like this.
Brad Selfridge 913-269-2385 > On Nov 14, 2016, at 8:38 AM, Sven Van Caekenberghe <s...@stfx.eu> wrote: > > I am voting against because both methods are very similar while we are trying > to clean. > > Also, if I would have to present a number I would personally always prefer > the .00 for uniformity. > > But I understand what you want. I think a NumberFormatter object would be > better -- what about thousands separators, negative and/or positive sign, > different scientific notations, ... ? > > Anyway, just my opinion. > >> On 14 Nov 2016, at 14:56, Cyril Ferlicot D. <cyril.ferli...@gmail.com> wrote: >> >> Hi! >> >> I have a problem in an application, I need to print some numbers with 2 >> decimals max. The numbers can be an Integer, Float or Fraction. I >> checked and found Number>>#printShowingDecimalPlaces:. This is cool but >> this is not what I want because when I get "10", I want to print "10" >> and not "10.00". >> >> So I created a method Number>>#printShowingMaxDecimalPlaces: to do so. >> At first I made a mistake and I was not the only one. To avoid this kind >> of mistakes I think this method should be in Pharo by default. This is >> really useful when building a GUI. >> >> This method already exists in Squeak. >> >> I want to ask to the list, do you think this method should make it in >> the image? I think this is important but I also know that people do not >> want to have too much things in the kernel. >> >> So, do you think this is important enough or not? >> >> -- >> Cyril Ferlicot >> >> http://www.synectique.eu >> >> 2 rue Jacques Prévert 01, >> 59650 Villeneuve d'ascq France >> > >