On 01/07/2014 09:36, Martin.J Thompson wrote: >> Assuming we accept this proposal in some form, if you ask for integer'high ** integer'high you will be waiting >> quite a long time for the answer. > > No need for it to be that long - python does arbitrary integer > arithmetic, and it takes negligible time to perform (10**31)**31 and > print 3-and-a-bit lines of digits :) I don't see why a simulator > should have worse performance. > I think I'm right in saying that - 1 - if you do it properly, integer exponentiation of x**y has complexity of O(log(y)) (by breaking y into combinations of powers of 2). In the worst non-intelligent case, it's O(y) 2 - I think (I haven't looked in detail) that Python is smart about this; source at http://svn.python.org/view/python/tags/r271/Objects/longobject.c?view=markup#l3378 3 - On the other hand, some people seem to think that Python will simply use 'pow' to compute this anyway, in which case it's done via floats and logarithms. You can tell by benchmarking - if the calculation takes a constant time irrespective of the operands then 'pow' is being used 4 - (10**31)**31 has nearly a thousand digits in it - are you sure that it fitted on 3 lines? :) Not quite sure what any of this has to do with Hardware Description, though. Anyone who's going to build a huge block of silicon full of integer multipliers will be using a supercomputer to check their results, not a VHDL operator. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Tue Jul 1 03:07:42 2014
This archive was generated by hypermail 2.1.8 : Tue Jul 01 2014 - 03:08:01 PDT