473,327 Members | 2,090 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,327 software developers and data experts.

FP array checksum?

I would like to generate a checksum for a small array of floating
point numbers (to see if there was a change in or not in the array,
without having to have all the original values in a form.) some sort
of CRC would be nice.

Any know of any sample code or suggestions?
Aug 7 '08 #1
4 4392
On Aug 7, 7:10*pm, la...@portcommodore.com wrote:
I would like to generate a checksum for a small array of floating
point numbers (to see if there was a change in *or not in the array,
without having to have all the original values in a form.) some sort
of *CRC would be nice.

Any know of any sample code or suggestions?
$checksum = crc32 (implode ($myArray));
Aug 7 '08 #2
On Aug 7, 1:11 pm, Gordon <gordon.mc...@ntlworld.comwrote:
Any know of any sample code or suggestions?

$checksum = crc32 (implode ($myArray));
Darn you! It had to be so easy.. :-)

Thanks.
Aug 7 '08 #3
*** la***@portcommodore.com escribió/wrote (Thu, 7 Aug 2008 11:10:08 -0700
(PDT)):
I would like to generate a checksum for a small array of floating
point numbers (to see if there was a change in or not in the array,
without having to have all the original values in a form.) some sort
of CRC would be nice.

Any know of any sample code or suggestions?
You can use serialize() on the array to get a string and then apply a
hashing function like md5(), sha1() or crc32().

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
Aug 7 '08 #4
On Aug 7, 9:37 pm, "Álvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.comwrote:
*** la...@portcommodore.com escribió/wrote (Thu, 7 Aug 2008 11:10:08 -0700
(PDT)):
I would like to generate a checksum for a small array of floating
point numbers (to see if there was a change in or not in the array,
without having to have all the original values in a form.) some sort
of CRC would be nice.
Any know of any sample code or suggestions?

You can use serialize() on the array to get a string and then apply a
hashing function like md5(), sha1() or crc32().

--
--http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:http://bits.demogracia.com
-- Mi web de humor en cubitos:http://www.demogracia.com
--
But floating point numbers change slightly when their representation
is altered; you can't assume that if x=1.0000000000000/3.000000000000
then 3.0000000000000*x = 3.0000000000000000

So the solution needs to take into account what the meaning of
'change' is.

C.
Aug 10 '08 #5

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

Similar topics

2
by: Tommie Nygren | last post by:
For different reasons I am reading an array of bytes from a file in my ..jar-file and from this I want to create a PNG image using Image.createImage(myArray, 0 , myArray.length). I had a...
12
by: Mercuro | last post by:
Hello i'm looking for a simple way to checksum my data. The data is 70 bytes long per record, so a 32 byte hex md5sum would increase the size of my mysql db a lot. I'm looking for something...
2
by: pradeep | last post by:
I have 2 data files, DATA1 and DATA2 , both same. My task is to: Open DATA1, compute the checksum and put it in the end of the file(don't bother about boundary conditions).close DATA1 Open...
2
by: Abby | last post by:
I need to do 8 bits 2's complement checksum, so I wrote code in order to see if the checksum calculation is correct. ===========================================================================...
1
by: Terry | last post by:
I'm trying to calculate the checksum for UDP packet. The algorithm itself is not difficult (lots of examples out there), but what I'm having the most trouble with is determining the byte order...
4
by: Rain | last post by:
hi, need help here, does anyone know how to use or does any one have the code for checksum? I want to checksum a string to be sent using udp and checksum it again when received.. does anyone...
9
by: herobeat | last post by:
Hi all, I'm having a hell of a time with declaring a struct to hold some binary data I'm trying to read from some files on disk. What I would like to do is something like this: public struct...
2
by: tlsk | last post by:
Hi I need to calculate the crc32 value for an unsigned array in C++.It goes like this.. unsigned char Myarray; //Myarray contains hex value ... b525b4d0ad533acee2d6a214453a279e Need to...
3
by: Slaunger | last post by:
I know there must be a simple method to do this. I have implemented this function for calculating a checksum based on a ones complement addition: def complement_ones_checksum(ints): """...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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 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.