Search Postgresql Archives

Re: Output float number with hex format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In response to Vincenzo Romano :
> 2010/1/29 ?????? <drshenlei@xxxxxxxxx>:
> > Hi!
> >
> > In C Language, there is a way to format float numbers into a hex string by
> > using "%a" in printf.
> > eg:
> > the value: 1.2345 can be expressed as '0x1.3c083126e978dp+0' which is the
> > hex representation of a float number.
> >
> > I have tried this in Postgres:
> > SELECT '0x1.3c083126e978dp+0'::float;
> >  float8
> > --------
> >  1.2345
> > (1 row)
> > This means that Postgres can accepty hex float as *input*. However I cannot
> > find any format function for *output*.
> > to_char(..., ...) does not have "%a"-like format. Is there any way to do
> > that?
> >
> > Thank you in advance.
> >
> > --
> > ShenLei
> 
> Well, your question sould be about a scanf, not printf, as this is
> input, not output.

I think, you have misinterpreted the question, he is looking for a
output in a hex representation, and he found a way for input.

Hrm, i think, this is possible with pl/perl. For instance.

A. Kretschmer
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux