pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: dqetool@126.com
Subject: BUG #19101: Ceil on BIGINT could lost precision in decil function
Date: Sun, 02 Nov 2025 15:16:09 +0000
Message-ID: <19101-8f44b0e27aa65d40@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      19101
Logged by:          Jason Smith
Email address:      dqetool@126.com
PostgreSQL version: 18.0
Operating system:   Ubuntu 22.04
Description:        

I try to store a large number in `BIGINT` and run  `ceil(c1)` command.
However, the result lost some precision due to calling `decil` function.
```sql
CREATE TABLE t1 (c1 BIGINT);
INSERT INTO t1 VALUES (4854233034440979799);
-- dceil
SELECT ceil(c1) FROM t1; -- {4.854233034440979e+18}
```
The original number is expected to return. In this case, calling
numeric_ceil function may be proper, and I try the following case.
```sql
CREATE TABLE t1 (c1 DECIMAL(20,0));
INSERT INTO t1 VALUES (4854233034440979799);
-- numeric_ceil
SELECT ceil(c1) FROM t1; -- {4854233034440979799}
```



view thread (4+ messages)  latest in thread

Message-ID: <19101-8f44b0e27aa65d40@postgresql.org>
Permalink:  ../19101-8f44b0e27aa65d40@postgresql.org/
Also on:    postgresql.org/message-id/19101-8f44b0e27aa65d40@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, dqetool@126.com
  Subject: Re: BUG #19101: Ceil on BIGINT could lost precision in decil function
  In-Reply-To: <19101-8f44b0e27aa65d40@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox