Re: printf issue with thousands separator

2022-07-06 Thread Blake McBride
Hi Jürgen, I see. Perhaps controlling this programmatically, as I believe you described, does make more sense. Thanks! Blake On Wed, Jul 6, 2022 at 11:29 AM Dr. Jürgen Sauermann < mail@jürgen-sauermann.de> wrote: > Hi Blake, > > in theory: yes. The problem is that the behaviour of locales ca

Re: printf issue with thousands separator

2022-07-06 Thread Dr . Jürgen Sauermann
Hi Blake, in theory: yes. The problem is that the behaviour of locales can be quite unpredictable and therefore allowing to change it means that the underlying glibc may produce results that are no easy to foresee. The current problem (the thousands' separator) is a good example for this. For mo

Re: printf issue with thousands separator

2022-07-06 Thread Blake McBride
On Wed, Jul 6, 2022 at 7:07 AM Dr. Jürgen Sauermann < mail@jürgen-sauermann.de> wrote: > [...] > The problem is, though, that calling setlocale() > in GNU APL is problematic since I cannot possibly know beforehand > what the locale of the user will be. > Can't this be set in ~/.gnu-apl/preference

Re: printf issue with thousands separator

2022-07-06 Thread Dr . Jürgen Sauermann
Hi Christian, thanks for the info. The problem is, though, that calling setlocale() in GNU APL is problematic since I cannot possibly know beforehand what the locale of the user will be. And I cannot know all peculiarities of all possible locale

Re: printf issue with thousands separator

2022-07-05 Thread Christian Robert
Jürgen, #include #include int main(int argc, char *argv[]) { setlocale (LC_NUMERIC, "en_US.utf8"); printf("%'f\n", 55.66); } print: 555,555.66 my 2 cents... Xtian. On 2022-07-05 12:40, Dr. Jürgen Sauermann wrote: Hi Martin, I believe I understood your problem now. As fa

Re: printf issue with thousands separator

2022-07-05 Thread Martin Michel
Hi Jürgen, > I believe I understood your problem now. As far as ⎕FIO is concerned it > should be fixed > in SVN 1579: Many thanks, it's very impressive how fast you have implemented this change! > There could be a misunderstanding as to how 'Format by example' works (and > that misunderstandi

Re: printf issue with thousands separator

2022-07-05 Thread Dr . Jürgen Sauermann
Hi Martin, I believe I understood your problem now. As far as ⎕FIO is concerned it should be fixed in SVN 1579:   "%'.2f" ⎕FIO.sprintf 1234567.89 1,234,567.89 There could be a misunderstanding as to how 'Format by ex

Re: printf issue with thousands separator

2022-07-05 Thread Martin Michel
Hi Jürgen, thanks for your quick reply. > I will look into adding support for the thousands separator (but not > supporting the > locales nonsense). That is, the thousands separator will always be comma and > not > e.g. full-stop like in some countries and comma in others. That would be great

Re: printf issue with thousands separator

2022-07-04 Thread Dr . Jürgen Sauermann
Hi Martin, actually ⎕FIO emulates printf() rather than calling it. There were a number of nasty effects caused by locales when using printf() and friends and therefore I decided to implement it explicitly. For that reason not all format flags ar

printf issue with thousands separator

2022-07-04 Thread Martin Michel
Hi there, I want to print a table which also includes some financal figures. Here I need to group with a thousands separator. My first attempts using the "Format by example" method failed due to limitations of it. That's why I fell back to the ⎕FIO system interface, trying the same with `printf`.