>> then put the definition in your sig
The only problem with that is the bone heads that think it's part of your response...but yeah, it would probably save me a lot of typing.
>> then put the definition in your sig
The only problem with that is the bone heads that think it's part of your response...but yeah, it would probably save me a lot of typing.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
> 00110000 01111000 00110101 00110011
what did you say? thems fightin words
>> what did you say? thems fightin words
Exactly. My favorite "often misread" signature, BTW, is Sang-drax's, which reads:
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
How do you even know there is a stack (used for parameter passing) ?
yeah, you don't. they could be passed in registers or using the new foobar gadget for all ISO C cares.
Or the hardware doesn't know how to handle a stack, hardware stack handling is not a prerequisite as far as I know...
>> Or the hardware doesn't know how to handle a stack, hardware stack handling is not a prerequisite as far as I know...
To be sure, though, even if it didn't have one (rare, I imagine), you could simply simulate one in software. It would be easiest if you had a spare register (two would be better, of course, so that you could have a base pointer), but even if you didn't you could simply use some hard-coded address or such to store it. My point is, a stack is just a simple data structure that happens to be implemented in hardware because it's, well, so useful, but hardware support isn't strictly necessary.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
>> It seems, though, that many C students think that there is a stack
Well, on most systems these days, there is. My only point was that it could be simulated, which to be fair, isn't immediately obvious unless you've done some assembly programming or whatnot. A lot of people don't know you could use an xor gate to test for inequality either, for example (which is kind of a lame example, I know), but that's less a matter of ignorance so much as it is a lack of arcane knowledge that can only come with experience.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Is there a way to implement recursive functions without a stack/LIFO, either in software or in hardware?
>> Is there a way to implement recursive functions without a stack/LIFO, either in software or in hardware?
Of course not.
EDIT: Sorry, that probably sounded rude. No offense intended.
And just to clarify, the reason is quite simple: a stack *is* recursion. And if you get right down to it, it's such a simple, basic data structure that it isn't even meaningful to somehow discard it completely. Having said all that, you could implement it in a number of ways - you might use a linked list for example. But that doesn't change the fact that it's still logically a stack, if you get what I mean. So in that sense, the answer is still no.
Last edited by Sebastiani; 07-09-2009 at 01:26 PM.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }