Home | History | Annotate | Download | only in denorm.style
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // test numeric_limits
     11 
     12 // float_round_style
     13 
     14 #include <limits>
     15 
     16 typedef char one;
     17 struct two {one _[2];};
     18 
     19 one test(std::float_round_style);
     20 two test(int);
     21 
     22 int main()
     23 {
     24     static_assert(std::round_indeterminate == -1,
     25                  "std::round_indeterminate == -1");
     26     static_assert(std::round_toward_zero == 0,
     27                  "std::round_toward_zero == 0");
     28     static_assert(std::round_to_nearest == 1,
     29                  "std::round_to_nearest == 1");
     30     static_assert(std::round_toward_infinity == 2,
     31                  "std::round_toward_infinity == 2");
     32     static_assert(std::round_toward_neg_infinity == 3,
     33                  "std::round_toward_neg_infinity == 3");
     34     static_assert(sizeof(test(std::round_to_nearest)) == 1,
     35                  "sizeof(test(std::round_to_nearest)) == 1");
     36     static_assert(sizeof(test(1)) == 2,
     37                  "sizeof(test(1)) == 2");
     38 }
     39