Output float number with hex format

Поиск
Список
Период
Сортировка
От 沈雷
Тема Output float number with hex format
Дата
Msg-id b35448351001281948q4c8d81cex240b20410cea7f1c@mail.gmail.com
обсуждение исходный текст
Ответы Re: Output float number with hex format
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: is this the correct result for ts_rewrite? reducing tsquery to improve performance?
Следующее
От: Nick
Дата:
Сообщение: Re: Problem with query using ST_Dwithin