coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] printf,seq: improve long double accuracy


From: Pádraig Brady
Subject: Re: [PATCH 1/2] printf,seq: improve long double accuracy
Date: Tue, 29 Jan 2019 23:41:30 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 26/01/19 23:20, Paul Eggert wrote:
> This fixes a thinko in the previous patch.
> * gl/lib/cl-strtod.c (STRTOD): New macro.
> (CL_STRTOD): Use it.
> ---
>  gl/lib/cl-strtod.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/gl/lib/cl-strtod.c b/gl/lib/cl-strtod.c
> index fa77235ba..dd6eef825 100644
> --- a/gl/lib/cl-strtod.c
> +++ b/gl/lib/cl-strtod.c
> @@ -29,10 +29,12 @@
>  #if LONG
>  # define CL_STRTOD cl_strtold
>  # define DOUBLE long double
> +# define STRTOD strtold
>  # define C_STRTOD c_strtold
>  #else
>  # define CL_STRTOD cl_strtod
>  # define DOUBLE double
> +# define STRTOD strtod
>  # define C_STRTOD c_strtod
>  #endif
>  
> @@ -57,7 +59,7 @@ DOUBLE
>  CL_STRTOD (char const *nptr, char **restrict endptr)
>  {
>    char *end;
> -  DOUBLE d = strtod (nptr, &end);
> +  DOUBLE d = STRTOD (nptr, &end);
>    if (*end)
>      {
>        int strtod_errno = errno;

strtold isn't generally available, which we already
handle in sort.c for example.
The attached fixes the build failure on systems like android.
Bruno has a more general fix in gnulib,
that makes strtold more consistent across all platforms,
but we should add that as a separate commit I think.

cheers,
Pádraig

Attachment: coreutils-strtold-fix.patch
Description: Text Data


reply via email to

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