Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MC: The results

21 views
Skip to first unread message

Christian Meland

unread,
Jul 3, 1998, 3:00:00 AM7/3/98
to

Hi. I am in a bit of a hurry, so I write this in a way that only make sense
to those who competed.

I recieved 7 programs for the "sum of digits" contest. There were several
different ways to do this, and all the best ones used MANT to avoid adding
0's (30.08197 = 3+8+1+9+7 instead of 3+0+0+8+1+9+7) and to avoid
multiplying by 10.

There where 4 major ideas:
DO UNTIL
WHILE REPEAT
START NEXT and
recursive.

Examples:
HPSolo:
« MANT 0
DO OVER IP + SWAP FP MANT SWAP
UNTIL OVER NOT
END + (+ instead of SWAP DROP, MAX is faster)
»

Werner:
« 0 SWAP
WHILE MANT + IP LASTARG FP
REPEAT LASTARG
END
»

Gilles
« MANT 3 OVER ->STR SIZE
START DUP IP SWAP FP MANT +
NEXT
»

Kresimir
« MANT IP LASTARG FP
IF DUP
THEN S { S } IFT is faster, I think
END +
» (clever)


WHILE seems t be the most obvios choice, (WHILE ... FP REPEAT ...), but you
have to drag on to the extra 5 bytes caused by the :: ; inserted between
REPEAT and END, UNLESS you do as Jorge Costa and Werner Hoysegoms and
insert only one command between REPEAT and END.


DIR
RESULTSALL
Nr Name Mean Std LCL HCL
========================================
7 Werner 2698.8 2.8 2695.2 2702.3
4 Jorge 3030.9 4.6 3025.2 3036.5
2 Gilles 3125.2 3.5 3121 3129.5
6 Kresimir 3291.6 3.1 3287.7 3295.4
3 HPSolo 3716.5 4.4 3711 3722
1 Gerald 3933.5 4.1 3928.4 3938.6
5 Paolo 8936.3 10.3 8923.5 8949.1

Mean: tim*bytes, average of 5 runs on each of 98, 3.1415... and 30.08197.
Randomized order. Confidence limits (95%) for mean included. (All this was
done by TIM and my own creation STEST which will automate this process)

Congratulations Werner, you may send me your spesifications for a ROM card,
and your post adress!


RESULTS
{
:30.08197:
[[ 1 3183 5.7 3176 3190.1 ]
[ 2 3029.6 3.3 3025.5 3033.6 ]
[ 3 2998.4 4.2 2993.2 3003.6 ]
[ 4 2412.7 2.7 2409.4 2416 ]
[ 5 9130.9 11.8 9116.3 9145.6 ]
[ 6 2551 3.5 2546.7 2555.4 ]
[ 7 2149 2.4 2146 2152 ]]
:3.1415...:
[[ 1 7198.9 4.6 7193.2 7204.7 ]
[ 2 5422.2 6.7 5413.9 5430.6 ]
[ 3 6844.8 7.3 6835.7 6853.8 ]
[ 4 5726.5 9.9 5714.3 5738.8 ]
[ 5 13970.3 12.9 13954.3 13986.4 ]
[ 6 6395.3 5.2 6388.9 6401.7 ]
[ 7 5097.6 5.9 5090.2 5104.9 ]]
:98:
[[ 1 1418.5 2 1416 1421 ]
[ 2 923.9 .4 923.5 924.4 ]
[ 3 1306.4 1.8 1304.1 1308.6 ]
[ 4 953.4 1.2 951.9 954.8 ]
[ 5 3707.6 6.3 3699.9 3715.4 ]
[ 6 928.4 .6 927.6 929.2 ]
[ 7 849.7 .2 849.5 850 ]]
}

GERALD
« 0 SWAP
WHILE MANT DUP
REPEAT DUP IP ROT + SWAP FP
END DROP
»
GILLES
« MANT 3 OVER STR SIZE
START DUP IP SWAP FP MANT +
NEXT
»
HPSolo
« MANT 0
DO OVER IP + SWAP FP MANT SWAP
UNTIL OVER NOT
END +
»
JORGE
« 0 SWAP
WHILE MANT DUP IP ROT + SWAP FP
REPEAT LASTARG
END
»
Paolo
«
DO 10 /
UNTIL DUP IP NOT
END 0 SWAP
DO 10 * DUP IP ROT + SWAP FP DUP NOT
UNTIL
END DROP
»
S @Kresimir
« MANT IP LASTARG FP
IF DUP
THEN S
END +
»
Werner
« 0 SWAP
WHILE MANT + IP LASTARG FP
REPEAT LASTARG
END
»

Tes 98

TestPrg @ "Parameter" for STEST
« RCL Tes OVER TIM SWAP DROP SWAP BY *
»
STST
« -> P
« 98 pi ->NUM 30.08197 3 1
FOR D 'Tes' STO P 5 STEST D ROLLD -1
STEP P
»
»
END


--
Christian Meland
Research Scientist, PFI
N-7034 Trondheim, Norway
Phone +4773550976, at home +47 73922526

HPS...@my-dejanews.com

unread,
Jul 3, 1998, 3:00:00 AM7/3/98
to

Congratulations Werner! Well done! 'Tis a pity, however, that with such a
fun contest, not more than 7 submissions were made. Oh well, better chances
for those who did submit.

Happy programming!
Han

In article <01bda681$4681b6e0$9916f181@r286>,


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum

werner_h...@my-dejanews.com

unread,
Jul 6, 1998, 3:00:00 AM7/6/98
to

In article <01bda681$4681b6e0$9916f181@r286>,
"Christian Meland" <christia...@pfi.no> wrote:
>
> Congratulations Werner, you may send me your spesifications for a ROM card,
> and your post adress!
>

- thank goodness you were exempt from the competition, Christian
- the rules stated clearly that LASTARG was allowed - I had the exact
same program as Gerald at first, since I try to avoid using it (it's
probably become a natural reflex to the MDG people!)

I'll think about what to put on the ROM-card, thanks.

Werner Huysegoms
Reply-To: werner.h...@xdg11.xcec.xbe
Remove the three x's in the @-field before replying
I once typed ...com at the end by mistake; my apologies.

0 new messages