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

From: Michael Arnold <myk321(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4
Date: 2010-07-02 00:18:09
Message-ID: C8535141.FEB%myk321@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Well don't I feel silly!

Tom, thank-you for the help - I'll try and get my code debugged before
bothering you again....

On 2/07/10 12:51 AM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "" <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

Browse pgsql-bugs by date

  From Date Subject
Next Message Jon Strait 2010-07-02 04:57:04 BUG #5536: Disputing output for some Geometric types
Previous Message Jeff Benjamin 2010-07-01 20:39:13 Re: BUG #5535: Backslash in condition for LIKE statement is not seen