compiling grass5.0beta7 on linux

Andreas Lange Andreas.Lange at Rhein-Main.de
Mon Apr 24 19:12:01 EDT 2000


Markus Neteler wrote:
> Hi there,
> 
> INFINITY is defined in
> 
> /usr/include/math.h:    INFINITY        representation of the infinity value of type 'float'
> 
> If r.cost is not compiling on your machine, I assume your compiler
> is not installed properly. The declarations in src/raster/r.cost seems
> to be o.k.
> 
> Kind regards
> 
>  Markus Neteler

Hi Markus, 

sorry to insist on that, but on my Red Hat Linux 5.2, glibc 2.0.7, 
INFINITY is not defined in /usr/include/math.h or elswhere.

On IRIX 6.2 INFINITY is not defined too and compilation of r.cost stops
too. 

Please do not assume that all Unix systems are the same or compatible
with some standards Linux or glibc introduced a very short time ago. I
still hope that GRASS will continue support for other Unix platforms
than Linux. 

A portable program should use HUGE_VAL for a undefined infinite which is
defined in <math.h> and in <limits.h>. HUGE_VAL should be compatible
with systems that use IEEE floating point format. Another way is the
function isinf(double X), but this is BSD and is not portable to systems
that strictly confine to SYSV. 

I don't know if the code in main.c is correct as INFINITY is defined as
a float but null_cost is a double variable. Other possible defines:
FLT_MAX and DBL_MAX from <limits.h> contain the biggest value a float
resp. a double variable can hold. One could use FLT_MAX instead of
INFINITY. 

Please contact me if you whish me to investigate this further. I can
provide a patch.

cu 

Andreas 

-- 
Andreas Lange, 65187 Wiesbaden, Germany, Tel. +49 611 807850
Andreas.Lange at Rhein-Main.de, A.C.Lange at GMX.net



More information about the grass-user mailing list