Skip to content

Commit

Permalink
libc: minimal: math: Removed undefined behavior in sqrt routines
Browse files Browse the repository at this point in the history
Fixed a clang config warning.

Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
  • Loading branch information
LoveKarlsson authored and fabiobaltieri committed Sep 30, 2024
1 parent 0a8e1ad commit 8fceb64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/libc/minimal/source/math/sqrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ double sqrt(double square)
int64double_t root;
int64double_t last;
int64double_t p_square;

p_square.d = square;

if (square == 0.0) {
Expand Down
1 change: 1 addition & 0 deletions lib/libc/minimal/source/math/sqrtf.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ float sqrtf(float square)
intfloat_t root;
intfloat_t last;
intfloat_t p_square;

p_square.f = square;

if (square == 0.0f) {
Expand Down

0 comments on commit 8fceb64

Please sign in to comment.