diff options
author | eschnett <eschnett@105869f7-3296-0410-a4ea-f4349344b45a> | 2011-08-20 00:30:29 +0000 |
---|---|---|
committer | eschnett <eschnett@105869f7-3296-0410-a4ea-f4349344b45a> | 2011-08-20 00:30:29 +0000 |
commit | b075a3dfcf5aaa72c086d7896ab0c975f42d04c2 (patch) | |
tree | d6fd1425bf823a0cd9a8d69e06231ca95864c831 /src/test.cc | |
parent | eb2a20c1f75a6de636a4d2c3ff3c3ae5064f5b3f (diff) |
Make more C++ compilers understand the signbit function
Several C++ compilers cannot handle std::signbit; use a work-around
instead.
Correct a namespace problem when using the same identifier Vectors_SGN
for different precisions (real*4 and real*8).
Correct kifpos implementation incorrectly on several architectures.
git-svn-id: https://svn.cct.lsu.edu/repos/numrel/LSUThorns/Vectors/trunk@29 105869f7-3296-0410-a4ea-f4349344b45a
Diffstat (limited to 'src/test.cc')
-rw-r--r-- | src/test.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/test.cc b/src/test.cc index b99865d..0be9aed 100644 --- a/src/test.cc +++ b/src/test.cc @@ -2,9 +2,16 @@ #include "cctk_Arguments.h" #include "cctk_Parameters.h" #include "vectors.h" + #include <math.h> #include <stdio.h> +inline int my_signbit (CCTK_REAL const x) +{ + using namespace std; + return signbit(x); +} + #define SCALARTEST(testname, vecexpr, scalarexpr) \ do { \ if (verbose) \ @@ -163,9 +170,9 @@ void Vectors_Test(CCTK_ARGUMENTS) VECTEST("ksqrt", ksqrt(av), sqrt(a[i]) ); VECTEST("kifpos positive", - kifpos(av, bv, cv), std::signbit(a[i]) ? c[i] : b[i]); + kifpos(av, bv, cv), my_signbit(a[i]) ? c[i] : b[i]); VECTEST("kifpos negative", - kifpos(bv, bv, cv), std::signbit(b[i]) ? c[i] : b[i]); + kifpos(bv, bv, cv), my_signbit(b[i]) ? c[i] : b[i]); VECTEST("kifpos 0", kifpos(vec_set1(0.),bv,cv), b[i]); VECTEST("kifpos -0", kifpos(vec_set1(-0.),bv,cv), c[i]); |