Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3bf9056

Browse files
committed
Cleanup INFINITY code in float.h
The INFINITY macro is always defined per C99 standard, so this shouldmean we can now get rid of the workaround code for when that macro isn'tdefined.Also, delete the (now unneeded) #pragma code which was disabling acompiler warning in MSVC. There was a comment explaining why the #pragmawas placed outside the function body to work around a MSVC compiler bug,but the link explaining that was dead, as reported by jian he.Author: David Rowley <dgrowleyml@gmail.com>Reported-by: jian he <jian.universality@gmail.com>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CACJufxGARYETnNwtCK7QC0zE_7gq-tfN0mME=gT5rTNtC=VSHQ@mail.gmail.com
1 parent64095d1 commit3bf9056

File tree

1 file changed

+7
-42
lines changed

1 file changed

+7
-42
lines changed

‎src/include/utils/float.h‎

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -51,62 +51,27 @@ extern char *float8out_internal(float8 num);
5151
externintfloat4_cmp_internal(float4a,float4b);
5252
externintfloat8_cmp_internal(float8a,float8b);
5353

54-
/*
55-
* Routines to provide reasonably platform-independent handling of
56-
* infinity and NaN
57-
*
58-
* We assume that isinf() and isnan() are available and work per spec.
59-
* (On some platforms, we have to supply our own; see src/port.) However,
60-
* generating an Infinity or NaN in the first place is less well standardized;
61-
* pre-C99 systems tend not to have C99's INFINITY and NaN macros. We
62-
* centralize our workarounds for this here.
63-
*/
64-
65-
/*
66-
* The funny placements of the two #pragmas is necessary because of a
67-
* long lived bug in the Microsoft compilers.
68-
* See http://support.microsoft.com/kb/120968/en-us for details
69-
*/
70-
#ifdef_MSC_VER
71-
#pragma warning(disable:4756)
72-
#endif
7354
staticinlinefloat4
7455
get_float4_infinity(void)
7556
{
76-
#ifdefINFINITY
7757
/* C99 standard way */
7858
return (float4)INFINITY;
79-
#else
80-
#ifdef_MSC_VER
81-
#pragma warning(default:4756)
82-
#endif
83-
84-
/*
85-
* On some platforms, HUGE_VAL is an infinity, elsewhere it's just the
86-
* largest normal float8. We assume forcing an overflow will get us a
87-
* true infinity.
88-
*/
89-
return (float4) (HUGE_VAL*HUGE_VAL);
90-
#endif
9159
}
9260

9361
staticinlinefloat8
9462
get_float8_infinity(void)
9563
{
96-
#ifdefINFINITY
9764
/* C99 standard way */
9865
return (float8)INFINITY;
99-
#else
100-
101-
/*
102-
* On some platforms, HUGE_VAL is an infinity, elsewhere it's just the
103-
* largest normal float8. We assume forcing an overflow will get us a
104-
* true infinity.
105-
*/
106-
return (float8) (HUGE_VAL*HUGE_VAL);
107-
#endif
10866
}
10967

68+
/*
69+
* Routines to provide reasonably platform-independent handling of NaN
70+
*
71+
* We assume that isnan() is available and work per spec. However, generating
72+
* a NaN in the first place is less well standardized; pre-C99 systems tend
73+
* not to have C99's NaN macro. We centralize our workaround for this here.
74+
*/
11075
staticinlinefloat4
11176
get_float4_nan(void)
11277
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp