LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How code smallest number EPS?

Hello,
I am compiling C-code using LabWindows/CVI for use as a shared library in LabVIEW on a PXI real-time target. In my C-code, I need to initialize some variables with a very small number to avoid divide by zero problems.

Is there a constant defined in one of the header files referenced by ansi_c.h that I can use? It is usually referred to as EPS, but that doesn't seem to be recognized by the compiler.

Thanks in advance,
Frenk
0 Kudos
Message 1 of 4
(3,274 Views)
Hello

You might be looking for DBL_EPSILON or FLT_EPSILON ,which is defined as smallest x so 1.0 + x != 1.0

You will need to include float.h for this. Check out this link for more info.

Hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 4
(3,274 Views)
Great!
Thank you,
Frenk
0 Kudos
Message 3 of 4
(3,274 Views)
FYI,

Here is some cool code that calculates EPS and some other special characters of doubles.

Enjoy,

Juan Carlos
N.I.
0 Kudos
Message 4 of 4
(3,274 Views)