Gfk:
And tell me, what will you learn if you attempt a bitwise shift on a float, and get garbage numbers that don't appear to have any rhyme or reason to them?
You will learn not to do that.
I just saved him time by telling him what the results of said experiment would be, and prevented him from having a confusing bug in his code which could take hours to track down because someone told him bitwise shifts multiplied by 4 but neglected to mention that it doesn't work on floats.
I myself don't know exactly what the result would be if I shifted a float, but I do know the format of floats is special and shifting them will likely do something zany like shift bits of your number into the exponent. And that's a completely useless operation for anything I can think of. So I just don't think it's something worthwhile to spend a lot of time learning. "Don't do it." is enough information for most people.
If someone asked you what happens when you mix ammonia and bleach, would you tell them it was dangerous and that they shouldn't do it, or would you let them experiment? Same thing. I saved him from a potentially life theatening three hours of bug hunting. :-)
And tell me, what will you learn if you attempt a bitwise shift on a float, and get garbage numbers that don't appear to have any rhyme or reason to them?
You will learn not to do that.
I just saved him time by telling him what the results of said experiment would be, and prevented him from having a confusing bug in his code which could take hours to track down because someone told him bitwise shifts multiplied by 4 but neglected to mention that it doesn't work on floats.
I myself don't know exactly what the result would be if I shifted a float, but I do know the format of floats is special and shifting them will likely do something zany like shift bits of your number into the exponent. And that's a completely useless operation for anything I can think of. So I just don't think it's something worthwhile to spend a lot of time learning. "Don't do it." is enough information for most people.
If someone asked you what happens when you mix ammonia and bleach, would you tell them it was dangerous and that they shouldn't do it, or would you let them experiment? Same thing. I saved him from a potentially life theatening three hours of bug hunting. :-)