-
-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathnanoPAL_NativeDouble.h
68 lines (52 loc) · 1.41 KB
/
nanoPAL_NativeDouble.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// Copyright (c) .NET Foundation and Contributors
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#ifndef NANOPAL_DOUBLE_DECL_H
#define NANOPAL_DOUBLE_DECL_H
#include <nanoHAL.h>
#include <math.h>
#ifdef VIRTUAL_DEVICE
#include <float.h>
#define __isnand _isnan
#define __isnanf _isnan
#define __isinfd(x) (!_finite(x))
inline int __signbitd(double x)
{
unsigned char *ptr = (unsigned char *)&x;
return (*(ptr + (sizeof(double) - 1)) & 0x80) != 0;
}
#define rint(x) floor((x) + 0.5)
#define remainder(x, y) ((x) - ((y) * rint((x) / (y))))
#define isgreater(param0, param1) (param0 > param1)
#define isless(param0, param1) (param0 < param1)
#elif defined(__GNUC__)
#if !defined(isgreater)
#define isgreater __builtin_isgreater
#endif
#if !defined(isless)
#define isless __builtin_isless
#endif
#if !defined(__isnand)
#define __isnand __builtin_isnan
#endif
#if !defined(__isinfd)
#define __isinfd __builtin_isinf
#endif
#if !defined(__signbitd)
#define __signbitd __builtin_signbit
#endif
#endif
namespace System
{
struct Double
{
static int32_t CompareTo(double d, double val);
static bool IsInfinity(double d);
static bool IsNaN(double d);
static bool IsNegativeInfinity(double d);
static bool IsPositiveInfinity(double d);
};
} // namespace System
#endif // NANOPAL_DOUBLE_DECL_H