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: | Calculation in SNL/SEQ |
From: | "liuping" <[email protected]> |
To: | <[email protected]> |
Date: | Wed, 11 May 2011 10:35:11 +0800 |
Hello, I need your help about the calculation in SNL/SEQ. In my SNL/SEQ application, I need to execute the mathematical
operation: fabs() and exp(). Here is the codes abstracted from the my application: %%///////////////////// double temp; double err; double r1; double r2; ss test123{ state
calctest {
when(delay(2))
{
r1=1.0;
r2=2.0;
temp=fabs(r1-r2);
printf("fabs: %lf\n",temp);
temp=exp(r1+r2);
printf("exp: %lf\n", temp);
} state calctest }
} %%////////////////////////// The operation result is: fabs: 1.000000 exp: 2287528.000000 fabs: 1.000000 exp: 2287528.000000 fabs: 1.000000 exp: 2287528.000000 …… Obviously, the result of “fabs” is right,
and the other is wrong. Then I check the output of compiler. There are two
warning and no error (see the bold and incline words). ..... make[3]: Entering directory
`/home/blctrl/watercool-Mono/motorApp/OmsSrc/O.vxWorks-ppc604_long' converting ../sncExample.stt /home/blctrl/seq- mv sncExample.c.tmp sncExample.c /BLC/epics/Tornado2.2/host/x86-linux/bin/ccppc
-c -D_POSIX_SOURCE
-DCPU=PPC604 -DvxWorks -include
/BLC/epics/Tornado2.2/target/h/vxWorks.h -ansi -O3
-Wall -mcpu=604 -mstrict-align
-mlongcall -fno-builtin - ../sncExample.stt: In
function `A_test123_calctest': ../sncExample.stt:38:
warning: implicit declaration of function `fabs' ../sncExample.stt:40:
warning: implicit declaration of function `exp' perl /BLC/epics/base/bin/linux-x86/registerRecordDeviceDriver.pl
../O.Common/omsMAXv.dbd omsMAXv_registerRecordDeviceDriver > temp.cpp mv temp.cpp
omsMAXv_registerRecordDeviceDriver.cpp ..... Again, I tried to do such process: 1)Power off the VME rack, 2)Change
the value of r1 and r2: r1=9.0; r2=12.0; 3)make clean 4)make 5)Power on the VME rack Sadly I saw the result was same to last test: fabs: 1.000000 exp: 2287528.000000 fabs: 1.000000 exp: 2287528.000000 fabs: 1.000000 exp: 2287528.000000 …… The result of “fabs” and “exp”
are both wrong. Who can tell me the reason and how to get the right result? Any advices are appreciated! =================================== LIU Beamline Control Group http://ssrf.sinap.ac.cn |