Share
Go down
Techniker
Posts : 3
Join date : 2012-01-24

simple numerical calculation with variables -need help-

on 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
Techniker
Posts : 3
Join date : 2012-01-24

Re: simple numerical calculation with variables -need help-

on 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
avatar
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 31
Location : INDIA
http://radical-qa.blogspot.in/

Re: simple numerical calculation with variables -need help-

on 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}

_________________
Radical QA
http://radical-qa.blogspot.in/
vlady_1027
Posts : 1
Join date : 2012-05-12

Re: simple numerical calculation with variables -need help-

on 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!
avatar
kashyap_guru
Active particpant
Active particpant
Posts : 24
Join date : 2013-10-16
Age : 31
Location : India

Re: simple numerical calculation with variables -need help-

on 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
Sponsored content

Re: simple numerical calculation with variables -need help-

Back to top
Permissions in this forum:
You cannot reply to topics in this forum