Re: python decimals
Decimal has good enough API and we need to follow it as lot of our code already operates with Decimal. Maybe with different Context and exception types and limited subset of operations - but switching should be not very hard. Decimal arithmetic is good for as. We need to support several types like Currency and standard floating point arithmetic make well known failures in fraction point for some cases. Really standard decimal module is exact what we need except performance. I'm skeptical about ctypes for this specific case but like to use Cython. Of course library will be open source. Perhaps I will start to work on it about end of next week - it's high priority task for my company. On Sep 16, 4:49 am, Mark Dickinson wrote: > On Sep 16, 1:35 am, Andrew Svetlov wrote: > > > It only reflects the fact what comp.lang.python replicated by several > > web sites. > > Unfortunately looks like there are no link to library implements that : > > ( > > A few random thoughts: > > If you just want fixed-precision decimal, there may be simpler > solutions > than using the decimal module. Contrary to popular belief, the > decimal > module (and decNumber) provides floating-point decimal arithmetic, not > fixed-point (though its treatment of exponents means that it can > emulate > fixed-point arithmetic well). > > Can you use the ctypes module to wrap the decnumber library? That > might be faster than writing a full-fledged extension module. Cython > might be useful, too. > > If you do create your own Python bindings for decnumber, is there any > chance you'd be allowed make them public (e.g., on PyPI)? I think > there are many people who would find such bindings useful. > > -- > Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: python decimals
On Sep 16, 1:35 am, Andrew Svetlov wrote: > It only reflects the fact what comp.lang.python replicated by several > web sites. > Unfortunately looks like there are no link to library implements that : > ( A few random thoughts: If you just want fixed-precision decimal, there may be simpler solutions than using the decimal module. Contrary to popular belief, the decimal module (and decNumber) provides floating-point decimal arithmetic, not fixed-point (though its treatment of exponents means that it can emulate fixed-point arithmetic well). Can you use the ctypes module to wrap the decnumber library? That might be faster than writing a full-fledged extension module. Cython might be useful, too. If you do create your own Python bindings for decnumber, is there any chance you'd be allowed make them public (e.g., on PyPI)? I think there are many people who would find such bindings useful. -- Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: python decimals
It only reflects the fact what comp.lang.python replicated by several web sites. Unfortunately looks like there are no link to library implements that : ( On Sep 15, 5:17 pm, Terry Reedy wrote: > Mark Dickinson wrote: > > On Sep 15, 2:27 am, Andrew Svetlov wrote: > >> Is there some kind of python binding for decNumber library? > >> Standard decimal.Decimal is good enough, but very slow. > >> My current project toughly coupled with 'currency' operations and we > >> have performance problems related to decimal calculations. > >> From my perspective decNumber is fast and has well wide domain to > >> represent and process all required set of numbers - we don't need to > >> work with 'almost infinite numbers' as python decimal can. > >> I tried to google for desired binding - but found nothing. > >> gmpy is interesting project, but supported types is not exactly what > >> we need - rationals and big floats is not decimals in fixed point > >> notation. > >> My team discussed about making own python binding of decNumber - but > >> before we start this task I like to ask python community: is there > >> existing implementation? I don't want to invent the wheel again. > > Searching "Python decNumber binding" puts your query, from various > sources, in several of the top 10 sports ;-) Did not seen anythng in the > next 20 either. > > > As far as I know, no such bindings exist. There have been various > > efforts to rewrite the decimal module in C, but (again as far as I > > know) none of those efforts have come to fruition yet. -- http://mail.python.org/mailman/listinfo/python-list
Re: python decimals
Mark Dickinson wrote: On Sep 15, 2:27 am, Andrew Svetlov wrote: Is there some kind of python binding for decNumber library? Standard decimal.Decimal is good enough, but very slow. My current project toughly coupled with 'currency' operations and we have performance problems related to decimal calculations. From my perspective decNumber is fast and has well wide domain to represent and process all required set of numbers - we don't need to work with 'almost infinite numbers' as python decimal can. I tried to google for desired binding - but found nothing. gmpy is interesting project, but supported types is not exactly what we need - rationals and big floats is not decimals in fixed point notation. My team discussed about making own python binding of decNumber - but before we start this task I like to ask python community: is there existing implementation? I don't want to invent the wheel again. Searching "Python decNumber binding" puts your query, from various sources, in several of the top 10 sports ;-) Did not seen anythng in the next 20 either. As far as I know, no such bindings exist. There have been various efforts to rewrite the decimal module in C, but (again as far as I know) none of those efforts have come to fruition yet. -- http://mail.python.org/mailman/listinfo/python-list
Re: python decimals
On Sep 15, 2:27 am, Andrew Svetlov wrote: > Is there some kind of python binding for decNumber library? > Standard decimal.Decimal is good enough, but very slow. > My current project toughly coupled with 'currency' operations and we > have performance problems related to decimal calculations. > From my perspective decNumber is fast and has well wide domain to > represent and process all required set of numbers - we don't need to > work with 'almost infinite numbers' as python decimal can. > I tried to google for desired binding - but found nothing. > gmpy is interesting project, but supported types is not exactly what > we need - rationals and big floats is not decimals in fixed point > notation. > My team discussed about making own python binding of decNumber - but > before we start this task I like to ask python community: is there > existing implementation? I don't want to invent the wheel again. As far as I know, no such bindings exist. There have been various efforts to rewrite the decimal module in C, but (again as far as I know) none of those efforts have come to fruition yet. -- Mark -- http://mail.python.org/mailman/listinfo/python-list