The 85/0.0085 mistery ?

From: Jean-Christophe Pazzaglia <jc(dot)pazzaglia(at)albourne(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: The 85/0.0085 mistery ?
Date: 2000-10-06 12:28:18
Message-ID: 39DDC562.87D352AD@albourne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Well, I discovered a strange behavior (ie 85/0.0085 <> 10000 )
Is my SQL wrong or is it postgres ?
We are running 7.02 (but also 6.x) on a alpha (alphaev6) box.

Thanks in advance.

jc

Here is a snapshot

jctest=> create table eigthyfive ( cs float4, csbytenthousand float4,
csbyhundred float);
CREATE

jctest=> insert into eigthyfive VALUES (88,0.0088,0.88);
INSERT 7973003 1
jctest=> insert into eigthyfive VALUES (86,0.0086,0.86);
INSERT 7973004 1
jctest=> insert into eigthyfive VALUES (85,0.0085,0.85);
INSERT 7973005 1
jctest=> insert into eigthyfive VALUES (84,0.0084,0.84);
INSERT 7973006 1

jctest=> select * from eigthyfive ;
cs | csbytenthousand | csbyhundred
----+-----------------+-------------
88 | 0.0088 | 0.88
86 | 0.0086 | 0.86
85 | 0.0085 | 0.85
84 | 0.0084 | 0.84
(4 rows)

jctest=> select * from eigthyfive where (cs/csbytenthousand=10000);
cs | csbytenthousand | csbyhundred
----+-----------------+-------------
88 | 0.0088 | 0.88
86 | 0.0086 | 0.86
84 | 0.0084 | 0.84
(3 rows)

*** oh oh 85 disappeared ! ***

BUT

jctest=> select (85/0.0085=10000);
?column?
----------
t
(1 row)

jctest=> select * from eigthyfive where (cs/csbyhundred=100);
cs | csbytenthousand | csbyhundred
----+-----------------+-------------
88 | 0.0088 | 0.88
86 | 0.0086 | 0.86
85 | 0.0085 | 0.85
84 | 0.0084 | 0.84
(4 rows)

** 85 is back **

jctest=> insert into eigthyfive VALUES (85,0.00085);
INSERT 7973007 1
jctest=> select * from eigthyfive where (cs/csbytenthousand=100000);
cs | csbytenthousand | csbyhundred
----+-----------------+-------------
85 | 0.00085 |
(1 row)

Attachment Content-Type Size
jc.pazzaglia.vcf text/x-vcard 399 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Frederick W. Reimer 2000-10-06 12:47:23 RE: The 85/0.0085 mistery ?
Previous Message Alfred Perlstein 2000-10-06 06:32:34 Re: Exited with status 139