4 ms·
A question of naivety--why bother with checking by "casting out 9's". Isn't it simpler to simply redo the calculation and check if you get the same result? If y
by giberson 15y ago
A question of naivety--why bother with checking by "casting out 9's". Isn't it simpler to simply redo the calculation and check if you get the same result? If you're concerned that you multiplied wrong isn't it just as likely you'll perform a bad check calculation resulting in a false negative/false positive?
- copper 15y agoSpeaking from painful experience: my problem with redoing the calculation is that whatever I did tends to stick in memory, with the inevitable result that I do exactly the same mistake again. Check calculations like this are much easier to do mentally, and provide a rough measure of confidence in the rightness of the result.
- kragen 15y agoCasting out nines has a couple of advantages over simply redoing the calculation: • as the other commenter mentioned, it's much less likely that you'll repeat the same error, because you'd have to do it in a totally different way; • if the numbers are more than two digits, it's much less work to do casting out nines than to redo the calculation. Multiplying 38020562 by 95942, using the standard algorithm, you have to do 40 digit multiplications, 32 carries, and then sum five six-digit partial products (about another 25 additions) to get your final sum of 14 or so digits; that's a total of 97 operations. Checking it by casting out nines involves only about 26 operations, which can be simplified further by casting out some nines ahead of time — 95942, for example, is obviously 2 mod 9 because the other digits are 9, 9, and 5+4 = 9. (Side note: is it worthwhile to use Karatsuba multiplication to multiply 38020562 by 95942 by hand?)