From 4200776e00a94b000a96f3e7c242fd3052e9d804 Mon Sep 17 00:00:00 2001 From: Furkan Date: Tue, 18 Jun 2024 08:36:26 +0000 Subject: [PATCH] #11537 - Done. --- CMakeLists.txt | 1 + src/ExternLib/IsNaN/CMakeLists.txt | 23 +++++++++++++++++++++++ src/ExternLib/IsNaN/IsNaN.hh | 36 ++++++++++++++++++++++++++++++++++++ src/ExternLib/IsNaN/IsNan.cc | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 126 insertions(+), 0 deletions(-) create mode 100644 src/ExternLib/IsNaN/CMakeLists.txt create mode 100644 src/ExternLib/IsNaN/IsNaN.hh create mode 100644 src/ExternLib/IsNaN/IsNan.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 49a30ed..545e743 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,6 +184,7 @@ add_subdirectory(src/ExternLib/Shue) add_subdirectory(src/ExternLib/StatisticFunctions) add_subdirectory(src/ExternLib/Fix) add_subdirectory(src/ExternLib/Ceil) +add_subdirectory(src/ExternLib/IsNaN) add_subdirectory(src/ExternLib/Floor) add_subdirectory(src/ExternLib/Sign) add_subdirectory(src/ExternLib/ttcat_to_param) diff --git a/src/ExternLib/IsNaN/CMakeLists.txt b/src/ExternLib/IsNaN/CMakeLists.txt new file mode 100644 index 0000000..67b2f34 --- /dev/null +++ b/src/ExternLib/IsNaN/CMakeLists.txt @@ -0,0 +1,23 @@ + +PROJECT(IsNaN) + +set(LIBRARY_OUTPUT_PATH ${PLUGIN_OUTPUT_PATH}/IsNaN) + +include_directories( +) + +#Library configuration +file( + GLOB_RECURSE + source_files + ./* +) + +ADD_LIBRARY( IsNaN SHARED ${source_files} ) + +target_link_libraries( + IsNaN +) + +FILE( GLOB_RECURSE PROJ_HEADERS *.hh ) +INSTALL(FILES ${PROJ_HEADERS} DESTINATION ${LIBRARY_OUTPUT_PATH} PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) diff --git a/src/ExternLib/IsNaN/IsNaN.hh b/src/ExternLib/IsNaN/IsNaN.hh new file mode 100644 index 0000000..fb372aa --- /dev/null +++ b/src/ExternLib/IsNaN/IsNaN.hh @@ -0,0 +1,36 @@ +/** + * + * Created on: 18 jun. 2024 + * Author: AKKODIS - Furkan + */ + + +#ifndef ISNAN_HH_ +#define ISNAN_HH_ + +#include + +/** + * @bried Checks if el is a NaN + */ +int IsNaN(const float& el); + +int IsNaN(const double& el); + +int IsNaN(const long double& el); + +int IsNaN(const int& el); + +int IsNaN(const short& el); + +std::vector IsNaN(const std::vector& el); + +std::vector IsNaN(const std::vector& el); + +std::vector IsNaN(const std::vector& el); + +std::vector IsNaN(const std::vector& el); + +std::vector IsNaN(const std::vector& el); + +#endif /* ISNAN_HH_ */ diff --git a/src/ExternLib/IsNaN/IsNan.cc b/src/ExternLib/IsNaN/IsNan.cc new file mode 100644 index 0000000..1b67908 --- /dev/null +++ b/src/ExternLib/IsNaN/IsNan.cc @@ -0,0 +1,66 @@ +/** + * + * + * Created on: 18 jun. 2024 + * Author: AKKODIS - Furkan + */ + +#include "IsNaN.hh" + +#include + + +template +int _isNaN(const Type& el) { + double dEl = (double)el; + return (int)std::isnan(dEl); +} + +template +std::vector _isNaN(const std::vector& el) { + std::vector result; + for (typename std::vector::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 IsNaN(const std::vector& el) { + return _isNaN(el); +} + +std::vector IsNaN_(const std::vector& el) { + return _isNaN(el); +} + +std::vector IsNaN_(const std::vector& el) { + return _isNaN(el); +} + +std::vector IsNaN_(const std::vector& el) { + return _isNaN(el); +} + +std::vector IsNaN_(const std::vector& el) { + return _isNaN(el); +} -- libgit2 0.21.2