On Mon, Jan 5, 2009 at 4:50 PM, alex goretoy
aleksandr.gore...@gmail.com wrote:
I get this when importing decimal:
Python 2.7a0 (trunk:68339M, Jan 5 2009, 05:18:41)
[GCC 3.4.6] on linux2
Type help, copyright, credits or license for more information.
import decimal
Traceback (most recent
Yes I ran strace python and imported math
time(NULL) = 1231244692
futex(0x80575d8, FUTEX_WAKE, 1) = 0
stat64(math, 0xbfabef50) = -1 ENOENT (No such file or
directory)
open(math.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
On Dec 28 2008, 4:55 pm, jerry.carl...@gmail.com wrote:
- are you usingDecimalfor the base-10-ness or the
extra precisionDecimalprovides? Or significant zeros?
Or compatibility with existingDecimalcode, or what?
Oh boy, now I will finally prove myself illiterate... well, so be it.
On Jan 6, 3:23 pm, Fredrik Johansson fredrik.johans...@gmail.com
wrote:
FYI, mpmath (http://code.google.com/p/mpmath/) implements arbitrary-
precision standard transcendental functions in pure Python. It is much
faster than decimal, dmath, decimalfuncs and AJDecimalMathAdditions,
and handles
On Jan 6, 8:29 pm, Mark Dickinson dicki...@gmail.com wrote:
Note that it's still subject to the same limitations as anything
else for trig_function(really huge argument), of course:
import mpmath
mpmath.cos(mpmath.mpf('1e9'))
[... still waiting for a result 30 minutes later ...]
Hmm. Maybe we shouldn't be using this syntax in from_float, if it's
the only thing that prevents the trunk version of decimal.py from
being used with Python 2.4. On the other hand, from_float isn't
going to work until 2.7 anyway, since it uses a whole bunch of
new stuff: as_integer_ratio
On Jan 4, 9:52 am, alex goretoy aleksandr.gore...@gmail.com wrote:
Also, another reason why I'm posting to this thread. I noticed some
error/typo in line 683 of decimal.py located on public svn repo. This is
what is looks like.
sign = 0 if _math.copysign(1.0, f) == 1.0 else 1
This
No, I know there's a typo because python told me there is. If you have svn
repo locally. then cd into Lib/ and run python decimal.py
It will tell you line 683 has syntax error, please see below.
haha python-svn # python Lib/decimal.py
File Lib/decimal.py, line 683
sign = 0 if
On Jan 4, 10:38 am, alex goretoy aleksandr.gore...@gmail.com
wrote:
haha python-svn # python Lib/decimal.py
File Lib/decimal.py, line 683
sign = 0 if _math.copysign(1.0, f) == 1.0 else 1
^
SyntaxError: invalid syntax
Although, It may be only because I ran it through
I've been watching this thread for couple days now. I followed the bug
report and all that stuff. It's very interesting to me how you guys talk
about this stuff. I like it alot. I a new guy to python, just fyi. I'm one
of my current projects I'm using Decimal as well and I think it be a huge
pain
On Dec 31 2008, 11:02 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
On Sun, 28 Dec 2008 06:38:32 -0800, Mark Dickinson wrote:
On Dec 28, 7:28 am, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
Ah crap, I forgot that from_float() has been left out of the
On Jan 3, 9:27 pm, Mark Dickinson dicki...@gmail.com wrote:
Decimal.from_float() implemented by Raymond Hettinger for Python 2.7
and Python 3.1, within 72 hours of Steven submitting the feature
request. If only all issues could be resolved this quickly. :-)
Rats. I left out the crucial line
On Sat, 03 Jan 2009 13:34:11 -0800, Mark Dickinson wrote:
On Jan 3, 9:27 pm, Mark Dickinson dicki...@gmail.com wrote:
Decimal.from_float() implemented by Raymond Hettinger for Python 2.7
and Python 3.1, within 72 hours of Steven submitting the feature
request. If only all issues could be
On Sun, 28 Dec 2008 06:38:32 -0800, Mark Dickinson wrote:
On Dec 28, 7:28 am, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
Ah crap, I forgot that from_float() has been left out of the decimal
API. That's very annoying.
Agreed. It's maybe even annoying enough that a feature
Since the interest is more in extended precision than in decimal
representation, there is another module that may be of interest.
http://calcrpnpy.sourceforge.net/clnum.html
It interfaces to the Class Library for Numbers (CLN) library to provide
both arbitrary precision floating point and
Raymond L. Buvel wrote:
Since the interest is more in extended precision than in decimal
representation, there is another module that may be of interest.
http://calcrpnpy.sourceforge.net/clnum.html
It interfaces to the Class Library for Numbers (CLN) library to provide
both arbitrary
On Dec 29, 10:22 am, Steve Holden st...@holdenweb.com wrote:
Raymond L. Buvel wrote:
Since the interest is more in extended precision than in decimal
representation, there is another module that may be of interest.
http://calcrpnpy.sourceforge.net/clnum.html
It interfaces to the Class
jerry.carl...@gmail.com wrote:
...
It's really just the goniometric functions that I am missing most at
the moment, so maybe I can figure it out with help of what you said
plus the already existing imperfect modules. Meantime maybe this
discussion will caught Guido's eye... ;-) And btw I do
On Sat, 27 Dec 2008 21:50:09 -0800, jerry.carl.mi wrote:
Which math functions? ln, log10, exp, sqrt already exist as methods of
Decimal instances. At the end of the Decimal docs there are a few
examples, including computing sin and cos (but apparently they naïvely
use a McLaurin series like
Hi Steven... thanks for your kind and extensive reply. Lots of good
food for thought. I know it's easy to complain about lack of
functionality, but it really was not my intention. Python is very cool
as it is and I still know too little about it to even suggest
anything. I just thought maybe I was
On Dec 28, 12:02 am, jerry.carl...@gmail.com wrote:
I have been looking for a Python module with math functions that would
both eat and spit Decimals. The standard math module eats Decimals
allright but spits floats.
Yes: it just converts the input (whether float, int, Fraction or
Decimal
On Dec 28, 7:28 am, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
Ah crap, I forgot that from_float() has been left out of the decimal API.
That's very annoying.
Agreed. It's maybe even annoying enough that a feature request
at bugs.python.org might be honoured. (Hint, hint!)
- are you using Decimal for the base-10-ness or the
extra precision Decimal provides? Or significant zeros?
Or compatibility with existing Decimal code, or what?
Oh boy, now I will finally prove myself illiterate... well, so be it.
But i am after the extra precision:
from math import *
On Dec 28, 3:55 pm, jerry.carl...@gmail.com wrote:
But i am after the extra precision:
from math import *
(1+1e-16)-1
0.0
Sounds like you don't care too much about the base-10 part,
so there may be other solutions out there.
Have you tried:
1. mpmath?
2. sympy?
3. Sage?
Any of these is
1. mpmath?
2. sympy?
3. Sage?
Haven't tried those, i guess i have some studying to do.
x=Decimal.__mod__(x,Decimal('2')*pi())
Works fine for what i need, but i am sure it's not the right way to do
it.
I don't know of any better way to deal with large arguments.
The main problem
mpmath... wow... just did what i needed :-)
Thanks, Mark! Hopefully i did not waste too much of your time... and
perhaps this discussion will send other lost sheeps in the right
direction.
(Still, it would make sense to have the goniometric functions in
decimal.)
--
Hi,
I have been looking for a Python module with math functions that would
both eat and spit Decimals. The standard math module eats Decimals
allright but spits floats... herefore exp(sin(Decimal())) produces exp
() of a float :-(
So far, i found:
-AJDecimalMathAdditions (http://www.ajgs.com
En Sat, 27 Dec 2008 22:02:51 -0200, jerry.carl...@gmail.com escribió:
I have been looking for a Python module with math functions that would
both eat and spit Decimals. The standard math module eats Decimals
allright but spits floats... herefore exp(sin(Decimal())) produces exp
() of a float
Which math functions? ln, log10, exp, sqrt already exist as methods of
Decimal instances. At the end of the Decimal docs there are a few
examples, including computing sin and cos (but apparently they naïvely use
a McLaurin series like you noticed in other module).
Hi Gabriel - thanks!
On Sat, 27 Dec 2008 16:02:51 -0800, jerry.carl.mi wrote:
Hi,
I have been looking for a Python module with math functions that would
both eat and spit Decimals. The standard math module eats Decimals
allright but spits floats... herefore exp(sin(Decimal())) produces exp
() of a float
On Sun, 28 Dec 2008 06:58:18 +, Steven D'Aprano wrote:
def make_decimal(f, precision=16):
# choose how many decimal places you want to keep return
Decimal.from_float(f, precision)
Ah crap, I forgot that from_float() has been left out of the decimal API.
That's very annoying.
31 matches
Mail list logo