From: Kenneth Marshall <ktm@rice.edu>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: AI Rumman <rummandba@gmail.com>
Cc: pgsql-general General <pgsql-general@postgresql.org>
Subject: Re: CONCAT function adding extra characters
Date: Tue, 15 Jun 2021 14:12:51 -0500
Message-ID: <20210615191251.GU32646@aart.rice.edu> (raw)
In-Reply-To: <CAFj8pRDb4MevTh5kV7hsXbX9hszCt3Ca8hRrCOdOp9ag5H3HyQ@mail.gmail.com>
References: <CAGoODpdy0zyMbsOCb5n78yM4v2UvWeb2GT9WyCnH1YtSxkcYZA@mail.gmail.com>
<CAFj8pRDb4MevTh5kV7hsXbX9hszCt3Ca8hRrCOdOp9ag5H3HyQ@mail.gmail.com>
> Ășt 15. 6. 2021 v 20:56 odesĂlatel AI Rumman <rummandba@gmail.com> napsal:
> I am using Postgresql 10 and seeing a strange behavior in CONCAT function
> when I am concatenating double precision and int with a separator.
>
> select concat('41.1'::double precision,':', 20);
>> Result:
>> 41.1000000000000014:20
>
>
> Value 41.1 which double precision converts to 41.1000000014.
>
> Is that expected?
>
Hi
0.1 cannot be represented exactly in binary so that does not look out of
line. There are also some config options for extra digits and what not
that may affect the result of a cast.
Regards,
Ken
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ktm@rice.edu, pavel.stehule@gmail.com, rummandba@gmail.com
Subject: Re: CONCAT function adding extra characters
In-Reply-To: <20210615191251.GU32646@aart.rice.edu>
References: <CAGoODpdy0zyMbsOCb5n78yM4v2UvWeb2GT9WyCnH1YtSxkcYZA@mail.gmail.com> <CAFj8pRDb4MevTh5kV7hsXbX9hszCt3Ca8hRrCOdOp9ag5H3HyQ@mail.gmail.com> <20210615191251.GU32646@aart.rice.edu>
* 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