libc: minimal: math: Removed undefined behavior in sqrt routines

Fixed a clang config warning.

Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
This commit is contained in:
Lars-Ove Karlsson 2024-09-26 17:32:28 +02:00 committed by Fabio Baltieri
commit 8fceb6421f
2 changed files with 2 additions and 0 deletions

View file

@ -27,6 +27,7 @@ double sqrt(double square)
int64double_t root; int64double_t root;
int64double_t last; int64double_t last;
int64double_t p_square; int64double_t p_square;
p_square.d = square; p_square.d = square;
if (square == 0.0) { if (square == 0.0) {

View file

@ -27,6 +27,7 @@ float sqrtf(float square)
intfloat_t root; intfloat_t root;
intfloat_t last; intfloat_t last;
intfloat_t p_square; intfloat_t p_square;
p_square.f = square; p_square.f = square;
if (square == 0.0f) { if (square == 0.0f) {