On 6/17/24 8:04 AM, Zachary Santer wrote:
On Mon, Jun 17, 2024 at 3:48 AM Léa Gris <lea.g...@noiraude.net> wrote:Le 17/06/2024 à 09:17, Koichi Murase écrivait :declare -i numvar=${localeFormatted/[!0-9]/.}This would break with negative numbers. I know no other radix separator than comma or dot. If there are other radix to replace, it can be listed in a character class. Lets say there are locales that uses , ; or : declare -i numvar=${localeFormatted/[,;:]/.}Do different locales use different characters in the place of 'e' in "[-]d.ddde±dd" and 'p' in "[-]0xh.hhhhp±d"? (These pulled out of 'man 3p fprintf' - the 'e' and 'a' conversion specifiers.)
No. The only locale-specific portion of a floating-point number is the radix character. https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtod.html#tag_16_587 It's specified for both input and output (printf).
If floating point math support is added to bash, I would expect it to be able to handle floating point literals in these forms as well.
I'm not planning to do this any time soon. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature