General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
xybersurfer
Computerphile
comments
Comments by "xybersurfer" (@xybersurfer) on "Binary: Plusses u0026 Minuses (Why We Use Two's Complement) - Computerphile" video.
Phaux and the lesson is: never use the equality operator to compare floating point values.
1
Cooper Gates now give an example where that code would be required.
1
Cooper Gates interesting case. but i can't help but think that you could have used a (possibly rewritten) if-statement where you use "<" instead of "==". it would be more descriptive
1
Cooper Gates to me the second if-statement would be more descriptive. it shows what could happen after the cast: if (k < 0) return -1 * (int(-1.0 * k)); else if (float(int(k)) < k) return int(k) + 1; else int(k); i assume that the values of the float k are not too big for an integer
1
Cooper Gates i consider "!=" just as dangerous as "==" for comparing floats. i think "<" comparisons are usually the proper way of thinking here. in the real world you can't always expect numbers to have an exact value, or be able to catch the step at which a number has that value. the "<" comparison captures the thought that you are working with a range of possible values.
1
Cooper Gates to me that just shows that there is less margin for wrongly interpreting the comparison when reading the code.
1
***** as a programmer i actually agree with you, on a philosophical level. binary is rather far removed from our intentions. but as you can see from the responses: people have a tendency to obsess over unnecessary details.
1
matsv201 that would be one way of looking at it. those components could be both binary and base 256 at the same time, depending on the level of abstraction you choose. just like a usbstick with 1GB could be seen as one big cluster having base 2^30.
1
matsv201 i don't disagree with you. if you choose to view things at the hardware level then that is what you see. my point is that it is not the only possible view. it's a bit unnecessary to argue about which view is better. i think it depends on the situation.
1
lulhoofd1 i don't deny that people can get used to binary. it holds no secrets to me either. but that doesn't mean it's the closest we can get to our intentions.
1
matsv201 you have shifted from addressibility to the inner workings of subsystems. yes when you go deep enough into IC's, you will likely, find only binary. the lines themselves are not binary though. a line can have more than 2 possible voltages. voltages exist on more of a continuous range. and those lines are made of atoms... i can shift the view too. but what's the point of all these details? what exactly is your philosophical point?
1
matsv201 you just don't seem to get the points i'm making. you have a hard time letting go of the details. you mentioned how systems are binary values. i mentioned that this is true but that this is just a single point of view. you changed your view to to a deeper lever where one only sees binary and i in turn showed you a deeper view where electric wires can be regarded as components, which are not limited to passing on only 2 voltage values but a continuous range to show you how pointless it is to senselessly pick a single view. you subtly introduce the assumption that the bit addressability equates to the "base". even though this is not necessarily the case.
1