09-28-2007 6:19 AM
Hi SDN,
We are finding out Longitude and Latitude for getting some output based on the address of customer..
I see there is use of Trignometric functions here..
I Just want to find out TAN 45 degreese value in ABAP..
When I calculate <b>TAN ( 45 )</b> in ABAP and its giving me some wriong value instead of 1. I think its considering 45 as a number not the degree..
I want to calculate TAN 45 degree value.. How to do that in ABAP..
Point sure..
regards,
nazeer
Message was edited by:
N a z e e r
09-28-2007 7:38 AM
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.
09-28-2007 6:34 AM
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
<a href="http://www.teacherschoice.com.au/Maths_Library/Angles/Angles.htm">Link</a>
Regards
Arun
Message was edited by:
Arun R
09-28-2007 6:36 AM
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
09-28-2007 6:39 AM
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.
09-28-2007 7:13 AM
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!!!
09-28-2007 7:38 AM
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.