[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [office-formula] VALUE - what to do with "." and ","?
Hi David, On Thursday, 2007-03-22 16:00:47 -0500, David A. Wheeler wrote: > The VALUE function takes a string and returns a number. If it gets "," or "." in a regular number, what should it do? Locale-dependent. > In short: Do we require "C" locale interpretation of Numbers for VALUE? Is it locale-dependent? Does it try "C" locale first, and then a locale if that fails? > > What do current implementations, including Excel, OOo, Gnumeric, KSpread, etc., do? Gnumeric, Excel and OOo do it locale-dependent with no fallback to C or whatsoever. > Even if you don't like _automatic_ conversion of string to number, I think we all agree that there MUST be a function that does it... and that's VALUE. But I don't think we can leave such an important issue unstated. Since VALUE is completely locale-dependent, its regexp in the semantics section and the comment are wrong. The "leading '$' is ignored" applies only to the en-US locale (and others that have a '$' currency symbol). A leading '$' in a de-DE locale will result in an error. The separators parsed of course are those of the locale. Note that a fully locale-aware implementation may also parse other sign characters than just ASCII +/- I suggest to completely remove that regular expression, it only causes confusion. Or have it as an _example only_ for an en-US locale. Eike -- Automatic string conversions considered dangerous. They are the GOTO statements of spreadsheets. --Robert Weir on the OpenDocument formula subcommittee's list.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]