|
Carbon dioxide posted:There are no decimals. The chip supports all integer values between -999 and +999 inclusive (but the in/output on the analog p0 and p1 pins is always mapped to a number between 0 and 100). You don’t need decimals to be able to turn division into multiplication. If we look at algebra, what computers do is basically computations in the ring Z/nZ where n is the number of different numbers (so 1999 in the example, often 232 or 264 in real computers). That means computation is not our regular operations, but rater the operations “modulo n,” which is good enough in most cases. modulo just means “the remainder after division by n,” so for example 4 + 7 modulo 10 is 11 modulo 10 = 1 and 3 * 5 modulo 10 = 15 modulo 10 = 5. The reason this is useful for division is because it is possible for two integers to be multiplied and get 1. For example, 3 * 7 modulo 10 = 21 modulo 10 = 1. In a sense, 7 = 1/3 modulo 10. Consider 9 / 3 = 3. Also, 9 * 7 modulo 10 = 63 modulo 10 = 3. Hey, that works! Similarly, 6 * 7 modulo 10 = 42 modulo 10 = 2. The condition for a number to have an inverse is that it has to be coprime with n. That means the largest common factor between the number and n has to be one. For example, 2 does not have an inverse modulo 10; we cannot find a number that multiplied with 2 yields a number with remainder 1 when divided by 10 (such a number would be odd, and 2 multiplied by any integer is even) because 2 and 10 have a common factor of 2. 4, 5, 6, and 8 also don’t work, but the inverse of 9 is 9 (9 * 9 modulo 10 = 81 modulo 10 = 1, so division and multiplication by 9 is the same modulo 10). For this machine, though, n = 1999, which is a prime. That means that *every* number has an inverse, and we can divide by any number using multiplication! (Assuming that the machine behaves “sensibly” for a certain value of sensibly during overruns.). Try dividing by 42 by multiplying by 238 (after adding 999 to move the value to the interval 0-1998). We have to be careful with fractions; for example, what is 8 / 3? Well, 8 * 7 modulo 10 = 56 modulo 10 = 6, which seems a bit weird; we would expect either 2 or 3. 6 is the correct answer, though, because 6 * 3 modulo 10 = 18 modulo 10 = 8. This corresponds to how we can compute a - b by finding the inverse of b (often called -b) and using addition as a - b = a + (-b). This actually has uses in cryptography. klafbang fucked around with this message at 22:07 on Aug 16, 2018 |
# ¿ Aug 16, 2018 22:04 |
|
|
# ¿ Apr 29, 2024 12:37 |
|
Sydin posted:Yeah I've liked the LP direction so far of "show off a rudimentary design that fulfills the specs but nothing more, then a second round of refining the solution and explaining it. It's pretty much how I approached the game back when I was obsessed with it: first you solve the problem, then you solve it elegantly. I agree with this, and add that I also like that the “best” solution isn’t shown but left as an exercise to the thread.
|
# ¿ Aug 25, 2018 00:42 |
|
AceOfFlames posted:I think there's a sci-fi story about something like this, though I don't remember what it was called. Maybe you're thinking of reality
|
# ¿ Sep 1, 2018 13:56 |
|
Quackles posted:This strikes me as something that could work, though I have to wonder - who would want that many sandwiches made in an automated manner (as opposed to making them themselves)? What if you fill the mustard compartment with mayo? The keypad still says 'mustard'. What about if you want extra cheese and no mustard? Kickstarter it, but add DRM bread and an iPhone app.
|
# ¿ Sep 6, 2018 20:56 |
|
If somebody likes X86 assembler, I can recommend these videos. The first one explains in simple terms (relatively) how the Meltdown vulnerability is exploited. https://www.youtube.com/watch?v=I5mRwzVvFGE These videos are much more involved; the first explains how this guy built a tool to find undocumented operations in CPUs: https://www.youtube.com/watch?v=KrksBdWcZgQ The second one explains how the same guy used that tool (from last year) to find an exploit in an obscure X86 clone that is millions of times worse than Meltdown: https://www.youtube.com/watch?v=_eSAF_qT_FY
|
# ¿ Sep 14, 2018 21:09 |
|
Foxfire_ posted:Conversely, there's a bunch of important optimizations for fancy chips that compilers are much better at doing than people. The big reason for doing hand optimization is to make sure the branch prediction makes the right guesses (or doesn't have to make a guess by transforming conditional to algebraic computations or loop-ups). Secondary, once you've spent a week or two hand-optimizing a tight loop, you get ideas for adjustments to the algorithm. I once worked on invisible watermarking of live video, and after standard vectorization and linearization, we made an adjustment to a precomputed grayscale gradient from 64 to 16 or 32 levels, allowing us to use in-CPU look-up-tables.
|
# ¿ Sep 19, 2018 12:07 |
|
Hotel security is typically super lax. I once stayed at one where the key system was broken, so after supplying me with 2-3 reprogrammed keycards, they just gave up and gave me a master key that could open every door at the hotel. When that is the attitude of the staff, there’s little reason in trying to make the technology any kind of tamper proof.
|
# ¿ Nov 4, 2018 11:46 |
|
|
# ¿ Apr 29, 2024 12:37 |
|
Want the cool verdion https://m.youtube.com/watch?v=1CqS3pRUbBI Or the practical version? https://www.hackster.io/sidlauskas/barbot-cocktail-mixing-robot-0318aa
|
# ¿ Dec 14, 2018 07:03 |