![]() We talk about how you feel if someone gives you a positive thing, or if someone takes one away. With the students, we brainstorm on things that are POSITIVE and things that are NEGATIVE. I have a big number line ($^-10$ to $10$, say) above or along the top of my whiteboard. "I believe that adding and subtracting with negative numbers makes sense. Thanks to Alan Mesfin who suggested an alternative of tying on helium balloons (as in the film "Up") instead of adding puffs of hot air to represent adding a positive number. My balloon ends up at height +5.Įventually, we want students to read the calculation as "Four add negative two, subtract positive five, subtract negative one, add positive seven" (or replacing the operation words add/subtract with plus/minus, but always insisting on positive and negative for the signs accompanying the numbers), and think to themselves "Four, down two, down five, up one, up I add two sandbags (down two), subtract five puffs of hot air (down five), subtract one sandbag (up one), then add seven puffs of hot air (up seven). We can now describe a calculation such as 4 + (-2) - (+5) - (-1) + (+7) in the following way: In this model, we represent positive numbers as 'puffs' of hot air, and negative numbers as sandbags. The first model we offer is the hot air balloon, as seen in the game Up, Down, Flying Around. There are four possibilities that we need to be able to understand with our models: We will make suggestions about how to use language precisely in order to support the understanding of the distinction between operations and directed numbers. The models for teaching addition and subtraction of positive and negative numbers that we share in this article are designed to lead to understanding. For example, we have all heard students say things like "minus four minus two equals six, because two minuses make a plus!" We are often frustrated when we hear students say "Two minuses make a plus", because it shows a rote-learned phrase that is often misapplied. The original article is contained within this version. My hopes are that this post hasn't moved away from the original question.This article is an expanded version of one published on NRICH in 2008. I found that solution to be rather fun and decided to expand on it as it was just thrown in there and post people looking at it were probably ignoring it. The +1 will work because '+' has a higher precedence and will be evaluated later. I did try to swap them around but it seems that prefix is a little finicky compared to bitwise NOT. That will not work cause of precedence, postfix operators such as num++ would be evaluated before ~ and the reason prefix ++num wouldnt work even though it is on the same precedence as bitwise NOT(~), is cause it is evaluated from right to left. That will do the same but will invert first and then add 1 to the positive number.Īlthough you CANT do this: ~num++ //Wont display the right value. You can also do this: ~num+1 //Wont change the actual num value, merely returns the new value If we had bitwise inverted it normally we would get a value 1 too small. ![]() In simple terms, we take the negative number, take one away from it and then bitwise invert it. ![]() This soultion is very fancy in my opinion, we could rewrite it like this: ~(num = num-1) ~-num //Drawback for this is that num original value will be reduced by 1 I saw the bitwise solution here and wanted to comment on that one too. In this case i used tertiary operator cause I wanted to, it could very well be: if(num<0)num*=-1 For me it was simple, make it positive if negative, else do nothing. In case you want to assign it to something, you should probably do something like: var out = num<0?num*=-1:num //I think someone already mentioned this variant.īut it really depends what your goal is. This does return a value, its up to you if you capture it. It checks if the number is negative and if it is, multiply with -1
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |