GNU bug report logs - #6020
coreutils-8.x: a simple feature enhancement, and how to do it

Previous Next

Package: coreutils;

Reported by: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>

Date: Sat, 24 Apr 2010 01:31:01 UTC

Severity: normal

Fixed in version 8.6

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> CS.UCLA.EDU>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 6020 <at> debbugs.gnu.org, "Nelson H. F. Beebe" <beebe <at> math.utah.edu>
Subject: bug#6020: coreutils-8.x: a simple feature enhancement, and how to do it
Date: Fri, 30 Apr 2010 11:16:56 -0700
Pádraig Brady <P <at> draigBrady.com> writes:

> +#if HAVE_C99_STRTOLD /* provided by c-strtold module.  */
> +# define STRTOD strtold
> +#else
> +# define STRTOD strtod
> +#endif
> +
>    char *ea;
>    char *eb;
> -  double a = strtod (sa, &ea);
> -  double b = strtod (sb, &eb);
> +  long double a = STRTOD (sa, &ea);
> +  long double b = STRTOD (sb, &eb);

This could cause performance problems on machines that have slow
long-double operations (implemented via traps, say) and that lack
strtold.

How about doing something like this instead?   It tries to move
as much of the mess as possible to the #if part.

  #if HAVE_C99_STRTOLD
  # define long_double long double
  #else
  # define long_double double
  # undef strtold
  # define strtold strtod
  #endif

  ...

  long_double a = strtold (sa, &ea);
  long_double a = strtold (sa, &ea);




This bug report was last modified 15 years and 83 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.