FP array checksum?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • larry@portcommodore.com

    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?
  • Gordon

    #2
    Re: FP array checksum?

    On Aug 7, 7:10 pm, la...@portcommo dore.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));

    Comment

    • larry@portcommodore.com

      #3
      Re: FP array checksum?

      On Aug 7, 1:11 pm, Gordon <gordon.mc...@n tlworld.comwrot e:
      Any know of any sample code or suggestions?
      >
      $checksum = crc32 (implode ($myArray));
      Darn you! It had to be so easy.. :-)

      Thanks.

      Comment

      • =?iso-8859-1?Q?=C1lvaro?= G. Vicario

        #4
        Re: FP array checksum?

        *** larry@portcommo dore.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
        --

        Comment

        • C. (http://symcbean.blogspot.com/)

          #5
          Re: FP array checksum?

          On Aug 7, 9:37 pm, "Álvaro G. Vicario"
          <webmasterNOSPA MTHA...@demogra cia.comwrote:
          *** la...@portcommo dore.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.00000000000 00/3.000000000000
          then 3.0000000000000 *x = 3.0000000000000 000

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

          C.

          Comment

          Working...