From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Output float number with hex format |
Date: | 2010-01-29 07:52:02 |
Message-ID: | 20100129075202.GB28818@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In response to Vincenzo Romano :
> 2010/1/29 ?????? <drshenlei(at)gmail(dot)com>:
> > 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
From | Date | Subject | |
---|---|---|---|
Next Message | Rodger Donaldson | 2010-01-29 08:07:21 | Re: Amazon EC2 CPU Utilization |
Previous Message | Pavel Stehule | 2010-01-29 07:32:08 | Re: dynamic crosstab |