Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check if floating point variable has 'normal' values

how can i check if a floating point value is a normal number and does not have any crude states (+-inf, ind, nan, qnan, denormal ...).

Checking for identity with it self seems to work for nan, but the other states?

Sorry - i forgot to mention that I am tied to an C90 Compiler ;(

like image 367
vlad_tepesch Avatar asked Jun 27 '26 00:06

vlad_tepesch


1 Answers

You can use isnormal macro:

#include <math.h>
int isnormal(real-floating x);

There are also isfinite, isinf and isnan macros.

like image 140
ouah Avatar answered Jun 28 '26 20:06

ouah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!