Housekeeping

This commit is contained in:
Devine Lu Linvega 2023-05-25 12:04:39 -07:00
parent affab72624
commit 330dbcbe3a
1 changed files with 10 additions and 12 deletions

View File

@ -94,24 +94,22 @@ JMP2r
NIP NIP NIP NIP
JMP2r JMP2r
&m 1f 1c 1f 1e 1f 1e 1f 1f 1e 1f 1e 1f &m [ 1f 1c 1f 1e 1f 1e 1f 1f 1e 1f 1e 1f ]
@is-leap-year ( year* -- bool ) @is-leap-year ( year* -- bool )
( leap year if perfectly divisible by 400 ) ( leap year if perfectly divisible by 400 )
DUP2 #0190 ( MOD2 ) DIV2k MUL2 SUB2 #0000 EQU2 ?&leap DUP2 #0190 ( MOD2 ) DIV2k MUL2 SUB2 #0000 EQU2 ?&leap
( not a leap year if divisible by 100 ) ( not a leap year if divisible by 100, but not divisible by 400 )
( but not divisible by 400 )
DUP2 #0064 ( MOD2 ) DIV2k MUL2 SUB2 #0000 EQU2 ?&not-leap DUP2 #0064 ( MOD2 ) DIV2k MUL2 SUB2 #0000 EQU2 ?&not-leap
( leap year if not divisible by 100 ) ( leap year if not divisible by 100, but divisible by 4 )
( but divisible by 4 ) #0003 AND2 #0000 EQU2
DUP2 #0003 AND2 #0000 EQU2 ?&leap JMP2r
( all other years are not leap years )
&not-leap &not-leap
POP2 #00 POP2 #00
JMP2r JMP2r
&leap POP2 #01 JMP2r &leap
POP2 #01
JMP2r
@print-greg ( doty* year* -- ) @print-greg ( doty* year* -- )