hai nazeer,
go through this code , which clarifies your doubt.
DATA : p_data TYPE i.
DATA: pi TYPE p DECIMALS 2,
degree TYPE f VALUE 45,
radians TYPE f.
pi = 22 / 7.
degree = 45.
radians = ( degree * pi ) / 180.
p_data = tan( radians ).
WRITE : p_data.
<b>reward points if helpfull.</b>
with regards,
radhika kolluru.
Hi Nazeer ,
What is the value you are getting .
Is it 1.61977519.
As posted in the post by Mukesh , you need to convert degrees to
radians , this can be done using the forumla
Radians = ( Degree * Pi ) / 180
Please see the link
Linkhttp://www.teacherschoice.com.au/Maths_Library/Angles/Angles.htm">Link>
Regards
Arun
Message was edited by:
Arun R
Hi nazeer,
You will have to change your value to RADIAN first for 45 degree the value in RADIAN is 0.785 (785 / 1000).
Check this code.
data : p_data type i.
p_data = TAN( 785 / 1000 ).
write : p_data.
It is giving result 1 as expected for TAN 45 degree.
If you have still some doubt reply this thread otherwise reward point and please close the thread.
Regards,
Mukesh Kumar
Hi Nazeer,
The value of Tan(45) is beng wrongly calculated by ABAP because internally the data type for all the Trignometric functions are represented as Floating point numbers.
Please refer to this:
The results of the following functions have the data type f:
 Trigonometric functions: cos, acos, sin, asin, tan, atan
 Hyperbolic functions: tanh, sinh, cosh
 Exponential functions (base e): exp
 Natural logarithms (base e): log
 Logarithms (base 10): log10
 Square root: sqrt
In case you have any further clarifications,do let me know.
Regards,
Puneet Jhari.
TAN in ABAP works on Radians and not degrees, so if u hav degrees you need to convert it into radians, see the e.g. below:
data:
degrees type f value 45,
radians type f.
data:
show type p decimals 2.
radians = '0.0174532925' * degrees.
show = tan( radians ).
write show.
Reward points if useful, get back in case of query...
Cheers!!!
Add comment