[ODE] autoconf/automake

Jens Thiele karme at unforgettable.com
Tue Nov 20 08:01:02 MST 2001


Russ Smith wrote:

>>new improved inofficial autoconf/automake version:
>>http://www-ti.informatik.uni-tuebingen.de/~thiele/patch/ode/
>>
> 
> it looks good. i had a few problems compiling out of the box
> on my platform (linux):
> 
>   in drawstuff:
>     x11.cpp: In function `void createMainWindow (int, int)':
>     x11.cpp:146: `strlen' undeclared (first use this function)
> 
>   in ode:
>     timer.cpp: In function `void dTimerReport (FILE *, int)':
>     timer.cpp:331: `strlen' undeclared (first use this function)
> 
> must be just a missing include or something. anyway, there are some

added #incude <string.h>
perhaps this needs a bit more than just to include it
(autconf: STDC_HEADERS)

topic HUGE_VAL

> other things we'll need to configure too:
>   * HUGE_VAL should be the maximum representable dReal. this is
>     normally infinity. HUGE_VAL is poorly defined right now.
>     on many systems infinity is 1.0/0.0 - but not all?

Ruud:
 >I had to change this in the .h file to HUGE. Which is FLT_MAX
 >(/usr/include/math.h). That was a Best Linux install (not one of the more
 >commonly known ones).
interesting topic never thought about this one before.
according to info libc 1.0/0.0 should be fine.
( i didn't evven know that it is allowed to do calculations with infinity)
info libc is really a good read.
[...]
  - Macro: float INFINITY
      An expression representing positive infinity.  It is equal to the
      value produced  by mathematical operations like `1.0 / 0.0'.
      `-INFINITY' represents negative infinity.
[...]
This macro was introduced in the ISO C 9X standard.
=> not iso9899:1990 a.k.a. ansi C

I didn't find anything about ISO C 9X standard conformance of different 
compilers :-((
with gcc and glibc you have to use: -stdc9x same as -std=iso9899:199x
=> 1.0/0.0 is the better choice perhaps ?


in the moment common.h has:
#define __USE_ISOC9X 1	/* necessary to get HUGE_VALF on GNU systems? */
#include <math.h>
[...]
#if defined(WIN32) && (defined(MSVC) || defined(MINGW))
static union { unsigned char __c[4]; float __f; } __ode_huge_valf =
   {{0,0,0x80,0x7f}};
#define _INFINITY4 (__ode_huge_valf.__f)
static union { unsigned char __c[8]; double __d; } __ode_huge_val =
   {{0,0,0,0,0,0,0xf0,0x7f }};
#define _INFINITY8 (__ode_huge_val.__d)
#else
#define _INFINITY8 HUGE_VAL
#define _INFINITY4 HUGE_VALF
#endif

#if defined(dSINGLE)
#define dInfinity _INFINITY4
#else
#define dInfinity _INFINITY8
#endif

this should not be in common.h because common.h is installed (the win 
stuff is machine dpendant)
i did not find any docu about HUGE_VAL / HUGE_VALF (except math.h and 
bits/huge_val.h)

i did a grep through all the sources on my machine and it seems HUGE_VAL 
is commonly used
for infinity:

  * NaN's and infinities are converted to HUGE_VAL or HUGE, which
  * happens to be infinity on IEEE machines.  Unfortunately, it is
  * impossible to preserve NaN's in a machine-independent way.
  * Infinities are, however, preserved on IEEE machines.
  *
  * These routines have been tested on the following machines:
  *      Apple Macintosh, MPW 3.1 C compiler
  *      Apple Macintosh, THINK C compiler
  *      Silicon Graphics IRIS, MIPS compiler
  *      Cray X/MP and Y/MP
  *      Digital Equipment VAX
  *      Sequent Balance (Multiprocesor 386)
  *      NeXT
  *

and HUGE_VALF seems to be ISO C 9X extension

hmmm - i think this mail gets quite confusing now
it seems HUGE_VAL should be no problem
but what about HUGE_VALF ?

perhaps the easiest is anyway 1.0/0.0 ?

but float f=HUGE_VAL; works too

=>
#ifdef dSINGLE
#define dInfinity ((float)HUGE_VAL)
#else
#define dInfinity HUGE_VAL
#endif




>   * high resolution timer functions in timer.cpp. these are not
>     needed for normal operation, but are a must for testing.
> 

yep - on todo list
i always used gettimeofday (which sould be portable on unix) too



>the point of this email is: don't waste any of your time thinking about
>mmap() with autoconf.
:-))) - mmap what's that ? ;-)







-- 
email karme at unforgettable.com
IRC   Karme
HP    http://www-ti.informatik.uni-tuebingen.de/~thiele




More information about the ODE mailing list