/[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 2774 by artak, Wed Nov 25 04:24:03 2009 UTC
# 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    #ifndef isnan       // Q: so why not just test d!=d?
45        return false;   // A: Coz it doesn't always work [I've checked].
46    #else           // One theory is that the optimizer skips the test.
47        return isnan(d);
48    #endif
49    }
50    
51    /**
52    \brief returns a NaN.
53    \warning Should probably only used where you know you can test for NaNs
54    */
55    inline
56    double makeNaN()
57    {
58    #ifdef isnan
59        return nan();
60    #else
61        return sqrt(-1);
62    #endif
63    
64    }
65    
66    
67  /**  /**
68     \brief     \brief

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

  ViewVC Help
Powered by ViewVC 1.1.26