Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

abs(valarray) casts to int

user20090419
Beginner
264 Views
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 = fabs(x);
return absX;
}
0 Kudos
0 Replies
Reply