• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++cocoaobjective-cc#誰得gamephpbathyscaphelinuxrubyqtcomegat翻訳pythontwitterwindowsbtronvb.nettestframeworkgui計画中(planning stage)directxpreviewerpukiwikidommruby

Functions for working with the idealized calendar of Planet Xhilr


Commit MetaInfo

Revisionf5c8fe4a3e505c0bcfa71748e1b86dc24a0cdfcc (tree)
Time2017-06-13 18:07:37
AuthorJoel Matthew Rees <joel.rees@gmai...>
CommiterJoel Matthew Rees

Log Message

debugging the division

Change Summary

Incremental Difference

--- a/econmonths.fs
+++ b/econmonths.fs
@@ -348,30 +348,41 @@ CELLBITS CELLWIDTH /MOD CONSTANT BYTEBITS CONSTANT LEFTOVERBITS
348348 2ROT 2ROT ( Get the divisor out of the way, but accessible with pick. )
349349 CELLBITS SUM2* 1+ >R ( Count )
350350 0 >R ( Force flag )
351- BEGIN
352- 2DUP ( high double of dividend )
353- 6 DLC@ D< 0= ( Greater or equal? )
351+ BEGIN ( BL BH AL AML AMH AH ) ( [ count force ] )
352+ 2DUP ( high double of dividend : BL BH AL AML AMH AH AMH AH )
353+ 6 DLC@ D< 0= ( Greater or equal? : BL BH AL AML AMH AH f )
354354 R> OR ( Force it? )
355- IF
356- D- 1 ( Mark the subtraction. )
355+ IF ( BL BH AL AML AMH AH ) ( [ count ] )
356+ 4 DLC@ D- 1 ( Mark the subtraction. )
357357 ELSE
358- DROP 0 ( Mark no subtraction. )
359- THEN
358+ 0 ( Mark no subtraction. )
359+ THEN ( BL BH AL AML AMH AH bit ) ( [ count ] )
360360 SWAP >R SWAP >R ( Save top half of remainder and bury the subtraction flag. )
361+ ( BL BH AL AML bit ) ( [ count AH AMH ] )
361362 OVER >R ( Remember the carry from bottom to top half -- AML. )
363+ ( BL BH AL AML bit ) ( [ count AH AMH AML ] )
362364 >R SUMD2* ( Save subtraction flag and shift the bottom half: AL AML. )
363- SWAP R> OR SWAP ( Record the subtraction in emptied bit of remainder. )
364- R> DUP 0< IF 1 ELSE 0 THEN ( Convert AML to bit to shift in to top half. )
365- R> R> ( BL BH AL AML CARRY AMH AH )
365+ ( BL BH sAL rsAML ) ( [ count AH AMH AML bit ] )
366+ SWAP ( BL BH rsAML sAL ) ( [ count AH AMH AML bit ] )
367+ R> OR SWAP ( Record the subtraction in emptied bit of remainder. )
368+ ( BL BH rsAL rsAML ) ( [ count AH AMH AML ] )
369+ R> 0< IF 1 ELSE 0 THEN ( Convert AML to bit to shift in to top half. )
370+ ( BL BH rsAL rsAML carry ) ( [ count AH AMH ] )
371+ R> R> ( BL BH rsAL rsAML carry AMH AH ) ( [ count ] )
366372 R> 1 - DUP >R ( Count down. )
367- WHILE ( BL BH AL AML CARRY AMH AH )
373+ ( BL BH rsAL rsAML carry AMH AH newcount ) ( [ newcount ] )
374+ WHILE ( BL BH rsAL rsAML carry AMH AH ) ( [ newcount ] )
368375 DUP 0< >R ( Remember the high bit of the remainder, to force subtract. )
369- SUMD2* >R OR R> ( Shift the remainder, with the bit from the low half. )
370- REPEAT ( BL BH AL AML AMH AH )
371- R> DROP ( the count )
372- ( BL BH QL QH RL RH )
373- 2>R 2>R 2DROP 2R> 2R> ( QL QH RL RH )
374- 2SWAP
376+ ( BL BH rsAL rsAML carry AMH AH ) ( [ newcount newforce ] )
377+ SUMD2* ( BL BH rsAL rsAML carry sAMH rsAH ) ( [ newcount newforce ] )
378+ >R OR R> ( Shift the remainder, with the bit from the low half. )
379+ ( BL BH rsAL rsAML rsAMH rsAH ) ( [ newcount newforce ] )
380+ REPEAT ( BL BH rsAL rsAML rsAMH rsAH ) ( [ newcount newforce ] )
381+ ( BL BH rsAL rsAML carry AMH AH ) ( [ newcount ] )
382+ R> DROP ( the count ) ( BL BH rsAL rsAML carry AMH AH )
383+ ROT DROP ( BL BH QL QH RL RH )
384+ 2ROT 2DROP ( QL QH RL RH )
385+ 2SWAP ( RL RH QL QH )
375386 THEN
376387 ;
377388