bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: REQUEST - bash floating point math support


From: alex xmb sw ratchev
Subject: Re: REQUEST - bash floating point math support
Date: Fri, 21 Jun 2024 21:59:26 +0200

On Fri, Jun 21, 2024, 9:58 PM Chet Ramey <chet.ramey@case.edu> wrote:

> On 6/17/24 8:04 AM, Zachary Santer wrote:
> > On Mon, Jun 17, 2024 at 3:48 AM Léa Gris <lea.gris@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.
>

sorry my forgetness ... why ?

-- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]