Re: gmpy adapter

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: gmpy adapter
Дата
Msg-id AANLkTikhs6oaDr8S-=5+uT1urB2aGpV1P_vif=m=tSG6@mail.gmail.com
обсуждение исходный текст
Ответ на gmpy adapter  (Daniel Popowich <danielpopowich@gmail.com>)
Ответы Re: gmpy adapter  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список psycopg
On Mon, Feb 28, 2011 at 4:56 PM, Daniel Popowich
<danielpopowich@gmail.com> wrote:

>  1) Is there something I'm overlooking with gmpy that could make this
>     much simpler?

Why don't you use mpf instead? Arbitrary precision float may map
better than rationals to the database decimals.

>  2) What other solutions do folk use for working around pythons slow,
>     slow, slow Decimal?

There are around C implementations compatible with Python decimals:
http://www.bytereef.org/mpdecimal/index.html for example.

Also notice that float64 has 53 bits of precision, 15 full decimal
digits. If you don't need more precision when you write data in the
database (even if you have used more during calculations) you may just
use the repr(float()) of your mpq to write into the database.

-- Daniele

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

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: Re: Using real libpq parameters
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Re: gmpy adapter