Skip site navigation (1) Skip section navigation (2)

Re: BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "" <myk321(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4
Date: 2010-07-01 16:51:50
Message-ID: 21660.1278003110@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"" <myk321(at)gmail(dot)com> writes:
> Some needless speculation:
> 0.75 = 3F400000 (as IEEE 32-bit float)
> 0.75 = 3FE8000000000000 (as IEEE 64-bit float)
> 1.812500 = 3FE80000 (as returned by PQexecParams)
> i.e. the return value is the first 32-bits of the 64-bit representation of
> the correct value.

Well, yeah.  You declared the column as float8, not float4:

> 	res = PQexec(conn, "CREATE TABLE testtbl( Intgr int4, Flt float8, PRIMARY
KEY ( Intgr ));");

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Mike FowlerDate: 2010-07-01 16:52:46
Subject: BUG #5534: IS DOCUMENT predicate errors instead of returning false
Previous:From: myk321Date: 2010-07-01 13:34:08
Subject: BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group