Re: BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4
Date
Msg-id 21660.1278003110@sss.pgh.pa.us
Whole thread Raw
In response to BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4  ("" <myk321@gmail.com>)
Responses Re: BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4  (Michael Arnold <myk321@gmail.com>)
List pgsql-bugs
"" <myk321@gmail.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

pgsql-bugs by date:

Previous
From: ""
Date:
Subject: BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4
Next
From: "Mike Fowler"
Date:
Subject: BUG #5534: IS DOCUMENT predicate errors instead of returning false