This site Web
Home Page | The Sun API | Gallery | InfoSearch | News | Links | Contact Us

Sunlit Design > The Sun API > Documentation > sdDMS2D Function


Index


- Introduction
+ Using the Functions
+ User Guide
+ Function Reference
+ Constants

Contact Developer

Downloads

sdDMS2D Function

Description

Returns a degree value equivalent to a degree:minute:second (degree, arcminute, arcsecond) value.  The sign of the returned value is determined by sign.

Syntax

sdDMS2D(sign,degree,minute,second)

sign    sign of the resultant value.  1 means positive, -1 means negative.  The constants at right may be used.

degree   

a non-negative degree value

minute   

a non-negative arcminute value.  minute may be any value greater than or equal to 0.  

second   

a non-negative arcsecond value. second may be any value greater than or equal to 0. 

Return Values

sdDMS2D returns double precision number.

Errors

If this function finds any errors in it's input parameter(s) it returns -99999999

Remarks

sdDMS2D calculates it's value based on the following formula:
    sign*(degree+minute/60+second/3600)

You can convert a degree value to it's Degrees:Minute:Seconds components using the sdDUnpackx function and to a printable text format using sdD2Text function.

Example

To convert the eastern longitude 23d:34m:45.332s to degrees:
    sdDMS2D(sdDMSEast,23,34,45.332)equals -23.579258888888...

To add 12d:34m:2s and 65d:54m:0s together giving a result in degrees:
    sdDMS2D(sdDMSPlus,12+65,34+54,2) gives 78.4672222222222

To find double the angle 34d:43m:15s in degrees:
    sdDMS2D(sdDMSPlus,34*2,43*2,15*2) gives 69.4416666666667

To convert a latitude/longitude stored in 4 variables d,m,s, and hemi (i.e. hemisphere) to a latitude/longitude degree value: (assuming hemi contains either 1 or -1)
    sdDMS2D(hemi,d,m,s)

To fill an array with the sine of all angles from 1 to 2 degrees with 10 arcsecond resolution (Visual Basic):

   j = 0
   for i = 0 to 3600 step 10
       j = j + 1
       x(j) =  sdSin(sdDMS2D(sdDMSPlus,1,0,i)
   next i