Bug in Decimal??

2014-05-17 Thread Stefan Krah
1007') Otherwise 'partial' has an error that is too large when you pass it to the ln() function. Since decimal mostly follows IEEE 754 with arbitrary precision extensions, it cannot behave differently. Stefan Krah -- https://mail.python.org/mailman/listinfo/python-list

Re: python decimal library dmath.py v0.3 released

2014-03-04 Thread Stefan Krah
l#arbitrary-precision-libraries Stefan Krah -- https://mail.python.org/mailman/listinfo/python-list

Re: Decimal 0**0

2013-02-05 Thread Stefan Krah
ml#refpower Why exactly the decision was made I cannot say. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Thorough Python 2.7.3 Windows Build Documentation?

2013-01-17 Thread Stefan Krah
ne version behind the latest. I wouldn't attempt it. For Python 3.3 the conversion has been done and the diff was enormous. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Thorough Python 2.7.3 Windows Build Documentation?

2013-01-17 Thread Stefan Krah
O builds > or not. I remember that some versions of Visual Studio silently completed the PGO build without actually having PGO capabilities. :) I think for VS 2008 at least "Professional" is needed, for VS 2010 "Ultimate". Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Thorough Python 2.7.3 Windows Build Documentation?

2013-01-17 Thread Stefan Krah
s in with the PGO build in 3.3. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Stefan Krah
d, since ß does not occur at the beginning of a word. As far as I know, most Germans wouldn't even know that it has existed at some point or how to write it. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: On-topic: alternate Python implementations

2012-08-04 Thread Stefan Krah
zero-fault software world: Several verification tools do exist and Leroy et al. are writing a certified compiler for C to plug the hole between the verified source code and the generated assembly. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python source code not available on github?

2012-06-24 Thread Stefan Krah
ve-vuln-in-ruby/ Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] cdecimal-2.3 released

2012-02-03 Thread Stefan Krah
For C, I think the why3 tool should be a good approach: http://why3.lri.fr/ The verification of the L4 kernel allegedly took 30 man-years, so it might take a while... Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

[ANN] cdecimal-2.3 released

2012-02-02 Thread Stefan Krah
Hi, I'm pleased to announce the release of cdecimal-2.3. cdecimal is a fast drop-in replacement for the decimal module in Python's standard library. Blurb = cdecimal is a complete implementation of IBM's General Decimal Arithmetic Specification. With the appropriate context parameters, cdec

Re: .format vs. %

2012-01-03 Thread Stefan Krah
Neil Cerutti wrote: > On 2012-01-03, Stefan Krah wrote: > > $ ./python -m timeit -n 100 '"%s" % 7.928137192' > > 100 loops, best of 3: 0.0164 usec per loop > > % is faster, but not by an order of magnitude. > > On my machine: > > C:

Re: .format vs. %

2012-01-03 Thread Stefan Krah
t;... > outfil_write(append_newline(t)) >... Did you profile this? I did, and it still adds 22% to the runtime. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: .format vs. %

2012-01-03 Thread Stefan Krah
cing the single line outfil.write("%s\n" % t) with outfil.write("{}\n".format(t)) adds 23% to the runtime. I think %-style formatting should not be deprecated at all. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: How to build 64-bit Python on Solaris with GCC?

2011-12-09 Thread Stefan Krah
utable on Solaris: > >% file ./python >./python: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), >dynamically linked (uses shared libs), not stripped ./configure CFLAGS=-m64 LDFLAGS=-m64 should work with a reasonably recent revision. Stefan Krah -- http://mai

Re: memory management

2011-11-07 Thread Stefan Krah
.5 is no longer maintained. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating equally-spaced floats with least rounding error

2011-09-24 Thread Stefan Krah
1178, in __add__ ans = ans._fix(context) File "/usr/lib/python3.2/decimal.py", line 1652, in _fix context._raise_error(Inexact) File "/usr/lib/python3.2/decimal.py", line 3836, in _raise_error raise error(explanation) decimal.Inexact: None Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: way to calculate 2**1000 without expanding it?

2011-09-16 Thread Stefan Krah
e OP did not specify the base: >>> bin(2**1000).count('1') 1 Or just: >>> print(1) 1 Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: try... except with unknown error types

2011-09-09 Thread Stefan Krah
her with a feature request: http://bugs.python.org/issue12555 I think the whole concept makes a lot of sense and is really worth taking a look at. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: LDFLAGS problem

2011-02-21 Thread Stefan Krah
lz -lcrypt -lm -o > >> build/lib.freebsd-7.0-RELEASE-i386-2.7/_mysql.so > >> gcc: ${LDFLAGS}: No such file or directory > >> error: command 'gcc' failed with exit status 1 > > > > where should I be looking to fix this problem? Try the patch from http://bugs.python.org/issue10547 or use an svn checkout. The patch didn't make it into 2.7.1. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes from_param() truncating 64 bit pointers to 32 bit

2011-02-18 Thread Stefan Krah
ave the proper function > signature. I suggest that you reconsider, since this appears to work: def from_param(self): return ctypes.c_void_p(self.c_ptr) Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

[ANN] cdecimal-2.2 released

2011-01-10 Thread Stefan Krah
aefa00fef cdecimal-2.2-no-thread.win-amd64-py2.7.msi 413724ff20ede7b648f57dd9a78a12e72e064583 cdecimal-2.2-no-thread.win-amd64-py3.1.msi Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: AIX 5.3 - Enabling Shared Library Support Vs Extensions

2010-11-25 Thread Stefan Krah
.o > -L/usr/local/lib *-lpython2.6* -o build/lib.aix-5.3-2.6/cStringIO.so Try these flags: -L. -L/usr/local/lib If this solves the problem and the issue is also present in Python-2.7, you should report a bug at http://bugs.python.org/ . Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Intel C Compiler

2010-11-08 Thread Stefan Krah
the most annoying warnings of the Intel compiler. See: http://software.intel.com/en-us/forums/showthread.php?t=62308 The problem is that the compiler issues this warning even when there is no way that significant bits could be lost. Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: decimal.Decimal formatting

2010-07-19 Thread Stefan Krah
1e-6 and 1e-7. Try: >>> format(Decimal("0"), ".11f") '0.000' Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Python -- floating point arithmetic

2010-07-08 Thread Stefan Krah
Mark Dickinson wrote: > On Jul 8, 2:59 pm, Stefan Krah wrote: > > pow() is trickier. Exact results have to be weeded out before > > attempting the correction loop for correct rounding, and this is > > complicated. > > > > For example, in decimal this expressi

Re: Python -- floating point arithmetic

2010-07-08 Thread Stefan Krah
apparent in the "impossible" paragraph that Mark responded to. I think asking for strictly bounded resource usage is reasonable. In cdecimal there is a switch to turn off correct rounding for exp() and log(). Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Python -- floating point arithmetic

2010-07-08 Thread Stefan Krah
lts have to be weeded out before attempting the correction loop for correct rounding, and this is complicated. For example, in decimal this expression takes a long time (in cdecimal the power function is not correctly rounded): Decimal('100.0') ** Decimal('-557.71e-74288') Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Stefan Krah
.2/decimal.py", line 3836, in _raise_error raise error(explanation) decimal.InvalidOperation: Invalid literal for Decimal: 'wrong' >>>c.traps[InvalidOperation] = False >>> Decimal("wrong", c) Decimal('NaN') Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Stefan Krah
al/decarith.pdf > (to-engineering-string is on page 20 if you're interested) The module is correct. Printing without exponent follows the same rules as to-scientific-string: "If the exponent is less than or equal to zero and the adjusted exponent is greater than or equal to -6,

Re: problem with floats and calculations

2010-02-14 Thread Stefan Krah
c = Decimal(str(random.uniform(100, 5000))).quantize(Decimal('0.01')) var = Decimal('8.314').quantize(Decimal('0.01')) # calc d d = (a * b)/ (c * var) if ((c*var*d) / b).quantize(Decimal('0.01')) != a: print a, (c*var*d) / b

Re: problem with floats and calculations

2010-02-14 Thread Stefan Krah
every > possible user input a single formula. And also it should be possible for a > computer, my calculator at home does the same and is much smaller and slower. d = (a * b)/ (c * var) d = Decimal(d).quantize(Decimal('0.01')) By quantizing d, the above equality does not hold any l

Re: how to register with pypi - no such setup.py

2009-12-26 Thread Stefan Krah
tly good version numbers. If I don't > change the number, I get a condescending message "Upload failed (400): > A file named "Morelia-0.0.10.tar.gz" already exists for > Morelia-0.0.10. To fix problems with that file you should create a new > release." It is qui

Re: Fast decimal arithmetic module released

2009-10-03 Thread Stefan Krah
Mark Dickinson wrote: > On Oct 2, 8:53 pm, Stefan Krah wrote: > > Hi, > > > > today I have released the following packages for fast arbitrary precision > > decimal arithmetic: > > > [...] > > Nice! I'd been wondering how you'd been finding a

Fast decimal arithmetic module released

2009-10-02 Thread Stefan Krah
her information and downloads at: http://www.bytereef.org/libmpdec.html Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Solution for XML-RPC over a proxy

2006-07-07 Thread Stefan Krah
> > Comments welcome. No real comment, just to point out an alternative that works well for me: http://docs.python.org/dev/lib/xmlrpc-client-example.html Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Python script running as Windows service: Clean shutdown

2006-01-11 Thread Stefan Krah
e) >> 8 if retval == 0: eclient.submit_chunk(sys.argv[1], int(sys.argv[2])) eclient.get_chunk(sys.argv[1], int(sys.argv[2])) elif retval == 1: eclient.get_chunk(sys.argv[1], int(sys.argv[2])) time.sleep(10) else: """./enigma has caught a signal