text
stringlengths 0
2.2M
|
---|
#ifdef SWAP
|
ASSERT(false && "SWAP still declared");
|
#endif
|
} break;
|
case 3: {
|
// --------------------------------------------------------------------
|
// SIMPLE FUNCTION CALL TESTS
|
// Ensure that we can call functions expected in the Intel DFP
|
// library, and that the ones we call behave reasonably.
|
//
|
// Concerns:
|
//: 1 Intel function prototypes are declared, and are available for
|
//: use.
|
//
|
// Plan:
|
//: 1 Declare variables of the various 'BID_UINTXX' types and call
|
//: some initialization for them. (C-1)
|
//:
|
//: 2 Compute a simple arithmetic sum for some 'BID_UINTXX' variables.
|
//: (C-1)
|
//:
|
//: 3 Verify the results of the simple arithmetic computation. (C-1)
|
//
|
// Testing:
|
// Simple function call tests
|
// --------------------------------------------------------------------
|
if (verbose) cout << std::endl
|
<< "SIMPLE FUNCTION CALL TESTS" << std::endl
|
<< "==========================" << std::endl;
|
BID_UINT64 doubleDecimal = __bid64_from_int32( 42);
|
BID_UINT128 quadDecimal = __bid128_from_int32(42);
|
BID_UINT32 singleDecimal2 = __bid32_from_int32( 10, &flags);
|
BID_UINT64 doubleDecimal2 = __bid64_from_int32( 10);
|
BID_UINT128 quadDecimal2 = __bid128_from_int32(10);
|
BID_UINT64 doubleDecimalResult = __bid64_from_int32( 52);
|
BID_UINT128 quadDecimalResult = __bid128_from_int32(52);
|
BID_UINT64 doubleDecimalComputed;
|
BID_UINT128 quadDecimalComputed;
|
(void) singleDecimal2;
|
doubleDecimalComputed = __bid64_add( doubleDecimal,
|
doubleDecimal2,
|
&flags);
|
quadDecimalComputed = __bid128_add(
|
quadDecimal,
|
quadDecimal2,
|
&flags);
|
ASSERT(__bid64_quiet_equal( doubleDecimalResult,
|
doubleDecimalComputed,
|
&flags));
|
ASSERT(__bid128_quiet_equal( quadDecimalResult,
|
quadDecimalComputed,
|
&flags));
|
} break;
|
case 2: {
|
// --------------------------------------------------------------------
|
// INTEL DECIMAL TYPES SANITY TEST
|
// Ensure that we can call instantiate variables from the Intel
|
// libary.
|
//
|
// Concerns:
|
//: 1 Intel Decimal types are declared, and are available for use.
|
//
|
// Plan:
|
//: 1 Declare variables of the various 'BID_UINTXX' types and call
|
//: some initialization for them. (C-1)
|
//:
|
//: 2 Call 'memcmp' on differently initialized variables to verify
|
//: that their representations are distinct. (C-1)
|
//
|
// Testing:
|
// Intel Decimal types sanity test
|
// --------------------------------------------------------------------
|
if (verbose) cout << std::endl
|
<< "INTEL DECIMAL TYPES SANITY TEST" << std::endl
|
<< "===============================" << std::endl;
|
// The intel library types work correctly if different values have
|
// different bit patterns.
|
BID_UINT32 singlePrecisionDecimalStorage = __bid32_from_int32( 42,
|
&flags);
|
BID_UINT64 doublePrecisionDecimalStorage = __bid64_from_int32( 42);
|
BID_UINT128 quadPrecisionDecimalStorage = __bid128_from_int32(42);
|
BID_UINT32 singlePrecisionDecimalStorage2 = __bid32_from_int32( 47,
|
&flags);
|
BID_UINT64 doublePrecisionDecimalStorage2 = __bid64_from_int32( 47);
|
BID_UINT128 quadPrecisionDecimalStorage2 = __bid128_from_int32(47);
|
ASSERT(bsl::memcmp(&singlePrecisionDecimalStorage,
|
&singlePrecisionDecimalStorage2,
|
sizeof(BID_UINT32)));
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.