Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A simplier math formula
Message
De
16/12/2008 07:55:26
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
16/12/2008 07:48:35
Information générale
Forum:
Politics
Catégorie:
Autre
Divers
Thread ID:
01367448
Message ID:
01367799
Vues:
6
>>>>>>>-2**2
>>>>>>>
>>>>>>>what the answer... I lost my bet with my secondary schoolgirl daughter... :(
>>>>>>4
>>>>>
>>>>>VFP says 4 but online math calculator, my math. eng. friend and my daughter say -4... :(
>>>>
>>>>Probably it has been said already as I am not following the thread, but -2**2 = -2*-2 =4
>>>
>>>Nope: -2**2 is the same as -1*2**2 so, by order or precedence, the answer is -4.
>>>
>>>See http://mathforum.org/library/drmath/view/69058.html
>>
>>BOK
>>
>>Hi Alan,
>>
>>Folks I'm upset.
>>
>>This is not the unary operator.
>>
>>The minus is just our representation for a negative number. -2 is just the number -2 not the negative of 2. It's just luck that the operation -1*2 returns -2.
>>
>>so if you write
>>
>>a=-2
>>?a^2
>>
>>
>>there is no question about the result.
>>
>>This problem is something bound to the numbering system we use. We are bound to the idea that we have 2, (8), 10, 16 as base for our numbering system. In this system - an unary operator makes some sense.
>>
>>But if you use a negative as base, things get clearer
>>
>>think about a base of -2
>>
>>so we get (parenthesis only for accuracy)
>>
>>Base -2 = Base 10
>>0 = 0
>>1 = 1  && n^0 is 1
>>10 = -2 && (-2)^1 = -2
>>11 = -1 && (-2)^1+(-2)^1 = (-2)+1
>>100 = 4 && (-2)^2 = (-2)*(-2)=4
>>
>>
>>so you see the term 10 represents -2 decimal. If you square this you square the number -2. There is no need for a negative sign.
>>
>>Same is with integers in comps
>>
>>You know
>>
>>we have (4 bit)
>>
>>Binary = decimal
>>0001 = 1
>>0010 = 2
>>0011 = 3
>>..
>>0111 = 7
>>
>>but
>>
>>Binary = decimal
>>1111 = -1
>>1110 = -2
>>
>>
>>so there is no question about the square of 1110?
>>
>>For the problem
>>
>>-a^2 
>>
>>I agree with you that the operation is
>>
>>-(a^2)
>>
>>
>>because a is some number and - is unary operator.
>>
>>Agnes
>>
>>Update:
>>
>>Ok. there seems to be the mad scientist have decided to need parenthesis in this case. I'm 100% that we have done this different in school and university. I realy like things like that that end up in usless arguments with the teachers
>>They simply should invent a new sign to distinct negative numbers from unary operator.
>>
>>We will end up with a new keyborad layout just to enter all those parenthesis (and a language that supports square bracket and curly brackets so get an idea what where we are).
>>
>>So this a sign that we should not use literals or constants. A variable shout return the expected value.
>>
>>And yes, vfp returns wrong value for -a^2
>>
>>Agnes
>
>Agnes, I hate to admit this, but I think you've confused me. I follow the argument you're making, no problem (even with the typing error in the line "11 = -1 && (-2)^1+(-2)^1 = (-2)+1"), but right at the beginning, you state This is not the unary operator. Then you go on until at the end you state that the result of -4 is correct because a is some number and - is unary operator. So... you said it isn't, then you said that it is. Nice elegant argument though. ;)

Not a typo - copy error (^.^)

The problem mit the "-" is that I've learned to use it as accidental sign with a number and unary operator an vars.

It might also be that sometimes during the study they mention the operator use. Hm - as we say here sometimes I was a student not studying.

Agnes
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform