Advertisement
Guest User

Untitled

a guest
Mar 27th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. template <T>
  2. bool SGVector<T>::equals(SGVector<T>& other, float accuracy=0, bool tolerance=false)
  3. {
  4.     if(other.vlen != vlen)
  5.         return false ;
  6.     switch(T)
  7.     {
  8.         case float32_t:
  9.             for(int i=0 ; i<other.vlen ; i++)
  10.             {
  11.                 if(!CMath::fequals<float32_t>(vector[i],other.vector[i] , accuracy , tolerance))
  12.                     return false ;
  13.             }
  14.             return true ;
  15.             break ;
  16.         case float32_t:
  17.             for(int i=0 ; i<other.vlen ; i++)
  18.             {
  19.                 if(!CMath::fequals<float32_t>(vector[i],other.vector[i] , accuracy , tolerance))
  20.                     return false ;
  21.             }
  22.             return true ;
  23.             break ;
  24.     }  
  25.  
  26.     return true ;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement