in reply to Re: Spreadsheet::Read module is rounding the decimals in XLSX file
in thread Spreadsheet::Read module is rounding the decimals in XLSX file

But how come the same piece of code is giving me .9888 in the other environment. Also you could see that the unformatted value is '0.98880000000000001' (raw data). How can i extract this 0.9888 from that?
  • Comment on Re^2: Spreadsheet::Read module is rounding the decimals in XLSX file

Replies are listed 'Best First'.
Re^3: Spreadsheet::Read module is rounding the decimals in XLSX file
by afoken (Chancellor) on Jun 24, 2015 at 09:03 UTC
    But how come the same piece of code is giving me .9888 in the other environment. Also you could see that the unformatted value is '0.98880000000000001' (raw data). How can i extract this 0.9888 from that?

    See http://floating-point-gui.de/ for the 0000000000001 part. Apart from that, if you want a certain precision, use sprintf, as you were told in other replies.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^3: Spreadsheet::Read module is rounding the decimals in XLSX file
by kcott (Archbishop) on Jun 24, 2015 at 09:10 UTC
    "Also you could see that the unformatted value is '0.98880000000000001' (raw data). How can i extract this 0.9888 from that?"

    In Re: Spreadsheet::Read module is rounding the decimals in XLSX file, I provided:

    • A fully functional script.
    • The output from that script.
    • Links to documentation.
    • Advice on issues should you choose a different, but closely related, function.

    My apologies. Clearly that wasn't sufficient, free work for you!

    If, at some point, you want to extract a digit and change 0.9888 to 0.98880000000000001 in my code, you'll find out for yourself. If you're too lazy to do that, stay ignorant!

    -- Ken

      Hi Ken,

      Its not about the precisions missing. My point is why the same Read.pm is working in one environment and not working in other with the same code, same input file and same libraries? I need to know what settings(excel attributes) are missing in these two environments. We can write some customization to play with precision values, but, if you compare both the hashes, why is one environment referring to raw data and the other is printing out the exact value in xlsx file?