Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Example of use about EXP (math function)

Former Member
0 Likes
4,495

Hello All!

I need a example for use mathematics function EXP for calcule exponential.

I have 2 variables type F. How can i do that?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,777

Hello

Like this:


DATA: F1 TYPE F, F2 TYPE F.

F2 = 123.

F1 = EXP( F2 ).

WRITE: F1, F2.

6 REPLIES 6
Read only

Former Member
0 Likes
1,778

Hello

Like this:


DATA: F1 TYPE F, F2 TYPE F.

F2 = 123.

F1 = EXP( F2 ).

WRITE: F1, F2.

Read only

0 Likes
1,777

Thank's, but i saw that this function not solve my problem.

This is a example:

i have 2 variables:

var1 = 4.

var2 = 3.

So, i need to result about exponential of this data. I need result = 64.

Another example:

var1 = 3.

var2 = 2.

result should be 9.

please, help me!

Read only

0 Likes
1,777

Hello

A small snippet for this:


DATA: P1 TYPE P, P2 TYPE P, RESULT TYPE P.

P1 = 4.
P2 = 3.

RESULT = 1.
DO P2 TIMES.
  RESULT = RESULT * P1.
ENDDO.

WRITE: RESULT.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,777

C'mon Dzed,

Its not that complicated

DATA:
      v_num1 TYPE i VALUE '4',
      v_num2 TYPE i VALUE '3',
      v_res TYPE i.

v_res = v_num1 ** v_num2.

WRITE v_res.

Cheers,

Suhas

Read only

Former Member
0 Likes
1,777

Hi Rodrigo,

Try this :-

DATA: I1 TYPE I, I2 TYPE I, I3 TYPE I, 
      F1 TYPE F, F2 TYPE F, 
      WORD1(10), WORD2(20), 
      XSTR TYPE XSTRING. 
... 
F1 = ( I1 + EXP( F2 ) ) * I2 / SIN( 3 - I3 ). 
COMPUTE F1 = SQRT( SQRT( ( I1 + I2 ) * I3 ) + F2 ). 
I1 = STRLEN( WORD1 ) + STRLEN( WORD2 ). 
I2 = STRLEN( XSTR ). 

Regards

Abhii

Read only

Former Member
0 Likes
1,777

Hi Rodrigo,

Use power expression "x*y" means that x is multiplied by itself y times, where y is a natural numebr. xy = exp(ylog(x)) for any value of y.

Regards

Abhii