This is a discussion on Re: [GENERAL] PostgreSQL 8.0.0 Release Candidate 4 within the pgsql Hackers forums, part of the PostgreSQL category; --> Chris Mair wrote: > The Playstation 2 hardware manuals confirm that the FPU has > no support for NaN ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Chris Mair wrote: > The Playstation 2 hardware manuals confirm that the FPU has > no support for NaN and +/-Inf. That explains the regression diffs. > (EE Core User's Manual Version 5, p. 153) Well, it does not readily explain that 'infinity' is rejected as invalid input syntax. You should get an overflow or some large value, at least. The relevant code is in src/backend/utils/adt/float.c. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |
| |||
| Chris Mair <list@1006.org> writes: > It seems strtod() is to blame. > ... > on the PlayStation 2 returns: > input string is 'Infinity' > strtod returned val = inf > errno = 0 > endptr points to 'inity' > Would it be worth treating this case apart in float.c, or should we just > blame the PlayStation's 2 Linux (quite old version 2.2.2) Gnu C library > to be broken? I'd just say that that version of glibc is broken. I have not seen this behavior reported anywhere else. In any case, I think we can update the Playstation 2 entry for 8.0 ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings |
| ||||
| On Sun, 2005-01-09 at 17:45, Peter Eisentraut wrote: > Well, it does not readily explain that 'infinity' is rejected as invalid > input syntax. You should get an overflow or some large value, at > least. > > The relevant code is in src/backend/utils/adt/float.c. You're right. I had a look at the code. It seems strtod() is to blame. This sample program #include <stdio.h> #include <stdlib.h> #include <errno.h> int main() { char *endptr; double val; char *num = "Infinity"; errno = 0; val = strtod(num, &endptr); printf("input string is '%s'\n", num); printf("strtod returned val = %lf\n", val); printf("errno = %d\n", errno); printf("endptr points to '%s'\n", endptr); } on the PlayStation 2 returns: input string is 'Infinity' strtod returned val = inf errno = 0 endptr points to 'inity' float.c's conversion routine cannot deal with a strtod that just eats the 'Inf' part of 'Infinity', so the remaining 'inity' is causing the syntax error (from line 522 in "float.c"). Consistently, this works with the so compiled version of PG: postgres=# select 'Inf'::float8; float8 ---------- Infinity (1 row) Would it be worth treating this case apart in float.c, or should we just blame the PlayStation's 2 Linux (quite old version 2.2.2) Gnu C library to be broken? I wonder how many implementations of strtod behave this way? On a few other boxes of mine I've seen versions that accept 'Infinity' as a whole or reject it as a whole Bye, Chris. ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org |