Last post on the matter. I figured out the puzzle. I had installed a few GnuWin32 packages to get libpng and libjpeg. Apparently one of these packages came with a bogus libm.

Aron

PS

#include <stdio.h >
#include <math.h>
#include <stdlib.h>

int main( int argc, char *argv[] ) {
  double number, result;

  if( argc > 1 ) {
    strtod( argv[0], NULL );
  } else {
    srand( time( NULL ) );

    number = ((double)rand())/(double)RAND_MAX;
  }

  result = floor( number );
  printf( "floor( %g ) => %g\n\n", number, result );

  result = ceil( number );
  printf( "ceil( %g ) => %g\n\n", number, result );

  result = sqrt( number );
  printf( "sqrt( %g ) => %g\n\n", number, result );

  result = sin( number );
  printf( "sin( %g )  => %g\n\n", number, result );

  result = cos( number );
  printf( "cos( %g )  => %g\n\n", number, result );

  result = atan( number );
  printf( "atan( %g )  => %g\n\n", number, result );

  return( 0 );
}

$ ./mathtest.exe
floor( 0.393353 ) => 0.393353
ceil( 0.393353 ) => 0.393353
sqrt( 0.393353 ) => -6.90468e+137
sin( 0.393353 )  => 1
cos( 0.393353 )  => 0
atan( 0.393353 )  => 1.5708