EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  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  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: ABS() in calc record
From: "Johnson, Andrew N." <[email protected]>
To: "Laznovsky Michael (PSI)" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tue, 24 May 2016 09:16:12 +0000
Hi Mike,

On May 21, 2016, at 12:43 PM, Laznovsky Michael (PSI) <[email protected]> wrote:
> 
>         case ABS_VAL:
>             if (*ptop < 0.0) *ptop = - *ptop;
>             break;
>  
> In my case, the CALC is "ABS(A*B)", and e.g. A=0 and B<0 results in ABS(-0), which does 
> not satisfy the if() in the code because -0 is NOT less than zero, so the sign is not flipped 
> back to positive.
>  
> Using fabs() instead fixes it (and probably also saves a branch).

Interesting effect; I just committed your fabs() change to the 3.14 branch.

Thanks!

- Andrew





References:
ABS() in calc record Laznovsky Michael (PSI)

Navigate by Date:
Prev: RE:How to disable sequencer output at startup? Touchard Dominique
Next: Re: How to disable sequencer output at startup? Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: ABS() in calc record Laznovsky Michael (PSI)
Next: EPICS V4 Training at Lund Colaboration meeting david.hickin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 15 Jul 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·