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 | 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 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: NaN and analog records |
From: | Dirk Zimoch <[email protected]> |
To: | [email protected] |
Date: | Wed, 05 Nov 2014 14:43:04 +0100 |
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 DM2Kwhichwrites 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