On Fri, Feb 08, 2008 at 01:57:03PM -0600, Christopher Singley wrote:
> On Friday 08 February 2008 13:03:42 Oleg Broytmann wrote:
> >    I don't remember Decimal can do conversion to string and back from
> > string preserving precision. Are you talking about converting to
> > floating-point string? str(Decimal("1.1")) => '1.1'? I don't know if the
> > conversion preserves all digits. But if it does - that's the way to go, of
> > course.
> 
> http://www.python.org/dev/peps/pep-0327/#documentation
> PEP 327 says that str(Decimal()) implements the to-scientific-string function 
> required by IBM's Decimal Arithmetic Specification.
> http://www2.hursley.ibm.com/decimal/daconvs.html#reftostr
> 
> Unless the developers grossly misimplemented the spec, then the coefficient 
> will contain all significant digits.
> 
> An example of this usage is included in the Python Library Reference for the 
> module.
> http://docs.python.org/lib/decimal-tutorial.html

   Yes, after some thinking and experimenting I believe it saves all
digits. After all, it is called Decimal for purpose.

> I wouldn't know how to write a test.

   I am saving the thread in my mailbox and will do the dirty work later.
I think the implementation will be even simpler than registering
adapter/converter. SQLObject could do all the work itself.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to