1 // Copyright (c) 2012 Robert Ramey 2 // 3 // Distributed under the Boost Software License, Version 1.0. (See 4 // accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 // testing floating point 8 9 // this is a compile only test - but since many build systems 10 // can't handle a compile-only test - make sure it passes trivially. 11 #include <cassert> 12 #include <boost/safe_numerics/safe_integer.hpp> 13 14 template<typename T, typename U> test()15void test(){ 16 T t; 17 U u; 18 float x = t; 19 t = x; 20 t + u; 21 t - u; 22 t * u; 23 t / u; 24 /**/ 25 // the operators below are restricted to integral types 26 } main()27int main(){ 28 using namespace boost::safe_numerics; 29 /* 30 test<safe<std::int8_t>, float>(); 31 test<safe<std::int16_t>,float>(); 32 test<safe<std::int32_t>, float>(); 33 test<safe<std::int64_t>, float>(); 34 */ 35 return 0; 36 } 37