mirror of
				https://github.com/ml-explore/mlx.git
				synced 2025-10-31 07:58:14 +08:00 
			
		
		
		
	Do not pass integers to isnan (#1664)
This commit is contained in:
		| @@ -500,7 +500,12 @@ struct Equal { | ||||
| struct NaNEqual { | ||||
|   template <typename T> | ||||
|   bool operator()(T x, T y) { | ||||
|     return x == y || (std::isnan(x) && std::isnan(y)); | ||||
|     if constexpr (std::is_integral_v<T>) { | ||||
|       // isnan always returns false for integers, and MSVC refuses to compile. | ||||
|       return x == y; | ||||
|     } else { | ||||
|       return x == y || (std::isnan(x) && std::isnan(y)); | ||||
|     } | ||||
|   } | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Cheng
					Cheng