Re: remove the unneeded header file math.h in binaryheap.c

From: zengman <zengman(at)halodbtech(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: remove the unneeded header file math.h in binaryheap.c
Date: 2026-01-15 15:08:28
Message-ID: tencent_14FE674B2DE33D2057AA47A9@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Álvaro Herrera,

I removed the <math.h> include from two files `dt_common.c` and `timestamp.c`, and the code compiles successfully in my environment.
Would you consider adding this to the patch?

```
postgres(at)zxm-VMware-Virtual-Platform:~/code/postgres$ git diff
diff --git a/src/interfaces/ecpg/pgtypeslib/dt_common.c b/src/interfaces/ecpg/pgtypeslib/dt_common.c
index c4119ab7932..0e26ed67cb1 100644
--- a/src/interfaces/ecpg/pgtypeslib/dt_common.c
+++ b/src/interfaces/ecpg/pgtypeslib/dt_common.c
@@ -4,7 +4,6 @@

#include <time.h>
#include <ctype.h>
-#include <math.h>

#include "common/string.h"
#include "dt.h"
diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c
index 7cf433266f4..087725a44e7 100644
--- a/src/interfaces/ecpg/pgtypeslib/timestamp.c
+++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c
@@ -5,7 +5,6 @@

#include <time.h>
#include <limits.h>
-#include <math.h>

#ifdef __FAST_MATH__
#error -ffast-math is known to break this code
```

--
Regards,
Man Zeng
www.openhalo.org

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-01-15 15:16:13 Re: remove the unneeded header file math.h in binaryheap.c
Previous Message Heikki Linnakangas 2026-01-15 15:04:15 Re: Multixid SLRU truncation bugs at wraparound