Skip to content

Commit

Permalink
Per #3024, return bad data for the square root of a negative number
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Nov 22, 2024
1 parent cad8be5 commit 28091e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/basic/vx_math/is_bad_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ inline double square(double v) {
}

inline double square_root(double v) {
return (is_bad_data(v) ? bad_data_double : sqrt(v));
return (is_bad_data(v) || v < 0 ? bad_data_double : sqrt(v));
}


Expand Down

0 comments on commit 28091e3

Please sign in to comment.