Bugzilla – Bug 1786
os << int64x64_t prints un-normalized fractional values
Last modified: 2014-03-02 04:09:59 EST
int64x64_t val = 5.6;
std::cout << val << std::endl;
The output streamer in int64x64.cc fails to normalize the fractional part.
This passes tests because the un-normalized value is hard-coded as the correct result.
[Bug 1786] Fix for os << (int64x64_t) and fractional arithmetic
Arithmetic with fractions was never tested and it had lots of bugs.
This patch set:
- Defines many more tests, giving complete coverage of all operations
(signed/unsigned, integer, fractions, mixed)
- Replaces over-generous #define creation of functions with minimal
set of C++ functions.
- Minimizes differences between implementations.
- Documents all functions.
int128 and cairo implementations agree exactly on all int64x64 tests,
and pass all ns-3 tests.
long double implementation agrees with the other two on most int64x64
tests; failures have to do with less precision in long doubles.
The prior double implementation failed five ns-3 tests:
This implementation fails routing-olsr-regression because of single
bit differences in the pcap files.
introduced an error: when "cairo_impl64" is not declared (perhaps because you don't have cairo headers), compilation fails:
../src/core/test/int64x64-test-suite.cc:819:41: error: use of undeclared identifier 'cairo_impl64'
std::cout << "cairo_impl64: " << cairo_impl64 << std::endl;
../src/core/test/int64x64-test-suite.cc:820:41: error: use of undeclared identifier 'cairo_impl128'
std::cout << "cairo_impl128: " << cairo_impl128 << std::endl;
2 errors generated.
Waf: Leaving directory `/Users/pecos/Development/workspace/ns-3-dev/build'
Fixed in changeset 10611 5390474ca6b7
Fixed again in
Patch r10637 67601c471c22