zephyrproject-rtos / zscilib

An open-source scientific computing library for embedded systems running Zephyr OS or standalone.
https://zephyrproject-rtos.github.io/zscilib/
Apache License 2.0
141 stars 27 forks source link

vectors: if statement always true #48

Open ruehlchris opened 1 year ago

ruehlchris commented 1 year ago

https://github.com/zephyrproject-rtos/zscilib/blob/0035be5e6a45e4ab89755b176d305d7a877fc79c/src/vectors.c#L487

The if statement will return always true if (x>=1E-5 || x<=1E-5) and as no logical effect

the correct code might be: if (v->data[j] >= 1E-5 || v->data[j] <= -1E-5) to ensure v->data[j] is not smaller then the epsilon range.