[RFC PATCH] Warn about commas in floating point values?

Dirk Hohndel dirk at hohndel.org
Thu Mar 7 12:01:30 PST 2013


Linus Torvalds <torvalds at linux-foundation.org> writes:

> On Thu, Mar 7, 2013 at 11:29 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
>>
>> Take your value, count the total number of dots and commas combined and
>> if it is one than assume that's a dot. If someone writes 3000kg as
>> 3,000kg they get what they deserve...
>
> That's not my primary worry. Some of the crazy stuff we import uses
> pascal, so you have numbers like 3,7e5
>
> So now we need to parse exponents too.
>
> I'd be more inclined to say "let's replace the comma with a decimal
> point instead, and try to re-parse the number, and see if we get
> further. The downside of that is that we're changing the buffer we get
> passed in. Nobody cares, but still, it's kind of ugly. It's simple,
> though. Attached.

I like the idea of that patch - but I don't like the fprintf to alert
the user... as most of our users will never see that.

/D


More information about the subsurface mailing list