4 ms·
Out of curiosity is there actually any chipset with the algorithmic ability to add more than 2 numbers altogether in one operation (without having to store inte
by wizofaus 4y ago
Out of curiosity is there actually any chipset with the algorithmic ability to add more than 2 numbers altogether in one operation (without having to store intermediate results)?
I'd also think looping is far closer than recursion to how we tend to manually calculate things (either entirely in our heads or using a pen & paper or even a basic calculator).
(Edit: looks like a number of other posters have made the same point already, but in dead/downvoted posts, not sure why...)
- twawaaay 4y agoChips have ability to run vector operations that can add a bunch of numbers. The issue is that recursion in software development is relatively rarely about arithmetic operation. For example, you might want to traverse a tree of objects (like a filesystem folder) to run some operation on them, etc. In this case the intermediate information is pointers to where you are currently processing various folders in your tree structure, etc. In a loop you would have to create a data structure to hold these. In recursive function this would typically be spread in multiple frames on your stack pointing to objects in your heap.
- wizofaus 4y agoVector operations that perform the same fixed addition to each element, yes, but that's not really the same thing. And yes I'm very much in agreement that the real power of recursive algorithms is when working with tree-like data structures.
- twawaaay 4y agoYour question was, and I quote: > is there actually any chipset with the algorithmic ability to add more than 2 numbers altogether in one operation (without having to store intermediate results) I was just answering your question. I am not responsible for quality of your questions. What you do is you posted a question but had something else in mind. You got an answer but that answer does not match the question you had in your mind so now you think it is ok to berate somebody for not being able to read your mind.
- wizofaus 4y agoMy understanding is those vector operations don't , in fact, add more than 2 numbers together, but rather simultaneously add lots of pairs of numbers. Happy to be corrected and no berating intended.
- mrkeen 4y ago> Out of curiosity is there actually any chipset with the algorithmic ability to add more than 2 numbers Perhaps? But this would be like asking if there was a chipset that can work without branching because of someone mentioning "GOTO bad". > I'd also think looping is far closer than recursion to how we tend to manually calculate things It's not the looping I mind, it's the mutation.
- wizofaus 4y agoIf there were such an ability at the machine language level, it would be a strong argument against expressing the addition of a set of numbers using either a loop or recursion. I don't really see that either manner of expressing such an operation is always preferable, and would rather simply use a built-in language or feature (e.g. reduce) that the compiler/interpreter is free to translate into the most appropriate machine instructions for the given hardware.