Re: Strange results when casting string to double

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Carsten Klein <c(dot)klein(at)datagis(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Strange results when casting string to double
Date: 2022-02-18 12:28:29
Message-ID: f3575aaf-98a8-6941-7843-ba1a0d78514f@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daulat 2022-02-18 12:48:17 Re: Max_connection
Previous Message Michael Lewis 2022-02-18 08:31:22 Re: PostgreSQL's Max Identifier Length in Amazon RDS