On 04.11.2014 14:37, [email protected] wrote:
From: Ralph Lange [mailto:[email protected]]
Comparisons between numbers and non-numbers (such as NaN) are
undefined.
Not quite: comparisons involving NaN are defined to always return false. This means that a test of the form
if (prec->drvl <= value && value <= prec->drvh)
// accept value
else
// reject value
would have the desired effect (and setting a drv limit would cause all values to be rejected!)
Note that the intent of DRVH and DRVL is not to reject values but to
truncate the range. So a value larger than DRVH is not ignored but
replaced by DRVH. As argued before, NaN is never larger than DRVH, thus
the value is accepted.
Dirk
What is your suggestion on how to check limits for a non-number without
using comparisons?
We also found that you can type "NaN" at any entry field in DM2K
which
writes NaN directly to the PV.
NaN, -inf and +inf are valid values for a double. Why would you reject
entering valid values in entry fields?
Cheers,
~Ralph
- References:
- NaN and analog records Benjamin Franksen
- Re: NaN and analog records Goetz Pfeiffer
- Re: NaN and analog records Ralph Lange
- RE: NaN and analog records michael.abbott
- Navigate by Date:
- Prev:
Re: Record processing during iocInit? Dirk Zimoch
- Next:
Job opening at PSI (Control System Specialist/Software developer) Celcer Tine
- 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:
RE: NaN and analog records michael.abbott
- Next:
Re: NaN and analog records Ralph Lange
- 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
|