Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id AFBB69FB842 for ; Fri, 29 Jun 2007 17:27:25 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 81656-09 for ; Fri, 29 Jun 2007 17:27:06 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id CC51C9FB766 for ; Fri, 29 Jun 2007 17:27:19 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l5TKRICI008176; Fri, 29 Jun 2007 16:27:18 -0400 (EDT) To: "Sun, Way" cc: pgsql-interfaces@postgresql.org Subject: Re: libpq: PQexecParams, binaryFormat and float In-reply-to: <7FBC16D72C0ABF45A88EAEB9ED3464C48CC172@sausatlexch01.corp.sa.net> References: <7FBC16D72C0ABF45A88EAEB9ED3464C48CC172@sausatlexch01.corp.sa.net> Comments: In-reply-to "Sun, Way" message dated "Fri, 29 Jun 2007 15:09:22 -0400" Date: Fri, 29 Jun 2007 16:27:18 -0400 Message-ID: <8175.1183148838@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/14 X-Sequence-Number: 6583 "Sun, Way" writes: > float loadavg; > loadavg = htonl(1.23); It seems entirely unlikely that that will produce a byte-reversed float value; what I think will happen is that the byte-reversed value of integer 1 will be converted into a host-format float and stored into loadavg. AFAIK you can't really do this in C without a union. Take a look at pq_sendfloat4 and pq_getmsgfloat4 in the backend for examples. regards, tom lane