ВНИМАНИЕ! На форуме началось голосование в конкурсе - астрофотография месяца АПРЕЛЬ!
0 Пользователей и 1 Гость просматривают эту тему.
unit moonday;interfaceuses SysUtils, Math;const milenium: Array[0..6] of extended = (0.0, 13.9, 27.7, 12.1, 25.9, 10.3, 24.2); century: Array[0..9] of extended = (0.0, 4.3, 8.7, 13.0, 17.4, 21.7, 26.0, 0.8, 5.2, 9.5); ten: Array[0..9] of extended = (0.0, 9.3, 18.6, 27.9, 7.6, 16.9, 26.2, 6.0, 15.3, 24.6); year: Array[0..9] of extended = (0.0, 18.6, 7.8, 26.4, 15.5, 4.6, 23.3, 12.4, 1.5, 20.2); month_new: Array[0..11] of extended = (13.4, 11.9, 24.2, 22.6, 22.0, 20.6, 20.0, 18.4, 17.0, 16.6, 15.1, 14.8); month_full: Array[0..11] of extended = (28.2, 26.7, 9.5, 7.9, 7.3, 5.8, 5.3, 3.6, 2.2, 1.9, 0.3, 0.0);function GetDate(ypos1,ypos2,ypos3,ypos4,month,tmoon: integer): extended;function MoonDayIs(ypos1,ypos2,ypos3,ypos4,month,day,hour: integer): extended;implementationfunction GetDate(ypos1,ypos2,ypos3,ypos4,month,tmoon: integer): extended;var x: extended;beginresult:=0; if ((month=1) or (month=2)) then begin ypos4:=ypos4-1; if (ypos4<0) then begin ypos4:=9; ypos3:=ypos3-1; end; if (ypos3<0) then begin ypos3:=9; ypos2:=ypos2-1; end; if (ypos2<0)then begin ypos2:=9; ypos1:=ypos1-1; end; end; if ((ypos1>=0) and (ypos1<=6)) then result:=result+milenium[ypos1]; if ((ypos2>=0) and (ypos2<=9)) then result:=result+century[ypos2]; if ((ypos3>=0) and (ypos3<=9)) then result:=result+ten[ypos3]; if ((ypos4>=0) and (ypos4<=9)) then result:=result+year[ypos4]; if (tmoon=1) then result:=result+month_new[month-1] else result:=result+month_full[month-1];x:=ypos3*10+ypos4;x:=x/4; if (x=1) then result:=result+0.2; if (x=2) then result:=result+0.5; if (x=3) then result:=result+0.8;x:=ypos1*10+Math.floor(ypos2);x:=round(0.75*x-1.625);result:=result+x; if (result>119.1) then result:=result-118.1; if (result>89.6) then result:=result-88.6; if (result>60.1) then result:=result-59.1; if (result>30.5) then result:=result-29.5;result:=round(result*10)/10;end;function MoonDayIs(ypos1,ypos2,ypos3,ypos4,month,day,hour: integer): extended;var nov,dr: extended;beginresult:=0;nov:=GetDate(ypos1,ypos2,ypos3,ypos4,month,1); if (nov=0) then exit;dr:=Math.floor(day)+(round(hour/24*10)/10);result:=dr-nov; if (result<0) then result:=result+29.5;result:=Math.floor(result)+1;end;end.
ShowMessage(FloatToStr(MoonDayIs(2,0,0,6,7,24,17)));
result:=Math.floor(result)+1