• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Functions for working with the idealized calendar of Planet Xhilr


Commit MetaInfo

Revisión6ec616a8a188099b49d272686d925d7be6c18549 (tree)
Tiempo2017-06-13 18:04:11
AutorJoel Matthew Rees <joel.rees@gmai...>
CommiterJoel Matthew Rees

Log Message

more on cycle counting for synthetic division

Cambiar Resumen

Diferencia incremental

--- a/econmonths.fs
+++ b/econmonths.fs
@@ -85,8 +85,8 @@
8585 ( : UM/MOD M/MOD DROP ; ( uddividend udivisor --- uremainder uquotient )
8686
8787 : S>D S->D ; ( n --- d : Modern name for single-to-double. )
88-: NEGATE MINUS ; ( n --- -n : Modern name for single-to-double. )
89-: DNEGATE DMINUS ; ( d --- -d : Modern name for single-to-double. )
88+: NEGATE MINUS ; ( n --- -n : Modern name for numeric negation. )
89+: DNEGATE DMINUS ; ( d --- -d : Modern name for double number negation. )
9090
9191 : 2DUP OVER OVER ; ( d --- d d : DUPlicate top double cell on stack. )
9292
@@ -325,9 +325,6 @@ SP@ SP@ - ABS CONSTANT CELLWIDTH
325325 ( THEN )
326326 ( ; )
327327
328-( : UMQ* ( uqdividend uddivisor --- udremainder uqquotient )
329-( 0. 2SWAP )
330-
331328 ( Make things easier to read. )
332329 ( Infix will be confusing here, too. )
333330
@@ -675,15 +672,15 @@ RD2LCYCLE 16 * CONSTANT NUCYCLE ( numerator: 7760 )
675672 ( Fake DCONSTANT: )
676673 : SMPERIOD10976 [ SMPERIODINT DECYCLE UM* SMPERIODFRAC10976 0 D+ SWAP ] LITERAL LITERAL ;
677674 ( 28 9645 / 10976 == 316973 / 10976 )
678-(
679675
680676
681677 0 CONSTANT SMOFFINT ( Slow moon offset at year 0 day 0, integer part. )
682678 0 CONSTANT SMOFFFRAC10976 ( Fractional part. )
683679
684-0 VARIABLE SMSTATEINT ( Slow moon state integer part. )
685-0 SMSTATEINT ! ( Initialize cleared. Modern Forths leave a zero. )
686-0 VARIABLE SMSTATEFRAC10976 ( Fractional part. )
680+0 VARIABLE SMSTATEINT ( Slow moon state integer part. Modern Forths leave a zero. )
681+0 SMSTATEINT ! 0 , ( Initialize cleared, make double variable. )
682+0 VARIABLE SMSTATEFRAC10976 ( Fractional part. Modern Forths leave a zero. )
683+0 SMSTATEFRAC10976 ! 0 , ( Initialize cleared, make double variable. )
687684
688685
689686 ( The smaller moon orbits their world in just under seven and one eighth days, )
@@ -697,36 +694,42 @@ RD2LCYCLE 16 * CONSTANT NUCYCLE ( numerator: 7760 )
697694 0 CONSTANT FMOFFINT ( Fast moon offset at year 0 day 0, integer part. )
698695 0 CONSTANT FMOFFFRAC10976 ( Fractional part. )
699696
700-0 VARIABLE FMSTATEINT ( Fast moon state integer part. )
701-0 FMSTATEINT ! ( Initialize cleared. Modern Forths leave a zero. )
702-0 VARIABLE FMSTATEFRAC10976 ( Fractional part. )
697+0 VARIABLE FMSTATEINT ( Fast moon state integer part. Modern Forths leave a zero. )
698+0 FMSTATEINT ! 0 , ( Initialize cleared, make double variable. )
699+0 VARIABLE FMSTATEFRAC10976 ( Fractional part. Modern Forths leave a zero. )
700+0 FMSTATEFRAC10976 ! 0 , ( Initialize cleared, make double variable. )
703701
704702
705-: WSTYCYCLES ( year --- ddays ) ( Start the weekday counter for the year, keep the days. )
703+: WSTYCYCLES ( year --- ) ( Start the weekday counter for the year, keep the days. )
706704 DTY 2DUP DAYCOUNT D!
707- 2DUP WKDAYOFFSET 0 D- DPWK JM/MOD 2DROP DOWKSTATE !
705+ WKDAYOFFSET 0 D- DPWK JM/MOD 2DROP DOWKSTATE !
708706 ;
709707
710708 : SSTYCYCLES ( ddays --- ) ( Start the slowmoon cycle counter for the year. )
711- SMOFFINT SMSTATEINT !
712- SMOFFFRAC10976 SMSTATEFRAC10976 !
713-
714- 2DUP DECYCLE UDS*
715-
709+ DECYCLE UDS* DROP SMPERIOD10976 DROP JM/MOD >R >R S>D R> R> ( 32-bit, 64-bit )
710+( DECYCLE S>D UMD* SMPERIOD10976 UD/MOD ( 16-bit )
711+ 2SWAP SMOFFFRAC10976 S>D D+
712+ 2DUP SMPERIOD10976 D< 0= IF
713+ SMPERIOD10976 D- 2SWAP 1. D+ 2SWAP
714+ THEN
715+ SMSTATEFRAC10976 D!
716+ SMOFFINT S>D D+ SMSTATEINT D!
716717 ;
717718
718-: FSTYCYCLES ( year --- ) ( Start the fastmoon cycle counter for the year. )
719- FMOFFINT 0 FMSTATEINT !
720- FMOFFFRAC10976 FMSTATEFRAC10976 !
721-
722- 2DUP DECYCLE UDS* ( Have to dived by period, period is double. )
723-
719+: FSTYCYCLES ( ddays --- ) ( Start the fastmoon cycle counter for the year. )
720+ DECYCLE UDS* DROP FMPERIOD10976 DROP JM/MOD >R >R S>D R> R> ( 32-bit, 64-bit )
721+( DECYCLE S>D UMD* FMPERIOD10976 UD/MOD ( 16-bit )
722+ 2SWAP FMOFFFRAC10976 S>D D+
723+ 2DUP FMPERIOD10976 D< 0= IF
724+ FMPERIOD10976 D- 2SWAP 1. D+ 2SWAP
725+ THEN
726+ FMSTATEFRAC10976 D!
727+ FMOFFINT S>D D+ FMSTATEINT D!
724728 ;
725729
726730 : STYCYCLES ( year --- ) ( Start the counters for the year. )
727- DUP WSTYCYCLES
728- DUP SSTYCYCLES
729- DUP FSTYCYCLES
731+ WSTYCYCLES
732+ DAYCOUNT D@ 2DUP SSTYCYCLES FSTYCYCLES
730733 ;
731734
732735 : STMCYCLES ( year month --- ) ( The year is started, start the month. )