diff --git a/src/math_functions.cpp b/src/math_functions.cpp index 9cd52096df..179c028db2 100644 --- a/src/math_functions.cpp +++ b/src/math_functions.cpp @@ -685,7 +685,7 @@ void rotate_angle_c(double uvw[3], const double mu, double* phi) { w0 = uvw[2]; // Sample azimuthal angle in [0,2pi) if none provided - if (phi != NULL) { + if (phi != nullptr) { phi_ = (*phi); } else { phi_ = 2. * PI * prn(); @@ -694,8 +694,8 @@ void rotate_angle_c(double uvw[3], const double mu, double* phi) { // Precompute factors to save flops sinphi = std::sin(phi_); cosphi = std::cos(phi_); - a = std::sqrt(std::max(0., 1. - mu * mu)); - b = std::sqrt(std::max(0., 1. - w0 * w0)); + a = std::sqrt(std::fmax(0., 1. - mu * mu)); + b = std::sqrt(std::fmax(0., 1. - w0 * w0)); // Need to treat special case where sqrt(1 - w**2) is close to zero by // expanding about the v component rather than the w component diff --git a/src/math_functions.h b/src/math_functions.h index 431e9ddeeb..fbebd7dd7b 100644 --- a/src/math_functions.h +++ b/src/math_functions.h @@ -73,7 +73,7 @@ extern "C" void calc_zn_c(const int n, const double rho, const double phi, //============================================================================== extern "C" void rotate_angle_c(double uvw[3], const double mu, - double* phi=NULL); + double* phi=nullptr); //============================================================================== // MAXWELL_SPECTRUM samples an energy from the Maxwell fission distribution