Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Making decimal default datatype for floats during runtime

Thread Tools

Making decimal default datatype for floats during runtime

Stefan Sonnenberg-Carstens
Posts: n/a
I was wondering if there are any tricks around to
do some sort of changing types, float in particular.
I do many operations like summing etc on lots
of floats and always have to do some extra checks where
results are heading 0.0, like round(n,10) for example.
My idea was to tell python in some way not to take the type
float but decimal in an implicit fassion.
It that possible ?

And, is it still true for python 2.4/2.5 that one needs to do
a = Decimal(str(aFloat))
instead of
a = Decimal(aFloat)
as it is in python 2.3 ?

And, at least, has some tried to link (lib)python against tc_malloc
and benchmarked it ?

Thx in advance.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ruby 1.9+ , floats, and decimal botp Ruby 3 05-08-2010 01:05 AM
database datatype bit what is the C# datatype? Jeff ASP .Net 2 04-16-2007 08:26 PM
Round floats to N decimal places? Pat Maddox Ruby 4 03-27-2006 09:06 PM
Floats to chars and chars to floats Kosio C Programming 44 09-23-2005 09:49 AM
C/C++ DataType for DB2 DECIMAL(18,3) Ramz C Programming 1 07-04-2005 10:52 AM