>it always seems to return 1 as a reult.
I would imagine that's because both operands are non-zero. You're using the logical AND and logical OR rather than the bitwise AND and bitwise OR. The logical operators are && and ||, and the bitwise operators are & and |.
>It just wont work!
Correct. The bitwise operators only work with integral values.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
So how can I get round that? when i use just & or | i get an error.
You want to bitwise AND or bitwise OR two floating point values? The result may not be a number even if you were able to combine the bits of each object.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Thats ok, because i can check the validity of the floats that it would produce, they have to be within a certain range and its permissible to replace any malformed floats with a random but valid replacement.
So i dont mind if it dosnt always work, as long as it would work most of the time!
No, it's not okay. The result may be undefined and accessing such a value could cause a crash, after which it would be difficult to check the range.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314