Deutsch English Français Italiano |
<867cfigqho.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c Subject: Re: C23 thoughts and opinions Date: Sat, 25 May 2024 03:01:07 -0700 Organization: A noiseless patient Spider Lines: 59 Message-ID: <867cfigqho.fsf@linuxsc.com> References: <v2l828$18v7f$1@dont-email.me> <20240523150226.00007e7d@yahoo.com> <86msoghwoc.fsf@linuxsc.com> <20240524120544.00000a7d@yahoo.com> <86y17zgvs4.fsf@linuxsc.com> <20240524184623.00004e7f@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sat, 25 May 2024 12:01:09 +0200 (CEST) Injection-Info: dont-email.me; posting-host="8137c08e2aeaf8da9fb9d9b9c4e0a9a5"; logging-data="2981814"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rUgIQDAkgeTJ3gZwpXeNELJoUHo3rY70=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:5kbuL+njmhfirVOiUpXKz3LPqpc= sha1:8RF5r3cGvHUW5RVI5Tp+PYOXrW4= Bytes: 3478 Michael S <already5chosen@yahoo.com> writes: > On Fri, 24 May 2024 06:54:35 -0700 > Tim Rentsch <tr.17687@z991.linuxsc.com> wrote: > >> Michael S <already5chosen@yahoo.com> writes: >> >>> On Thu, 23 May 2024 17:37:39 -0700 >>> Tim Rentsch <tr.17687@z991.linuxsc.com> wrote: >>> >>>> Michael S <already5chosen@yahoo.com> writes: >>>> >>>>> [...] Just want to say that strfrom* family is long overdue, but >>>>> still appear incomplete. The guiding principle should be that all >>>>> format specifiers available in printf() with sole exception of %s >>>>> should be provided as strfrom* as well. >>>> >>>> What's the motivation for having separate functions? To me this >>>> looks like creeping featuritis. >>> >>> My practical motivation is space-constrained environments, where I >>> possibly want one or two or three formatters. sprintf() gives me >>> all or nothing and all can be too expensive. Many embedded >>> environments have big and small variants of sprintf that can be >>> chosen at link time, but what's in small variant does not >>> necessarily match a set that I want in my specific project. And is >>> not necessarily well documented. >> >> Okay, I see now where you're coming from, although I'm not sure that >> the strfrom*() functions will give you what you want (in terms of >> memory footprint, etc). But I get your motivation. >> >> Question: which of the four formats (%A, %E, %F, %G) are ones you >> expect to use? > > Rarely: any of those, mostly for debugging. > In productioon code: %e is most likely, but %f could happen. If you can get by without %g, I recommend writing your own. The effort needed isn't trivial but it isn't impossibly large either. (If you really need %g that's a whole other kettle of fish... and really old smelly fish at that. :) > But it's not just a floating point. "Small" variants of sprintf() > on 32-bit platforms often unable to handle %lld and %llu. Here again, just write them. Easy as falling off a log. >> Also I'm curious: do all of your target platforms >> use IEEE floating point, or do some use other representations? > > Currently, only IEEE. [...] My comments above are predicated on being able to count on floating point being in IEEE format. Oh, if you want more information about this, please feel free to email me.