Marty,
I suggest that you create an operating system independent interface and
then implement it in each of the OS specific directories under
src/include/os in R3.13. I suspect that you have already made similar
changes in R3.14?
Jeff
> -----Original Message-----
> From: Marty Kraimer [mailto:[email protected]]
> Sent: Wednesday, April 10, 2002 9:55 AM
> To: [email protected]
> Subject: NAN and INF
>
> Recently Timo Korhonen mentioned a problem caused by the calcoutRecord
> passing
> on a NaN value to other records. Recently we saw something that we
> suspect was
> caused by something generating either a NAN or an INF. The latest 3.13
> known
> problems describes a fix for the calcOutRecord (and calcPerform) that
> fixes the
> NAN problem. We are still not handling the INF problem.
>
> Let me first give a brief discussion of NAN and INF. The IEEE floating
> point
> standard defines the concept of NAN (not a number) and INF (infinity).
> For each
> the exponent portion of the number has a unique bit pattern (normally
> all 1s), A
> NAN has a nonzero significand and an INF has a zero significand. A NAN
> is
> generated for invalid operations like 0/0. An INF is generated for
> exponent
> overflow.
>
> Part of the solution to the NAN problem Timo discovered was to make
the
> following change to calcPerform
>
> diff -r1.31.6.1 calcPerform.c
> 104a105,106
> > #include <private/mathP.h> /* For isNan*/
> > #define isnan isNan
> 517c519
> < return(0);
> ---
> > return((isnan(*presult) ? -1 : 0));
>
> Thus a error is returned in calcPerform calculates a NAN. It looks
like
> a
> solution for both NAN and INF is to change the return to
>
> return(((isnan(*presult)||isinf(*presult)) ? -1 : 0));
>
>
> PROBLEM:
>
> This assumes that isnan and isinf are provided on all platforms that
> epics supports.
>
> Both isnan and isinf are defined as part of the ISO C standard from
1999.
> They are supported on redhat 7.2 linux. They are not supported on
> vxWorks 5.4 or
> on solaris 8. Not suprising considering the 1999 date.
>
> The following are diffs that allow me to compile 3.13 calcPerform on
> solaris,
> vxWorks, and linux redhat 7.2
>
> > #include <stddef.h>
> 119a115,128
> > #ifdef vxWorks
> > #include <vxWorks.h>
> > #include <private/mathP.h> /* For isNan*/
> > #define isnan isNan
> > #define isinf isInf
> > #endif
> >
> > #ifdef SOLARIS
> > #define __EXTENSIONS__
> > #include <limits.h>
> > #define isinf(D) \
> > ((fabs((D))>DBL_MAX || fabs((D))<DBL_MIN) ? 1 : 0)
> > #endif
> >
> 519c528
> < return(0);
> ---
> > return(((isnan(*presult)||isinf(*presult)) ? -1 : 0));
>
>
> This is REALLY ugly. Worse what about HPUX, WINxx, and earlier
releases
> of
> Solaris and Linux?
>
> What to do??????
>
> Marty Kraimer
- Replies:
- Re: NAN and INF Marty Kraimer
- References:
- NAN and INF Marty Kraimer
- Navigate by Date:
- Prev:
NAN and INF Marty Kraimer
- Next:
Re: NAN and INF Marty Kraimer
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
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:
NAN and INF Marty Kraimer
- Next:
Re: NAN and INF Marty Kraimer
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|