/[escript]/trunk/escript/src/LocalOps.h
ViewVC logotype

Diff of /trunk/escript/src/LocalOps.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2548 by jfenwick, Mon Jul 20 06:20:06 2009 UTC revision 2884 by jfenwick, Thu Jan 28 05:00:59 2010 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*******************************************************
3  *  *
4  * Copyright (c) 2003-2009 by University of Queensland  * Copyright (c) 2003-2010 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * Earth Systems Science Computational Center (ESSCC)
6  * http://www.uq.edu.au/esscc  * http://www.uq.edu.au/esscc
7  *  *
# Line 34  For operations on DataVector see DataMat Line 34  For operations on DataVector see DataMat
34    
35  namespace escript {  namespace escript {
36    
37    /**
38    \brief acts as a wrapper to isnan.
39    \warning if compiler does not support FP_NAN this function will always return false.
40    */
41    inline
42    bool nancheck(double d)
43    {
44            // Q: so why not just test d!=d?
45            // A: Coz it doesn't always work [I've checked].
46            // One theory is that the optimizer skips the test.
47    #ifdef isnan
48        return isnan(d);
49    #elif defined _isnan
50        return _isnan(d);
51    #else
52        return false;
53    #endif
54    }
55    
56    /**
57    \brief returns a NaN.
58    \warning Should probably only used where you know you can test for NaNs
59    */
60    inline
61    double makeNaN()
62    {
63    #ifdef nan
64        return nan("");
65    #else
66        return sqrt(-1);
67    #endif
68    
69    }
70    
71    
72  /**  /**
73     \brief     \brief

Legend:
Removed from v.2548  
changed lines
  Added in v.2884

  ViewVC Help
Powered by ViewVC 1.1.26