diff --git a/lib/roo/excelx/cell/number.rb b/lib/roo/excelx/cell/number.rb index 20155628..445d78dd 100644 --- a/lib/roo/excelx/cell/number.rb +++ b/lib/roo/excelx/cell/number.rb @@ -21,7 +21,7 @@ def create_numeric(number) when /\.0/ Float(number) else - (number.include?('.') || (/\A[-+]?\d+E[-+]\d+\z/i =~ number)) ? Float(number) : Integer(number) + (number.include?('.') || (/\A[-+]?\d+E[-+]?\d+\z/i =~ number)) ? Float(number) : Integer(number) end end diff --git a/test/excelx/cell/test_number.rb b/test/excelx/cell/test_number.rb index 45db819c..b317bba8 100644 --- a/test/excelx/cell/test_number.rb +++ b/test/excelx/cell/test_number.rb @@ -25,6 +25,11 @@ def test_simple_scientific_notation assert_kind_of(Float, cell.value) end + def test_very_simple_scientific_notation + cell = Roo::Excelx::Cell::Number.new '1e6', nil, ['0'], nil, nil, nil + assert_kind_of(Float, cell.value) + end + def test_percent cell = Roo::Excelx::Cell::Number.new '42.1', nil, ['0.00%'], nil, nil, nil assert_kind_of(Float, cell.value)