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.ferlicot@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
2 rue Jacques Prévert 01, 59650 Villeneuve d'ascq France