Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:12

0001 // Copyright 2022 Hans Dembinski, Jay Gohil
0002 //
0003 // Distributed under the Boost Software License, Version 1.0.
0004 // (See accompanying file LICENSE_1_0.txt
0005 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_HISTOGRAM_DETAIL_NORMAL_HPP
0008 #define BOOST_HISTOGRAM_DETAIL_NORMAL_HPP
0009 
0010 #include <boost/histogram/detail/erf_inv.hpp>
0011 #include <cmath>
0012 
0013 namespace boost {
0014 namespace histogram {
0015 namespace detail {
0016 
0017 inline double normal_cdf(double x) noexcept {
0018   return std::fma(0.5, std::erf(x / std::sqrt(2)), 0.5);
0019 }
0020 
0021 inline double normal_ppf(double p) noexcept {
0022   return std::sqrt(2) * erf_inv(2 * (p - 0.5));
0023 }
0024 
0025 } // namespace detail
0026 } // namespace histogram
0027 } // namespace boost
0028 
0029 #endif