summaryrefslogtreecommitdiff
path: root/asl/base/float.hpp
blob: bd5e3c4178835d4a1a07c249618c3734b1a8184c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2025 Steven Le Rouzic
//
// SPDX-License-Identifier: BSD-3-Clause

#pragma once

#include "asl/base/meta.hpp"

namespace asl
{

template<is_floating_point T> constexpr T infinity() { return __builtin_inf(); }

template<is_floating_point T> constexpr T nan() { return static_cast<T>(__builtin_nanf("")); }

template<is_floating_point T> constexpr bool is_infinity(T f) { return __builtin_isinf(f); }

template<is_floating_point T> constexpr bool is_nan(T f) { return __builtin_isnan(f); }

} // namespace asl