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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-bugs by date

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