473,385 Members | 1,397 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Reading an Excel file

Hi there,

I have a litte problem while reading from a Excelfile.
Im try to read a 4 byte value and convert it into an integer or floating
point value with the following criteria:

Thats what the definiton says:

An RK valie is an encoded integer or floating-point value. RK values have a
size of 4 bytes and are used to decrease the size for floating-point values.
Structure of an RK value (32-bit value),

Bit |Mask |Contents
0 00000001(hex) 0 = Value not changed 1 = Value is
multiplied by 100
1 00000002(hex) 0 = Floating Point Value 1 = Signed
integer value
31-2 FFFFFFFC(hex) Encoded Value

If Bit 1 is cleared, the encoded value represents the 30 most significant
bits of an IEEE 754 floating point value (64-bit double precision). The 43
least significant bits must be set to zero. If bit 1 is set, the encoded
value represents a signed 30-bit integer value. To get the correct integer,
the encoded value has to be shifted right arithmetically by 2 bits. If bit 0
us set, the decoded value (both integer and floating-point) must be be
divided by 100 to get the final result.

So far what the definition says.

Could anybody helpme with a function that does what the definiton says ???

I tried to solve this with the following function:

function double4byte()
// for testing a fixed value:
// test float value 1
//$val = 0x3FF00000;
// test float value 2
//$val = 0x3FF00001;
// test integer value 1
//$val = 0x004B5646;
// test integer value 2
$val = 0x004B5647;

if (($val & 0x02) != 0)
echo "Integer ... ";
$intval = $val >> 2;
$value = doubleval($intval);

if (($val & 0x01) != 0)
echo "multiplied by 100 ... ";
$value /= 100;
return $value;
echo "floating point ... ";
$valbits = $val & 0xfffffffc;
$valbits = $valbits << 32;
$value = $valbits;

if (($val & 0x01) != 0)
echo "multiplied by 100 ... ";
$value /= 100;
return $value;

echo double4byte();


Im quite sure that it works for the integer values, but the floating point
operations are a big problem for me.
Could anybody help me please ???

Best regards Matthias
Jul 17 '05 #1
0 1608

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: David Alliet | last post by:
Hello, I'm having a bit of a problem with ASP and Excel. A client has developed his own program, which calculates alot of financial stuff, in excel. I'm doing his websites and he has requested...
by: mail2atulmehta | last post by:
Hi, I do not know if this is right place for this, but i need some help. I have a text file, whose values are seprated by a delimiter. I want to open this file in excel, ( not import it) . I have...
by: Turner, GS \(Geoff\) | last post by:
> -----Original Message----- > From: siliconwafer > Posted At: 19 August 2005 15:20 > Posted To: c > Conversation: reading an excel file in C? > Subject: reading an excel file in C? > > >...
by: Phoebe. | last post by:
Hi, Good Day! Reading 1 excel file into a dataset is fine. How can I read multiple excel with the same data structure into 1 dataset? How can I append those data? Can someone help? Thanks in...
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
by: Brad | last post by:
I'm having a problem reading data from an Excel file into a dataset. Can anybody give me an idea of what's happening? I've included the problematic source and the error message to the end of this...
by: Bharathi | last post by:
Hi, I got strucked with reading date value from excel file using C#.NET. For Jan-2000 the value I am getting is 36526.0. For all other dates also I am getting some double value like this. ...
by: sachinkale123 | last post by:
Hi, I am reading excel file and reading values from that I am using provider As : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + Filename + ";Extended Properties=\"Excel 8.0;Hdr=No;IMEX=1\"";...
by: ndedhia1 | last post by:
I was reading in a log file like this that had no milliseconds: QuoteBlockTiming exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 Class key = 601650761 block size QuoteBlockTiming...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.