Re: CONCAT function adding extra characters

From: Kenneth Marshall <ktm(at)rice(dot)edu>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: AI Rumman <rummandba(at)gmail(dot)com>, pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: CONCAT function adding extra characters
Date: 2021-06-15 19:12:51
Message-ID: 20210615191251.GU32646@aart.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> út 15. 6. 2021 v 20:56 odesílatel AI Rumman <rummandba(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2021-06-15 19:18:15 Re: CONCAT function adding extra characters
Previous Message Tom Lane 2021-06-15 19:07:41 Re: CONCAT function adding extra characters