Skip to content

Commit b210e7d

Browse files
Added optimizations (/ to sqrt)
1 parent 4006d03 commit b210e7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/gravity/octree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ inline void bhAccel(Octree* node, const Particle& p, real theta,
115115
// Correct Barnes–Hut acceptance criterion
116116
if (node->leaf || (node->size / dist) < theta)
117117
{
118-
real invDist = real(1) / dist;
119-
real invDist3 = invDist * invDist * invDist;
118+
real invDist = std::sqrt(real(1.0) / distSq);
119+
real invDist3 = invDist * invDist * invDist;
120120

121121
real fac = G * node->m * invDist3;
122122

0 commit comments

Comments
 (0)