Tatooine
nan.h
Go to the documentation of this file.
1#ifndef TATOOINE_NAN_H
2#define TATOOINE_NAN_H
3//==============================================================================
4#include <cmath>
5#include <tatooine/concepts.h>
6#include <tatooine/real.h>
7//==============================================================================
8namespace tatooine {
9//==============================================================================
10template <floating_point Float>
11struct nan_impl;
12template <>
13struct nan_impl<float> {
14 static auto value(const char* arg) { return std::nanf(arg); }
15};
16template <>
18 static auto value(const char* arg) { return std::nan(arg); }
19};
20template <>
21struct nan_impl<long double> {
22 static auto value(const char* arg) { return std::nanl(arg); }
23};
24
25template <floating_point Float = real_number>
26auto nan(const char* arg = "") {
27 return nan_impl<Float>::value(arg);
28}
29//==============================================================================
30} // namespace tatooine
31//==============================================================================
32#endif
T value
Definition: cache_alignment.h:22
Definition: algorithm.h:6
auto nan(const char *arg="")
Definition: nan.h:26
static auto value(const char *arg)
Definition: nan.h:18
static auto value(const char *arg)
Definition: nan.h:14
static auto value(const char *arg)
Definition: nan.h:22
Definition: nan.h:11