grass negative numbers?

Simon Cox S.Cox at solo.ned.dem.csiro.au
Tue Oct 10 08:00:00 EDT 1995


>How is grass writing negative numbers? I've made a C program
>to import uncompressed binary cell raster files and I get
>wrong results with negatives, even if I read them as
>long integers. I get numbers like :
>-2147483641
>-2147483643
>-2147483647

I have often used negative numbers.  However, remember that the Grass
binary format for rasters is NOT identical to IEEE or any other particular
architecture's version - see the programmer's manual for all the details
if you _really_ want to get into bit manipulation.   (This is done so that
Grass files can be transparently exported across architectures, without
worrying about the sex (this is a technical term) of the machines.)

NOTE - As always, the safest way
is to use Grass library functions for all "write" operations (although
for an external source of data you will probably use basic 'C' functions
to do the "read" operations).

Simon Cox

___________________________________________________________
Dr Simon Cox                          __  \
CSIRO Exploration & Mining         ,~'  L_|\    Australian
39 Fairway, PO Box 437,         ;-'         \   Geodynamics
Nedlands, WA  6009  Australia   (            \  Cooperative
      Phone +61 9 284 8443      +    ___     /  Research
      Fax   +61 9 389 1906       L~~'   "\__/   Centre
simon at ned.dem.csiro.au                     W
AGCRC info>>   http://www.ned.dem.csiro.au/AGCRC/
___________________________________________________________







More information about the grass-dev mailing list