IsNan.cc 1.15 KB
/**
 * 
 *
 *  Created on: 18 jun. 2024
 *      Author: AKKODIS - Furkan
 */

#include "IsNaN.hh"

#include <cmath>


template <typename Type>
int _isNaN(const Type& el) {
	double dEl = (double)el;
	return (int)std::isnan(dEl);
}

template <typename Type>
std::vector<int> _isNaN(const std::vector<Type>& el) {
	std::vector<int> result;
	for (typename std::vector<Type>::const_iterator it = el.begin(); it != el.end(); ++it) {
		result.push_back(_isNaN(*it));
	}
	return result;
}

int IsNaN(const float& el) {
	return _isNaN(el);
}

int IsNaN(const double& el) {
	return _isNaN(el);
}

int IsNaN(const long double& el) {
	return _isNaN(el);
}

int IsNaN(const int& el) {
	return _isNaN(el);
}

int IsNaN(const short& el) {
	return _isNaN(el);
}

std::vector<int> IsNaN(const std::vector<float>& el) {
        return _isNaN(el);
}

std::vector<int> IsNaN_(const std::vector<double>& el) {
        return _isNaN(el);
}

std::vector<int> IsNaN_(const std::vector<long double>& el) {
        return _isNaN(el);
}

std::vector<int> IsNaN_(const std::vector<int>& el) {
        return _isNaN(el);
}

std::vector<int> IsNaN_(const std::vector<short>& el) {
        return _isNaN(el);
}