22
33// Copyright John Maddock 2006.
44// Copyright Paul A. Bristow 2006.
5+ // Copyright Matt Borland 2023.
56
67// Use, modification and distribution are subject to the
78// Boost Software License, Version 1.0.
@@ -241,7 +242,7 @@ namespace boost
241242 {
242243 return result;
243244 }
244- return ibeta_inva (beta, x, probability, Policy ());
245+ return static_cast <RealType>( ibeta_inva (beta, x, probability, Policy () ));
245246 } // RealType find_alpha(beta, a, probability)
246247
247248 static RealType find_beta (
@@ -264,7 +265,7 @@ namespace boost
264265 {
265266 return result;
266267 }
267- return ibeta_invb (alpha, x, probability, Policy ());
268+ return static_cast <RealType>( ibeta_invb (alpha, x, probability, Policy () ));
268269 } // RealType find_beta(alpha, x, probability)
269270
270271 private:
@@ -396,7 +397,7 @@ namespace boost
396397 {
397398 if (a == 1 )
398399 {
399- return 1 / beta (a, b);
400+ return static_cast <RealType>( 1 / beta (a, b) );
400401 }
401402 else if (a < 1 )
402403 {
@@ -411,7 +412,7 @@ namespace boost
411412 {
412413 if (b == 1 )
413414 {
414- return 1 / beta (a, b);
415+ return static_cast <RealType>( 1 / beta (a, b) );
415416 }
416417 else if (b < 1 )
417418 {
@@ -423,7 +424,7 @@ namespace boost
423424 }
424425 }
425426
426- return ibeta_derivative (a, b, x, Policy ());
427+ return static_cast <RealType>( ibeta_derivative (a, b, x, Policy () ));
427428 } // pdf
428429
429430 template <class RealType , class Policy >
@@ -454,7 +455,7 @@ namespace boost
454455 {
455456 return 1 ;
456457 }
457- return ibeta (a, b, x, Policy ());
458+ return static_cast <RealType>( ibeta (a, b, x, Policy () ));
458459 } // beta cdf
459460
460461 template <class RealType , class Policy >
@@ -481,16 +482,16 @@ namespace boost
481482 }
482483 if (x == 0 )
483484 {
484- return 1 ;
485+ return RealType ( 1 ) ;
485486 }
486487 else if (x == 1 )
487488 {
488- return 0 ;
489+ return RealType ( 0 ) ;
489490 }
490491 // Calculate cdf beta using the incomplete beta function.
491492 // Use of ibeta here prevents cancellation errors in calculating
492493 // 1 - x if x is very small, perhaps smaller than machine epsilon.
493- return ibetac (a, b, x, Policy ());
494+ return static_cast <RealType>( ibetac (a, b, x, Policy () ));
494495 } // beta cdf
495496
496497 template <class RealType , class Policy >
@@ -519,13 +520,13 @@ namespace boost
519520 // Special cases:
520521 if (p == 0 )
521522 {
522- return 0 ;
523+ return RealType ( 0 ) ;
523524 }
524525 if (p == 1 )
525526 {
526- return 1 ;
527+ return RealType ( 1 ) ;
527528 }
528- return ibeta_inv (a, b, p, static_cast <RealType*>(nullptr ), Policy ());
529+ return static_cast <RealType>( ibeta_inv (a, b, p, static_cast <RealType*>(nullptr ), Policy () ));
529530 } // quantile
530531
531532 template <class RealType , class Policy >
@@ -555,14 +556,14 @@ namespace boost
555556 // Special cases:
556557 if (q == 1 )
557558 {
558- return 0 ;
559+ return RealType ( 0 ) ;
559560 }
560561 if (q == 0 )
561562 {
562- return 1 ;
563+ return RealType ( 1 ) ;
563564 }
564565
565- return ibetac_inv (a, b, q, static_cast <RealType*>(nullptr ), Policy ());
566+ return static_cast <RealType>( ibetac_inv (a, b, q, static_cast <RealType*>(nullptr ), Policy () ));
566567 } // Quantile Complement
567568
568569 } // namespace math
0 commit comments