home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 18 / 018.d81 / lk.submission < prev    next >
Text File  |  2022-08-26  |  1KB  |  39 lines

  1. 0010 func jdate(m,d,y) closed
  2. 0020 //julian date at 0 hr ut
  3. 0030 return 367*y-int(7*((y+int((m+9)/12))/4))+int(275*m/9)+d+1721013.5
  4. 0040 endfunc 
  5. 0050 //
  6. 0060 proc cdate(jdate,ref month,ref day,ref year) closed
  7. 0070 //calendar date from julian date
  8. 0080 //* includes fraction of a day *
  9. 0090 jdate:+.5; z:=int(jdate); f:=jdate-z
  10. 0100 if z<2299161 then
  11. 0110 a:=z
  12. 0120 else 
  13. 0130 a:=int((z-1867216.25)/36524.25)
  14. 0140 a:=z+a-int(a/4)+1
  15. 0150 endif 
  16. 0160 b:=a+1524; c:=int((b-122.1)/365.25)
  17. 0170 d:=int(365.25*c); e:=int((b-d)/30.6001)
  18. 0180 day:=b-d-int(30.6001*e)+f
  19. 0190 month:=e-13; day:=int(100*day+.5)/100
  20. 0200 if e<13.5 then month:=e-1
  21. 0210 year:=c-4715
  22. 0220 if month>2.5 then year:=c-4716
  23. 0230 endproc 
  24. 0240 //
  25. 0250 func atan3(a,b) closed
  26. 0260 // 4-quadrant inverse tangent
  27. 0270 pidiv2:=4*atn(1)/2; eps:=1e-08
  28. 0280 if abs(a)<eps then
  29. 0290 return (1-sgn(b))*pidiv2
  30. 0300 else 
  31. 0310 c:=(2-sgn(a))*pidiv2
  32. 0320 endif 
  33. 0330 if abs(b)<eps then
  34. 0340 return c
  35. 0350 else 
  36. 0360 return c+sgn(a)*sgn(b)*(abs(atn(a/b))-pidiv2)
  37. 0370 endif 
  38. 0380 endfunc 
  39.