home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 18
/
018.d81
/
lk.submission
< prev
next >
Wrap
Text File
|
2022-08-26
|
1KB
|
39 lines
0010 func jdate(m,d,y) closed
0020 //julian date at 0 hr ut
0030 return 367*y-int(7*((y+int((m+9)/12))/4))+int(275*m/9)+d+1721013.5
0040 endfunc
0050 //
0060 proc cdate(jdate,ref month,ref day,ref year) closed
0070 //calendar date from julian date
0080 //* includes fraction of a day *
0090 jdate:+.5; z:=int(jdate); f:=jdate-z
0100 if z<2299161 then
0110 a:=z
0120 else
0130 a:=int((z-1867216.25)/36524.25)
0140 a:=z+a-int(a/4)+1
0150 endif
0160 b:=a+1524; c:=int((b-122.1)/365.25)
0170 d:=int(365.25*c); e:=int((b-d)/30.6001)
0180 day:=b-d-int(30.6001*e)+f
0190 month:=e-13; day:=int(100*day+.5)/100
0200 if e<13.5 then month:=e-1
0210 year:=c-4715
0220 if month>2.5 then year:=c-4716
0230 endproc
0240 //
0250 func atan3(a,b) closed
0260 // 4-quadrant inverse tangent
0270 pidiv2:=4*atn(1)/2; eps:=1e-08
0280 if abs(a)<eps then
0290 return (1-sgn(b))*pidiv2
0300 else
0310 c:=(2-sgn(a))*pidiv2
0320 endif
0330 if abs(b)<eps then
0340 return c
0350 else
0360 return c+sgn(a)*sgn(b)*(abs(atn(a/b))-pidiv2)
0370 endif
0380 endfunc