Re: Strange results when casting string to double
| От | Tom Lane |
|---|---|
| Тема | Re: Strange results when casting string to double |
| Дата | |
| Msg-id | 4159419.1645221486@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Strange results when casting string to double ("Peter J. Holzer" <hjp-pgsql@hjp.at>) |
| Список | pgsql-general |
"Peter J. Holzer" <hjp-pgsql@hjp.at> writes:
> Another idea: It could be the case that something (maybe a bug in
> postgres, maybe an extension, maybe even a random bit flip in memory)
> changed the FP rounding mode within the postgres process, which would
> affect all FP computations until the rounding mode is reset. That would
> have to have happened in the master to affect the worker processes as
> consistently as you are seeing. I don't know if it is even possible for
> a non-standard rounding mode to persist for any length of time, but if
> it is it would certainly account for weird rounding errors.
Hmm, that is a pretty interesting theory. On a RHEL8 box, I find
that fesetround(FE_DOWNWARD) causes strtod("1.56", NULL) to return
1.55999999999999983124
rather than the usual
1.56000000000000005329
which seems to square with Carsten's symptom.
Postgres itself contains no fesetround calls, but if you want
to believe a random bit flip changed that mode, maybe that'd
account for it. It'd certainly be interesting to find out
whether the problem persists after a postmaster restart.
[ wanders away wondering if the troublesome machine has ECC
memory ... ]
regards, tom lane
В списке pgsql-general по дате отправления: