[squeak-dev] Rounding floats

tim Rowledge tim at rowledge.org
Tue Jul 19 17:43:35 UTC 2016

> On 18-07-2016, at 5:26 PM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
> Hi Tim,
> you can't round float that easily, they are not multiple of ⅕.

I know - damn those awkward temperature readings!

> But you can round their printed decimal representation.
> That's fair because this is what you want: print the damn float

Unfortunately that isn’t something I can do in this case. (I think, anyway) since the numeric value will get passed around and possibly displayed somewhere else. Now of course one could argue that the place where it gets displayed should do any formatting but since the displaying morph has no idea about any rounding, limits, scaling etc of the value it might have to display…

> On 19-07-2016, at 7:46 AM, Chris Cunningham <cunningham.cb at gmail.com> wrote:
> or FixedDecimals (if you want to load that package). 
>     239.37 asFixedDecimal: 1 "==> 239.4 "

Hunh. FixedDecimals, eh? Hadn’t heard of that one before. I wonder if it’ll be friendly?

Did we ever do decimal floats? I know a lot of the work on that as a general question was done by an old IBM colleague (Mike Cowlishaw, generally a very nice chap despite that fact that he claims responsibility for IBM dropping Smalltalk in favour of java) but I had the impression it was a pretty tricky thing.

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim

More information about the Squeak-dev mailing list