[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
printf issue with thousands separator
From: |
Martin Michel |
Subject: |
printf issue with thousands separator |
Date: |
Mon, 4 Jul 2022 12:56:31 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
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`.
However, now I see that using it from the APL interpreter leads to
different results than eg. coreutils printf. I was thinking it uses the
same C library function under the hood (GNU glibc?).
So here is the example, first what I got from coreutils (and what I want
to get):
printf "$ %+'.0f $ %+'.0f\n" 1234523.435 -9587294.01
$ +1,234,523 $ -9,587,294
And here is APL's output, ignoring the thousands:
"$ %+'.0f $ %+'.0f\n" 1234523.435 ¯9587294.01 ⎕FIO[22] 1
$ +1234523 $ -9587294
Is there a way to "activate" the thousands separator (%') in APL?
Alternatively, is it possible after all to achieve my desired output
with APL "format by example" or other means (I may have missed something
but having two decorators with negative numbers and without decimal
points seems impossible).
Any help is welcome, thanks for it in advance!
Kind regards,
Martin
- printf issue with thousands separator,
Martin Michel <=
- Re: printf issue with thousands separator, Dr . Jürgen Sauermann, 2022/07/04
- Re: printf issue with thousands separator, Martin Michel, 2022/07/05
- Re: printf issue with thousands separator, Dr . Jürgen Sauermann, 2022/07/05
- Re: printf issue with thousands separator, Martin Michel, 2022/07/05
- Re: printf issue with thousands separator, Christian Robert, 2022/07/05
- Re: printf issue with thousands separator, Dr . Jürgen Sauermann, 2022/07/06
- Re: printf issue with thousands separator, Blake McBride, 2022/07/06
- Re: printf issue with thousands separator, Dr . Jürgen Sauermann, 2022/07/06
- Re: printf issue with thousands separator, Blake McBride, 2022/07/06