EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: calc/calcout and NAN
From: Marty Kraimer <[email protected]>
To: Korhonen Timo <[email protected]>
Cc: [email protected]
Date: Tue, 26 Mar 2002 10:44:26 -0600
Korhonen Timo wrote:

Hello all,

I was implementing some calculations with calcout records and
faced the following problem: with certain input values, the
result from the formula is NAN (not a number.) However, there
is no indication from the record itself that something is wrong.
(medm can display an INF but does not react to NAN.)

I would like to be able to raise an alarm (INVALID) if the result
from the calculation is NAN (at least, and maybe also for INF).

A quick try to modify the return from calcPerform (libCom/calc/calPerform.c)so that

instead of (line 514)

return(0);

I made a simple check:

return(isnan(*presult));

and that seemed to give the effect that I wanted.

Does this look like a reasonable thing to do?

Timo



This sounds like a good solution.

A couple of details.



I do not find isnan defined in our version of vxWorks. Instead I find isNan.

How did you get calcPerform to build on vxWorks and also load without undefined symbols?

Thus for 3.13 the following builds


mercury% cvs diff -c calcPerform.c Index: calcPerform.c =================================================================== RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/libCom/Attic/calcPerform.c,v retrieving revision 1.31.6.1 diff -c -r1.31.6.1 calcPerform.c *** calcPerform.c 2000/08/09 13:51:08 1.31.6.1 --- calcPerform.c 2002/03/26 15:57:17 *************** *** 102,107 **** --- 102,109 ----


#ifdef vxWorks #include <vxWorks.h> + #include <private/mathP.h> /* For isNan*/ + #define isnan isNan #endif

  #include      <stdlib.h>
***************
*** 514,520 ****
                *presult = *pstacktop;
        else
                return(-1);
!       return(0);
  }



--- 516,522 ----
                *presult = *pstacktop;
        else
                return(-1);
!       return(isnan(*presult));
  }


Then on solaris I get


"../calcPerform.c", line 519: warning: implicitly declaring function to return int: isnan()


I dont know why because calcPerform includes math.h.


For 3.14 I just use epicsMath which defines epicsIsNAN

Does anyone have any comments?

Marty Kraimer


Replies:
Re: calc/calcout and NAN Korhonen Timo
References:
calc/calcout and NAN Korhonen Timo

Navigate by Date:
Prev: calc/calcout and NAN Korhonen Timo
Next: Re: calc/calcout and NAN Korhonen Timo
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: calc/calcout and NAN Korhonen Timo
Next: Re: calc/calcout and NAN Korhonen Timo
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·