Re: write float to Excel with pyExcelerator write

Discussion in 'Python' started by John Machin, Mar 3, 2008.

  1. John Machin

    John Machin Guest

    On Mar 1, 5:59 pm, Cyril.Liu <> wrote:
    > I use pyExcelerator to generat Excel files in my project. it works good
    > before I found this bug:
    > run this code:
    >
    > from pyExcelerator import *
    > wb = Workbook()
    > ws = wb.add_sheet("sheet")
    > for i in xrange(1):
    > ws.write(i,0, 10474224.6)
    > wb.save(r'd:\error_float.xls')
    >
    > open d:\error_float.xls with M$ Excle you'll find the number in the cell is
    > -263193.64 not 10474224.6
    >
    > why?


    The author assumed unsigned integers instead of signed integers.

    >>> 1047422460 - 2**30

    -26319364

    See the following, previously posted here:

    http://mail.python.org/pipermail/python-list/2007-May/441633.html

    Cheers,
    John
     
    John Machin, Mar 3, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bd
    Replies:
    0
    Views:
    665
  2. Replies:
    3
    Views:
    1,226
    Kent Johnson
    Mar 21, 2006
  3. Tim Golden
    Replies:
    0
    Views:
    580
    Tim Golden
    May 15, 2006
  4. Peter Otten
    Replies:
    0
    Views:
    390
    Peter Otten
    Mar 3, 2008
  5. Carsten Fuchs
    Replies:
    45
    Views:
    1,651
    James Kanze
    Oct 8, 2009
Loading...

Share This Page