Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-06-25 Thread Marc Nieper-Wißkirchen
Hi Bruno, thank you very much. Best regards, Marc Am Do., 25. Juni 2020 um 21:19 Uhr schrieb Bruno Haible : > > > Marc Nieper-Wißkirchen wrote: > > > Please see the attached patch file, my first attempt (and first > > > contribution to Gnulib). > > > > The patch looks all correct. > > > > The o

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-06-25 Thread Bruno Haible
> Marc Nieper-Wißkirchen wrote: > > Please see the attached patch file, my first attempt (and first > > contribution to Gnulib). > > The patch looks all correct. > > The only (tiny) issue is a matter of style: Two of the new module files don't > end in a newline. I've pushed Marc's patch in his

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-23 Thread Marc Nieper-Wißkirchen
Am Sa., 23. Mai 2020 um 16:52 Uhr schrieb Bruno Haible : > > In a future version, I may add a flag to select between %e, %f, and %g. > > Hmm, that route is likely going the path to sprintf: First a flag to > select among %e, %f, %g. Then an optional width. Then a flag to select > whether to fill w

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-23 Thread Paul Eggert
On 5/23/20 5:26 AM, Marc Nieper-Wißkirchen wrote: > I sent such an assignment request to the FSF a few days ago but > haven't heard back from them yet. It may take a few days more. If you don't hear back in a couple of weeks, please let us know. Thanks for writing that, by the way. It's a good im

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-23 Thread Bruno Haible
Hello Marc, > In a future version, I may add a flag to select between %e, %f, and %g. Hmm, that route is likely going the path to sprintf: First a flag to select among %e, %f, %g. Then an optional width. Then a flag to select whether to fill with spaces or with zeroes. If you go that route, it's

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-23 Thread Marc Nieper-Wißkirchen
Hi Bruno, [...] > The only (tiny) issue is a matter of style: Two of the new module files don't > end in a newline. In Gnulib, we try to let every non-empty text file end in a > newline, since "cat FILE" and "sed -e ... FILE" work better this way. I will correct this when I send you the final pa

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-23 Thread Bruno Haible
Hi Marc, Marc Nieper-Wißkirchen wrote: > Please see the attached patch file, my first attempt (and first > contribution to Gnulib). The patch looks all correct. The only (tiny) issue is a matter of style: Two of the new module files don't end in a newline. In Gnulib, we try to let every non-empt

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-20 Thread Marc Nieper-Wißkirchen
Please see the attached patch file, my first attempt (and first contribution to Gnulib). Am Di., 19. Mai 2020 um 17:51 Uhr schrieb Paul Eggert : > > On 5/19/20 8:35 AM, Marc Nieper-Wißkirchen wrote: > >> It is, however, locale-dependent, and there is no "c_dtoastr" > >> version as there is a "c_st

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-20 Thread Marc Nieper-Wißkirchen
Am Mi., 20. Mai 2020 um 00:37 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > for output, the shortest rounded > > representation that still reads back accurately has to be selected. > > ... > > A simple algorithm is given by Aubrey Jaffer in [1]. > > > > [1] http://people.csail.mit

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-19 Thread Bruno Haible
Marc Nieper-Wißkirchen wrote: > for output, the shortest rounded > representation that still reads back accurately has to be selected. > ... > A simple algorithm is given by Aubrey Jaffer in [1]. > > [1] http://people.csail.mit.edu/jaffer/III/EZFPRW There are several other algorithms for this pur

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-19 Thread Tim Rühsen
On 19.05.20 21:10, Marc Nieper-Wißkirchen wrote: > Am Di., 19. Mai 2020 um 19:23 Uhr schrieb Tim Rühsen : > >> "copyright" here means more "Nutzungsrecht" which you can transfer also >> in Germany. You still stay the "Urheber". > > If transferring the "Nutzungsrecht" is enough, everything should

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-19 Thread Marc Nieper-Wißkirchen
Am Di., 19. Mai 2020 um 19:23 Uhr schrieb Tim Rühsen : > "copyright" here means more "Nutzungsrecht" which you can transfer also > in Germany. You still stay the "Urheber". If transferring the "Nutzungsrecht" is enough, everything should be fine. Marc

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-19 Thread Tim Rühsen
On 19.05.20 18:11, Marc Nieper-Wißkirchen wrote: > Am Di., 19. Mai 2020 um 17:51 Uhr schrieb Paul Eggert : >> >> On 5/19/20 8:35 AM, Marc Nieper-Wißkirchen wrote: It is, however, locale-dependent, and there is no "c_dtoastr" version as there is a "c_strtod". (Could we get such a wrapper?)

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-19 Thread Marc Nieper-Wißkirchen
Am Di., 19. Mai 2020 um 17:51 Uhr schrieb Paul Eggert : > > On 5/19/20 8:35 AM, Marc Nieper-Wißkirchen wrote: > >> It is, however, locale-dependent, and there is no "c_dtoastr" > >> version as there is a "c_strtod". (Could we get such a wrapper?) > > Or a version "c_dtoastr" that uses "c_snprintf"

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-19 Thread Paul Eggert
On 5/19/20 8:35 AM, Marc Nieper-Wißkirchen wrote: It is, however, locale-dependent, and there is no "c_dtoastr" version as there is a "c_strtod". (Could we get such a wrapper?) Or a version "c_dtoastr" that uses "c_snprintf" and "c_strtod" internally. Yes, that'd be good to have. Could you wri

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-19 Thread Marc Nieper-Wißkirchen
Am Di., 19. Mai 2020 um 17:10 Uhr schrieb Marc Nieper-Wißkirchen : > I have just discovered the "dtoastr" module, which seems to do what I > want. It is, however, locale-dependent, and there is no "c_dtoastr" > version as there is a "c_strtod". (Could we get such a wrapper?) Or a version "c_dtoas

Re: Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-19 Thread Marc Nieper-Wißkirchen
Am Di., 19. Mai 2020 um 09:44 Uhr schrieb Marc Nieper-Wißkirchen : > Such input and output routines for floats and doubles would also be > very helpful in the C language. Do you think this could become a > Gnulib module? I have just discovered the "dtoastr" module, which seems to do what I want.

Easy Accurate Reading and Writing of Floating-Point Numbers

2020-05-19 Thread Marc Nieper-Wißkirchen
It is often important to be able to read back a written floating-point number accurately so it has to be output with high enough precision. The Scheme standard even demands this for the number->string and string->number procedures. Moreover, for output, the shortest rounded representation that stil