11 ms·
I've always hated this fact with passion but it's like hating gravity. You can't fight it. Personally, I would have gone with one's compliment and a modified eq
by guerrilla 5y ago
I've always hated this fact with passion but it's like hating gravity. You can't fight it. Personally, I would have gone with one's compliment and a modified equality but that's just my OCD speaking.
- jleahy 5y agoIt unfortunately makes all the hardware very messy, end around carry is not a pretty thing. You end up needing fiddly flagged prefix adders.
- potiuper 5y agoFurther down the rabbit hole: https://en.wikipedia.org/wiki/Gray_code#Balanced_Gray_code https://en.wikipedia.org/wiki/Gray_code#Balanced_Gray_code Have yet to discover/work out an addition algo for balanced similar to Harold Lucal's algorithm https://stackoverflow.com/questions/20923165/gray-codes-addition https://stackoverflow.com/questions/20923165/gray-codes-addi...
- CamperBob2 5y agoOr just constrain the problem to support only [-2^N-1, 2^N-1]. This gets you an extra bit of precision when multiplying two signed numbers, because you no longer need to leave room for two sign bits in the product.
- pgn674 5y agoTwo things I hate but can't fight: Tetrahedra almost tessellate but don't quite do it: https://www.pnas.org/content/pnas/103/28/10612/F1.large.jpg https://www.pnas.org/content/pnas/103/28/10612/F1.large.jpg In music, the frequency ratio of a semitone is ideally 2^(1/12), but without some tiny fudging (called tuning), you can't make harmonies as the frequencies almost but don't quite line up right. I forget exactly how this one works so I may have something off.
- Waterluvian 5y ago“12 tone equal temperament” is a good string to Google if you want to learn about that. Most pianos are intentionally out of tune just enough that they’re good enough for every key. Other coincidences that drive me wild: speed of light is almost but not quite 3.0E8m/s And the fine structure constant being almost but not exactly 1/137.
- BoxOfRain 5y ago>speed of light is almost but not quite 3.0E8m/s On that subject, if you decided to make your base unit of length the distance light travels in a nanosecond it'd almost be a foot but not quite.
- Y_Y 5y agoI know that the speed of light is c, or 1 or 3e8 m/s, but I really feel like it's a foot per nanosecond, because that's how I measured it the lab one day messing around with BNC cables amd an oscillscope. Similarly the earth-sun distance is 8 light-minutes.These feel right, like measuring mass in stone for people, kilos for sugar, carat for diamonds, electron-volts for particles etc.
- FreeFull 5y agoPianos are more complicated, because they also use stretched octaves that aren't just a simple 2:1 ratio, due to inharmonicity of the thick bass strings. There are only a few exceptions, where instead of thicker strings the piano was made really long.
- GuB-42 5y ago12 tone equal temperament is all wrong, but never by much, and it is very convenient, so almost everyone uses it.
- saghm 5y ago> In music, the frequency ratio of a semitone is ideally 2^(1/12), but without some tiny fudging (called tuning), you can't make harmonies as the frequencies almost but don't quite line up right IIRC correctly, it's not just harmonies; the range of a piano is big enough that if you tune each octave exactly based on that ratio, you'll end up with the first and last octaves sounding off from each other.
- woah 5y agoIf the maximum size of your number type is anywhere within 10x of your largest values you should definitely be using a larger number type. It’s just a way to write down a number. It’s like getting mad about the fact that negative numbers when written by hand require an extra character
- chriswarbo 5y ago> It’s like getting mad about the fact that negative numbers when written by hand require an extra character. Now that you mention it, that convention does make me mad. Not because I have to write an extra character, but due to operations getting mixed-up based on implied context. For example: Unary + is implicit: 3 = +3 Addition is written as juxtaposition: +2+5 = add(+2, +5) = +7. The first number can have an implicit sign, e.g. 2+5 = +2+5 "Subtraction" is a redundant operation; it's just addition involving a negative number: 8-3 = +8-3 = add(+8, -3) = +5. The nice thing about this perspective is that subtraction commutes: +8-3 = -3+8. What's annoying is that we also take juxtaposition to mean multiplication, and this flip-flops depending on implicit characters like unary '+'. For example: -8-3 = add(-8, -3) -8+3 = add(-8, +3) ab = multiply(a, b) 2a = multiply(2, a) a2 = multiply(2, a) (non-idiomatic) -2a = multiply(-2, a) a-2 = add(a, -2) This isn't just a problem when mixing variables with literals, since juxtaposition of literals also means multiplication (as long as they parse to separate numbers), e.g. '13' is a two-digit number, but: (1)(3) = multiply(1, 3) (-1)(-3) = multiply(-1, -3) -1-3 = add(-1, -3) -1(-3) = multiply(-1, -3) (-1)-3 = add(-1, -3) Note that we can do the same thing for multiplication and division, if we have a uniary reciprocal operator, e.g. ÷2 = 1/2. That way, division is just multiplication involving an inverse number, which commutes; e.g. 6÷2 = 6×÷2 = multiply(6, ÷2) = multiply(6, 1/2) = multiply(1/2, 6) = ÷2×6. This seems weirder than the case of addition/subtraction, probably because we already have the horizontal-bar notation for division, which seems even nicer. Note that the "÷" character itself is simply an inline approximation of the horizontal-bar notation (with placeholders above and below); the "foo/bar" notation is a more direct inline approximation (no placeholders, just 'tipping' the bar). Interestingly we don't use "bar\foo" to mean the same thing.
- potiuper 5y ago
- joppy 5y agoI feel the same way - if computers happened to use base 3 instead of base 2 we could have fixed-width signed integers which are symmetric about zero.