float.c.patch

text/plain

Filename: float.c.patch
Type: text/plain
Part: 0
Message: Re: [GENERAL] +/- Inf for float8's

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
backend/utils/adt/float.c 6 3
Index: backend/utils/adt/float.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/float.c,v
retrieving revision 1.68
diff -c -r1.68 float.c
*** backend/utils/adt/float.c	2000/08/07 00:51:14	1.68
--- backend/utils/adt/float.c	2000/08/14 18:33:22
***************
*** 248,253 ****
--- 248,255 ----
  			val = NAN;
  		else if (strcasecmp(num, "Infinity") == 0)
  			val = HUGE_VAL;
+ 		else if (strcasecmp(num, "-Infinity") == 0)
+ 			val = -HUGE_VAL;
  		else
  			elog(ERROR, "Bad float8 input format '%s'", num);
  	}
***************
*** 255,264 ****
  	{
  		if (errno == ERANGE)
  			elog(ERROR, "Input '%s' is out of range for float8", num);
  	}
  
- 	CheckFloat8Val(val);
- 
  	PG_RETURN_FLOAT8(val);
  }
  
--- 257,265 ----
  	{
  		if (errno == ERANGE)
  			elog(ERROR, "Input '%s' is out of range for float8", num);
+ 		CheckFloat8Val(val);
  	}
  
  	PG_RETURN_FLOAT8(val);
  }
  
***************
*** 275,282 ****
  
  	if (isnan(num))
  		PG_RETURN_CSTRING(strcpy(ascii, "NaN"));
! 	if (isinf(num))
  		PG_RETURN_CSTRING(strcpy(ascii, "Infinity"));
  
  	sprintf(ascii, "%.*g", DBL_DIG, num);
  	PG_RETURN_CSTRING(ascii);
--- 276,285 ----
  
  	if (isnan(num))
  		PG_RETURN_CSTRING(strcpy(ascii, "NaN"));
! 	if (isinf(num)>0)
  		PG_RETURN_CSTRING(strcpy(ascii, "Infinity"));
+ 	if (isinf(num)<0)
+ 		PG_RETURN_CSTRING(strcpy(ascii, "-Infinity"));
  
  	sprintf(ascii, "%.*g", DBL_DIG, num);
  	PG_RETURN_CSTRING(ascii);