Skip to content

Commit

Permalink
optimize per comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinf2 committed Nov 22, 2024
1 parent c0d330c commit 33e27de
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cpp/src/glm/qn/mg/standardization.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ void vars(const raft::handle_t& handle,
T scaled_m = weight * m * m;
T diff = v - scaled_m;
// avoid negative variance that is due to precision loss of floating point arithmetic
if (diff < 0) { diff += scaled_m; }
return diff;
return diff >= 0. ? diff : v;
},
stream);
}
Expand Down

0 comments on commit 33e27de

Please sign in to comment.