kumaramit12325 / php-excel-reader

Automatically exported from code.google.com/p/php-excel-reader
0 stars 0 forks source link

Problems with big negative numbers #92

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have problems with big negative numbers, but only on some servers but I dont 
know the reason. I have Windows 7 64bit with Apache/2.2.11 (Win32),PHP/5.2.9. 
On this machine is number -1089597 readed from .xls file corectly. But for the 
same file readed on Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.10 I get 
1072652227 instead -1089597. Do you know which system (Apache / PHP) settings 
can I change in order to have corect results? Já dodávám, že tento problém 
se děje pro většinu velkých záporných čísel. But I have got here for 
example -5596800 and this value is returned correctly on both systems.

Original issue reported on code.google.com by sachmar...@seznam.cz on 13 Oct 2010 at 9:20

GoogleCodeExporter commented 8 years ago
Sorry, bad copy past from tranlator:
Já dodávám, že tento problém se děje pro většinu velkých záporných 
čísel. = I add that this problem happens for most of the large negative 
numbers.

Original comment by sachmar...@seznam.cz on 13 Oct 2010 at 9:23

GoogleCodeExporter commented 8 years ago
http://www.cyborgcomputing.com/?p=45

Original comment by sachmar...@seznam.cz on 13 Oct 2010 at 10:01

GoogleCodeExporter commented 8 years ago
Thank you. Thank you. THANK YOU!!!

Original comment by keanloon...@gmail.com on 19 Oct 2010 at 9:55

GoogleCodeExporter commented 8 years ago
i'm lucky reading this !!! Be aware : there is a smiley in the code ( "code" 
tags are pretty good)...

Original comment by bapti...@yoolight.fr on 14 Feb 2012 at 4:09

GoogleCodeExporter commented 8 years ago
Thank you very much! It was very helpful!

Original comment by chloreks...@gmail.com on 18 Sep 2013 at 11:02

GoogleCodeExporter commented 8 years ago
very helpful. thanks alot

Original comment by nuwamany...@gmail.com on 10 Oct 2013 at 7:56

GoogleCodeExporter commented 8 years ago
Sweet sachmar's solution works perfect, as i was seeing any value less than -1 
pop out as a large number.

I'm going to repost his code just in case the link goes down for any reason.

note: you have to replace BOTH GetInd4d() and _GeInd4d() functions in the 
google code

function _GetInt4d($data, $pos) {
    $_or_24 = ord($data[$pos+3]);
    if ($_or_24>=128)
    {
        $_ord_24 = -abs((256-$_or_24) << 24);
    } else {
        $_ord_24 = ($_or_24&127) << 24;
    }
    return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24;
}

Original comment by nathan...@gmail.com on 18 Mar 2014 at 10:16