abs(valarray) casts to int

abs(valarray) casts to int

When I call abs(valarray), the contents of the valarray are cast to int, when is included (under Windows.) If I include only, there is no problem, but I need for other functions. So what's to be done?

Seems like there should be a way to get this to work. Especially, since the ICL 11.0 manual specifically says: "The Intel compiler provides a high performance implementation of specialized valarray operations for the C++ standard valarray container." And lists the supported functions, including abs(valarray)

===========================================================

It's possible to override abs() in the code, but there's got to be a better way (?)

double abs( double x ) { return fabs(x); }

valarray abs ( valarray& x )
{
valarray absX (x);
for (int i = 0 ; i < x.size(); ++i) absX[i] = fabs(x[i]);
return absX;
}

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.