1 // Copyright John Maddock 2007. 2 // Copyright Paul A. Bristow 2010. 3 // Use, modification and distribution are subject to the 4 // Boost Software License, Version 1.0. (See accompanying file 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 7 // Note that this file contains quickbook mark-up as well as code 8 // and comments, don't change any of the special comment mark-ups! 9 10 #ifdef _MSC_VER 11 # pragma warning (disable : 4305) // 'initializing' : truncation from 'long double' to 'const eval_type' 12 # pragma warning (disable : 4244) // 'conversion' : truncation from 'long double' to 'const eval_type' 13 #endif 14 15 //[policy_ref_snip4 16 17 #include <boost/math/distributions/normal.hpp> 18 using boost::math::normal_distribution; 19 20 using namespace boost::math::policies; 21 22 // Define a policy: 23 typedef policy< 24 promote_float<false> 25 > my_policy; 26 27 // Define the new normal distribution using my_policy: 28 typedef normal_distribution<float, my_policy> my_norm; 29 30 // Get a quantile: 31 float q = quantile(my_norm(), 0.05f); 32 33 //] [policy_ref_snip4] 34 35 #include <iostream> 36 using std::cout; using std::endl; 37 main()38int main() 39 { 40 cout << " quantile(my_norm(), 0.05f) = " << q << endl; // -1.64485 41 } 42