[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> fastpower



Just try
to power :x :y
output exp(ln :x)* :y
end
neuwirth heeft geschreven in bericht ...
>to see how many multiplications are needed
>for the fast power calculation method do the following
>
>
>to n.of.calls.fast.power :exp
>if :exp = 1 [output 0]
>if evenp :exp [output 1 + n.of.calls.fast.power (:exp / 2)]
>output 1 + n.of.calls.fast.power (:exp - 1)
>end
>
>
>then use the command line
>
>
>foreach map [[x] list :x n.of.calls.fast.power :x] iseq 2 20 [print ?]
>
>
>--
>Erich Neuwirth <neuwirth@smc.univie.ac.at>
>Computer Supported Didactics Working Group, Univ. Vienna
>Visit our SunSITE at http://sunsite.univie.ac.at
>
>
>
>---------------------------------------------------------------
>Please post messages to the Logo forum to logo-l@gsn.org.  Mail
>questions about the list administration to logofdn@gsn.org.  To
>unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.





---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home