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
|
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test numeric_limits
// float_round_style
#include <limits>
typedef char one;
struct two {one _[2];};
one test(std::float_round_style);
two test(int);
int main()
{
static_assert(std::round_indeterminate == -1,
"std::round_indeterminate == -1");
static_assert(std::round_toward_zero == 0,
"std::round_toward_zero == 0");
static_assert(std::round_to_nearest == 1,
"std::round_to_nearest == 1");
static_assert(std::round_toward_infinity == 2,
"std::round_toward_infinity == 2");
static_assert(std::round_toward_neg_infinity == 3,
"std::round_toward_neg_infinity == 3");
static_assert(sizeof(test(std::round_to_nearest)) == 1,
"sizeof(test(std::round_to_nearest)) == 1");
static_assert(sizeof(test(1)) == 2,
"sizeof(test(1)) == 2");
}
|