Bugs: Browse | Submit New | Admin

[#24119] Particular number not displayed spreadsheet version 0.6.3.1

Date:
2009-02-25 07:13
Priority:
3
Submitted By:
Harley Mackenzie (harleym)
Assigned To:
Nobody (None)
Category:
worksheet
State:
Closed
Summary:
Particular number not displayed spreadsheet version 0.6.3.1

Detailed description
The floating point number 10000000.0 is not correctly written to a new spreadsheet as it is displayed as -737418.24
in Excel 2000, OpenOffice.org 3.0.0, Excel 2007. It seems to be this number exactly as a small change to the number
results in the number being written correctly.

Here is the code to replicate the problem, and I have attached the output spreadsheet that was produced with the replication
code.

Harley Mackenzie

-----

#
# bug with spreadsheet gem 0.6.3.1
# Dr. Harley Mackenzie
# hjm@hardsoftware.com
#

require 'spreadsheet'

book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet

sheet1[0, 0] = (10000000).to_f # ERROR displayed as -737418.24
sheet1[1, 0] = (10000001).to_f # OK
sheet1[2, 0] = (9999999).to_f # OK

sheet1[3, 0] = (10000000).to_i # OK

sheet1[4, 0] = (100000000).to_f # OK
sheet1[5, 0] = (1000000000).to_f # OK
sheet1[6, 0] = (10000000000).to_f # OK

sheet1[7, 0] = (1000000).to_f # 
sheet1[8, 0] = (100000).to_f # 
sheet1[9, 0] = (10000).to_f # 
sheet1[10, 0] = (1000).to_f # 

sheet1[11, 0] = (10000000.0).to_f #  ERROR displayed as -737418.24
sheet1[12, 0] = (10000000.1).to_f # OK
sheet1[13, 0] = (10000000.01).to_f # OK
sheet1[14, 0] = (10000000.001).to_f # OK

book.write './bug.xls'

Add A Comment: Notepad

Please login


Followup

Message
Date: 2009-07-03 18:47
Sender: Hannes Wyss

Fixed in 0.6.4
http://rubyforge.org/forum/forum.php?forum_id=33463
Date: 2009-07-03 12:09
Sender: Hannes Wyss

Thanks for the report!

This should be fixed in the current HEAD:
http://scm.ywesee.com/?p=spreadsheet;a=commit;h=618221de3cffbf71b
d811876dcb588c1b12458ab

I'll release an updated gem as soon as all the major bugs are
caught and gently shooed out the window.

Attached Files:

Name Description Download
bug.xls Spreadsheet produced with example code Download

Changes:

Field Old Value Date By
close_date2009-07-03 18:472009-07-03 18:47hwyss
status_idOpen2009-07-03 12:09hwyss
resolution_idNone2009-07-03 12:09hwyss
close_date2009-07-03 12:092009-07-03 12:09hwyss
File Added4373: bug.xls2009-02-25 07:13harleym