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

Third root from a number

Former Member
0 Likes
1,071

Hi ABAPers,

I need to calculate the third root in an ABAP-Programm.

(SAP Release 4.6C)

I know of the SQRT function, but that just returns the square root...

--> 1000 = 10 * 10 * 10

The Third root of 1000 is 10...

Does anybody have an idea?

Thanx in advance!

Greetz,

Pieter

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
938

You can try like this:

data: num type i,

<b>num1 type f</b>.

10 ** 3 = 1000

which implies :

num1 = 1 / 3.

1000 ** num1 = 10

5 REPLIES 5
Read only

Former Member
0 Likes
938

hi

good

go through this code which ll give you idea about the square root,

DATA : in TYPE f VALUE 16 ,

out TYPE f .

CALL METHOD cl_foev_builtins=>square_root

EXPORTING

im_number = in

IMPORTING

ex_result = out.

WRITE out .

you can try this same for third root.

reward point if helpful.

thanks

mrutyun^

Read only

0 Likes
938

Hi Mrutyunjaya!

Thank you for your reply, I found that one as well, but unfortunately this class is not available in Release 4.6C... (and it´s a Square root function, and I need the third root...)

Thanks though!

Read only

0 Likes
938

Hello

DATA :

F1 TYPE F, Number for which third route is required say 1000

F2 TYPE F, "Temp variable

F3 TYPE F. " Third route value i.e. 10

F2 = LOG( F1 ) / 3.

F3 = exp( F2 ).

Regards

Saket Sharna

Read only

Former Member
0 Likes
939

You can try like this:

data: num type i,

<b>num1 type f</b>.

10 ** 3 = 1000

which implies :

num1 = 1 / 3.

1000 ** num1 = 10

Read only

0 Likes
938

Thanks Sudhir!

It works: h_float2 = h_float1 ** ( 1 / 3 ).