|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Is there a EXP function ???? |
« View previous topic :: View next topic » |
Author |
Message
|
kiran26 |
Posted: Tue Dec 03, 2002 8:17 am Post subject: Is there a EXP function ???? |
|
|
Acolyte
Joined: 06 Feb 2002 Posts: 69
|
Hi all,
Is there a exponential function in the ESQL .If not how to work around it.
Thanks
kiran |
|
Back to top |
|
 |
wmqiguy |
Posted: Tue Dec 03, 2002 1:16 pm Post subject: |
|
|
 Centurion
Joined: 09 Oct 2002 Posts: 145 Location: Florida
|
No EXP function that I know of, but I've been wrong before.
You could create your own function. Here is something I wrote from the top of my head and have not tested it. Everything is assumed to be an integer and it does not account for any exponents that are negative (or 0 or 1 for that matter.)
This could be handled very easily through some IF stuff. I'll leave that to if you need it.
The function call to calculate 2^4 would be:
SET myRESULT = calcEXP (2, 4);
And here is the function (I usually have this at the end of the ESQL.)
CREATE FUNCTION calcEXP (Base INTEGER, Exponent INTEGER)RETURNS INTEGER
BEGIN
DECLARE myCOUNT INTEGER;
SET myCOUNT = 2;
SET FinalAnswer = Base;
WHILE myCOUNT <= Exponent DO
FinalAnswer = FinalAnswer * Base;
SET myCOUNT = myCOUNT + 1;
END WHILE;
RETURN FinalAnswer;
END;
Probably more elegant methods, but hopefully this will give you something to start with.
Todd |
|
Back to top |
|
 |
j.f.sorge |
Posted: Thu Oct 16, 2008 3:13 am Post subject: but you may use POWER(2, 4) |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
But you may use POWER(2, 4) in order to compute 2^4. |
|
Back to top |
|
 |
mgk |
Posted: Thu Oct 16, 2008 3:23 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
Is there a exponential function in the ESQL .If not how to work around it |
Yes, it is called EXP and is documented in the help! Did you not bother to look or search before you posted or did you try to look and search but didn't find it? _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|