Re: My problem in C

@119
If you don't know how this works, it would be a *very* good idea for you to find some math resources, because it's the kind of thing school teaches when you're 10 or so.  I'm afraid I don't have anything at that level, but you should know these rules from that and if you didn't learn them then you missed a *lot* of critical math that you're going to have to make up for.  But basically:

x * 3 = 0 + x + x + x
x * -3 = 0 - x - x - x
x * 1 = 0 + x
x * -1 = 0 - x

Or put another way, multiplying by positive numbers is adding to 0 n times.  5*x = 5 copies of x put together.  And multiplying by negative numbers is taking away copies of x, x*-5 is tart at 0 and take away 5 x.  You get the rules for signed multiplication from this and the normal rules of addition for positive and negative numbers (i.e. positive plus negative is positive minus positive, etc).

As for why, no reason other than it's useful.  All of math is no reason other than it's useful.  It lets you write large chains of subtraction without having to literally do like x - x - x - x forever, in the same way normal multiplication lets you write large chains of addition.  The fact that multiplying by -1 "flips" about 0 is just a side effect.  SOmetimes a very useful side effect: it can model, for example, you handing me $10, because I get +$10 and you get -$10 and we can do that transformation with multiplication by -1, but mostly it's a consequence of being consistent about the rules.



-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector

Reply via email to