Skip to content

Commit

Permalink
sqrt -> std::sqrt (#4490)
Browse files Browse the repository at this point in the history
Unlike std::sqrt that has overloads for double and float, sqrt is a C
function that takes a double. If the argument is a float, it will have to be
promoted to double first.
  • Loading branch information
WeiqunZhang authored Dec 10, 2023
1 parent 044ab29 commit 1025370
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Initialization/InjectorMomentum.H
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ struct InjectorMomentumBoltzmann
for (auto& el : u) el = 0.0_rt;
const amrex::Real beta = velocity(x,y,z);
int const dir = velocity.direction();
const auto gamma = static_cast<amrex::Real>(1._rt/sqrt(1._rt-beta*beta));
const auto gamma = 1._rt/std::sqrt(1._rt-beta*beta);
u[dir] = gamma*beta;
return amrex::XDim3 {u[0],u[1],u[2]};
}
Expand Down Expand Up @@ -444,7 +444,7 @@ struct InjectorMomentumJuttner
for (auto& el : u) el = 0.0_rt;
amrex::Real const beta = velocity(x,y,z);
int const dir = velocity.direction();
auto const gamma = static_cast<amrex::Real>(1._rt/sqrt(1._rt-beta*beta));
auto const gamma = 1._rt/std::sqrt(1._rt-beta*beta);
u[dir] = gamma*beta;
return amrex::XDim3 {u[0],u[1],u[2]};
}
Expand Down

0 comments on commit 1025370

Please sign in to comment.