From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Carsten Klein <c.klein@datagis.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Strange results when casting string to double
Date: Fri, 18 Feb 2022 13:28:29 +0100
Message-ID: <f3575aaf-98a8-6941-7843-ba1a0d78514f@enterprisedb.com> (raw)
In-Reply-To: <0d711ac6-6975-ae07-8963-aa91c6500776@datagis.com>
References: <0d711ac6-6975-ae07-8963-aa91c6500776@datagis.com>
On 16.02.22 14:27, Carsten Klein wrote:
> AFAIK, this conversion is done by internal function float8in, which,
> when called directly, yields the same results:
>
> SELECT float8in('1.56');
>
> --> 1.55999999999999 (wrong!) on one server, and
> --> 1.56 (correct!) on all other servers.
float8in() really just calls the operating system's strtod() function.
I would test that one directly with a small C program.
It's also possible that different compiler options lead to different
optimizations.
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: peter.eisentraut@enterprisedb.com, c.klein@datagis.com
Subject: Re: Strange results when casting string to double
In-Reply-To: <f3575aaf-98a8-6941-7843-ba1a0d78514f@enterprisedb.com>
References: <0d711ac6-6975-ae07-8963-aa91c6500776@datagis.com> <f3575aaf-98a8-6941-7843-ba1a0d78514f@enterprisedb.com>
* 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