gcc and Alphas under Linux

Marcos Diaz came across a problem when using the code on an alpha running Linux.  It appears to be a bug in the Linux math library. 

The code crashes with floating point exceptions.  To see this problem, compile and execute the following snippet (written by Peter van Hoof) on an Alpha; it will crash where the multiply happens.  

#include <math.h>
#include <stdio.h>
void main()
  double g;

  g = -740.12875;
  g = exp(g);
  printf("result: %.16e\n", g);
  g = g*2.;
  printf("result: %.16e\n", g);

The theory is that the Linux math library returns an illegal float when the exp is evaluated, rather than the correct underflow to zero.  The code crashes when this illegal float is multiplied by two.  Please let me know if you have a solution under the Linux library.

Marcos Diaz did find a solution.  Download the Compac ccc compiler and library, from here.  Cloudy worked if you compile with gcc and link against these math libraries.

Peter van Hoof writes "That bug is solved in Cloudy, at least for ev56 hardware and later. It is discussed in


which gives a workaround for earlier hardware (very work-intensive, but  there might be desperate people out there....).

Hit Counter
Last changed 04/01/03.
Return to the Cloudy Home Page.
Copyright 1978-2003 Gary J. Ferland