Rosetta Commatizing numbers
Solomon E via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 1 01:45:23 PDT 2017
On Wednesday, 31 May 2017 at 15:44:51 UTC, Ivan Kazmenko wrote:
....
>
> So, two custom calls, two minor changes, no sweat. Is
> everything right now? Even if not: that was fast, we can do
> another iteration. When we have a short readable solution with
> no special cases, the first few changes are going to be easy.
>
....
>
> Ivan Kazmenko.
I followed that advice, and found and fixed more bugs that were
lurking in the original and in my complications. When the number
begins with a decimal point, that's an edge case none of the
earlier versions were handling right. I added a regression test
for that.
I just posted my latest version at Rosetta, without the
unnecessary complications. I hope you like it better.
http://rosettacode.org/wiki/Commatizing_numbers#D
(The complications weren't totally useless though. Without trying
the complications, I wouldn't have tested enough to make as much
improvement as I have. Overcomplicated features are something to
avoid releasing, except in a repo folder of extras for other
programmers to try fiddling with, and Rosetta code isn't exactly
that.)
More information about the Digitalmars-d-learn
mailing list