• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- Unittests for fpclassify macro ------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #include "include/llvm-libc-macros/math-function-macros.h"
9 
10 #include <assert.h>
11 
12 // check if macro is defined
13 #ifndef fpclassify
14 #error "fpclassify macro is not defined"
15 #else
main(void)16 int main(void) {
17   assert(fpclassify(1.819f) == FP_NORMAL);
18   assert(fpclassify(-1.726) == FP_NORMAL);
19   assert(fpclassify(1.426L) == FP_NORMAL);
20   assert(fpclassify(-0.0f) == FP_ZERO);
21   assert(fpclassify(0.0) == FP_ZERO);
22   assert(fpclassify(-0.0L) == FP_ZERO);
23   return 0;
24 }
25 #endif
26