Re: double and numeric conversion

Поиск
Список
Период
Сортировка
От Theo Schlossnagle
Тема Re: double and numeric conversion
Дата
Msg-id BF2CDE34-127D-4469-B663-7B02ACF7968A@omniti.com
обсуждение исходный текст
Ответ на Re: double and numeric conversion  (Yeb Havinga <yebhavinga@gmail.com>)
Ответы Re: double and numeric conversion  (Grzegorz Jaskiewicz <gj@pointblue.com.pl>)
Список pgsql-hackers
I can't release all of it, but the functions to convert uint64_t, int64_t and double to numeric Datum are the meat and
Ican expose those... 

https://labs.omniti.com/pgsoltools/trunk/contrib/scratch/pg_type_to_numeric.c

As I mentioned, the dscale on the double_to_numeric is imperfect resulting in things like: 1.23 turning into 1.2300 in
thenumeric returned.  This are significantly faster (as expected) than the type -> string -> numeric conversions. 


On Mar 3, 2010, at 5:01 AM, Yeb Havinga wrote:

> Theo Schlossnagle wrote:
>> I didn't look deeply at the postgres internals to see if there was a way to do double -> numeric and integer-types
->numeric without intermediary string format.  If that sort of thing is easy to leverage, I'd be happy to share the
code.
>>
> I think your code could be valuable for postgres on the fact alone that it is almost twice as fast, and probably easy
tointegrate and unit test. We make heavy use of the numeric data type, so I'm very interested! 
>
> regards
> Yeb Havinga
>
>

--
Theo Schlossnagle
http://omniti.com/is/theo-schlossnagle







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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [GENERAL] to_timestamp() and quarters
Следующее
От: Tom Lane
Дата:
Сообщение: Re: USE_LIBXSLT in MSVC builds