grass negative numbers?

Simon Cox S.Cox at
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 :

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                     W
AGCRC info>>

More information about the grass-dev mailing list