- Techniker
- Posts : 3
Join date : 2012-01-24
simple numerical calculation with variables -need help-
Tue Jan 24, 2012 1:10 am
Hello to everyone.
First, I`m glad that I found this forum. Since a few days i try to make some simple numerical calculations with variables.
For example:
store 10 x
store 5 y
store eval storedVars['x']-storedVars['y'] Z
echo ${Z}
then, I recieve a error in the log: NaN.
Could anybody give me an example for a numerical calculation please.
Best wishes fom the northern part of germany.
Techniker
First, I`m glad that I found this forum. Since a few days i try to make some simple numerical calculations with variables.
For example:
store 10 x
store 5 y
store eval storedVars['x']-storedVars['y'] Z
echo ${Z}
then, I recieve a error in the log: NaN.
Could anybody give me an example for a numerical calculation please.
Best wishes fom the northern part of germany.
Techniker
- Techniker
- Posts : 3
Join date : 2012-01-24
Re: simple numerical calculation with variables -need help-
Tue Jan 24, 2012 5:12 pm
I found the solution myself.
StoreEval javascript{storedVars['x']-storedVars['y']} Z
And the NaN occours only because I didn`t got the value from the html
StoreEval javascript{storedVars['x']-storedVars['y']} Z
And the NaN occours only because I didn`t got the value from the html
Re: simple numerical calculation with variables -need help-
Thu Apr 12, 2012 6:54 pm
Use below code, change operator as per your requirements
- Code:
store |10 | x
store | 5 | y
storeEval | ${x}+${y} | Z
echo | ${Z}
- vlady_1027
- Posts : 1
Join date : 2012-05-12
Re: simple numerical calculation with variables -need help-
Tue Jun 05, 2012 8:46 pm
rohit13 wrote:Use below code, change operator as per your requirements
- Code:
store |10 | x
store | 5 | y
storeEval | ${x}+${y} | Z
echo | ${Z}
Hello,
Store | 10 | x
Store | 5.99 |y
storeEval | ${x}*${y} | Z
echo | ${Z}
I get Z = 59.900000000000006
Could you tell me how can I get Z to be equal 59.90?
Thanks!
- kashyap_guruActive particpant
- Posts : 24
Join date : 2013-10-16
Age : 37
Location : India
Re: simple numerical calculation with variables -need help-
Fri Oct 18, 2013 1:05 pm
Here is your answer vlady_1027...
Store | 10 | x
Store | 5.99 |y
storeEval | ${x}*${y} | Z
storeEval | javascript:{${Z}.toFixed(2)} | Z
Store | 10 | x
Store | 5.99 |y
storeEval | ${x}*${y} | Z
storeEval | javascript:{${Z}.toFixed(2)} | Z
Permissions in this forum:
You cannot reply to topics in this forum