cvsuser     04/08/15 11:08:02

  Modified:    src      string.c
  Log:
  Not all atof()s return -0 from "-0", IRIX 6.5 seemingly being one of them.
  (a patch from the [perl #31046] parrotbug-followup thread)
  
  Revision  Changes    Path
  1.216     +6 -1      parrot/src/string.c
  
  Index: string.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/string.c,v
  retrieving revision 1.215
  retrieving revision 1.216
  diff -u -w -r1.215 -r1.216
  --- string.c  15 Aug 2004 04:39:23 -0000      1.215
  +++ string.c  15 Aug 2004 18:08:02 -0000      1.216
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: string.c,v 1.215 2004/08/15 04:39:23 chromatic Exp $
  +$Id: string.c,v 1.216 2004/08/15 18:08:02 jhi Exp $
   
   =head1 NAME
   
  @@ -2527,9 +2527,14 @@
       if (s) {
           /*
            * XXX C99 atof interpreters 0x prefix
  +         * XXX would strtod() be better for detecting malformed input?
            */
           char *cstr = string_to_cstring(interpreter, const_cast(s));
  +        while (isspace(*cstr)) cstr++;
           f = atof(cstr);
  +        /* Not all atof()s return -0 from "-0" */
  +        if (*cstr == '-' && f == 0.0)
  +            f = -0.0;
           string_cstring_free(cstr);
           return f;
       }
  
  
  

Reply via email to