Re: [HACKERS] double and numeric conversion

2010-03-03 Thread Yeb Havinga
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

Re: [HACKERS] double and numeric conversion

2010-03-03 Thread Pavel Stehule
2010/3/3 Yeb Havinga yebhavi...@gmail.com: 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

Re: [HACKERS] double and numeric conversion

2010-03-03 Thread Yeb Havinga
Pavel Stehule wrote: 2010/3/3 Yeb Havinga yebhavi...@gmail.com: 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

Re: [HACKERS] double and numeric conversion

2010-03-03 Thread Pavel Stehule
2010/3/3 Yeb Havinga yebhavi...@gmail.com: Pavel Stehule wrote: 2010/3/3 Yeb Havinga yebhavi...@gmail.com: 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

Re: [HACKERS] double and numeric conversion

2010-03-03 Thread Theo Schlossnagle
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 I can 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

Re: [HACKERS] double and numeric conversion

2010-03-03 Thread Grzegorz Jaskiewicz
if (p1 buf) ++ * --p1; else { ++ * --p1; ??? does it even compile ? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] double and numeric conversion

2010-03-03 Thread Grzegorz Jaskiewicz
On 3 Mar 2010, at 17:41, Grzegorz Jaskiewicz wrote: if (p1 buf) ++ * --p1; else { ++ * --p1; ??? does it even compile ? Oh, I can see, that it is *(--p1)++ ,mea culpa. Which doesn't change the fact, that the code is rather messy imo. -- Sent via

Re: [HACKERS] double and numeric conversion

2010-03-02 Thread Theo Schlossnagle
On Mar 1, 2010, at 4:35 PM, Tom Lane wrote: Theo Schlossnagle je...@omniti.com writes: I'm writing some extension and I have a hot code path that has a lot of double (C type) data and needs to output NUMERIC tuple data. The current methods I can find in the code to convert sprintf the

[HACKERS] double and numeric conversion

2010-03-01 Thread Theo Schlossnagle
Hello all, I'm writing some extension and I have a hot code path that has a lot of double (C type) data and needs to output NUMERIC tuple data. The current methods I can find in the code to convert sprintf the double to a buffer and then invoke the numeric_in function on them. I've profile

Re: [HACKERS] double and numeric conversion

2010-03-01 Thread Andrew Dunstan
Theo Schlossnagle wrote: Hello all, I'm writing some extension and I have a hot code path that has a lot of double (C type) data and needs to output NUMERIC tuple data. The current methods I can find in the code to convert sprintf the double to a buffer and then invoke the numeric_in

Re: [HACKERS] double and numeric conversion

2010-03-01 Thread Tom Lane
Theo Schlossnagle je...@omniti.com writes: I'm writing some extension and I have a hot code path that has a lot of double (C type) data and needs to output NUMERIC tuple data. The current methods I can find in the code to convert sprintf the double to a buffer and then invoke the