LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #17   Report Post  
Old May 9th 09, 09:40 AM posted to rec.radio.amateur.antenna
external usenet poster
 
First recorded activity by RadioBanter: Dec 2006
Posts: 1,169
Default Be careful when using Excel

"Antonio Vernucci" wrote in
:

Do you realise that the '-' in both expressions are quite different
in meaning, one is a unary negation operator, the other is the binary
subract operator.


I realise, but Microsoft apparently does not:

- for Excel: (-2^2 + 8) = 12
- for Visual Basic: (-2^2 + 8) = 4

They look pretty much the same

Not to a programmer!


I would expect that some programmers may get confused, due to the
inconsistency of software products of the same company.


Do not assume that all languages or all products use the same operator
precedence rules.

The Excel rules are spelled out in the Excel help.

The key thing is that there is a difference in the meaning of '-' in the
uses as the negation operator and subtraction operator, same symbol, two
meanings, you need to understand that when looking in the list of
operator precedence.

Excel spells out clearly that unary negation has higher precedence than
exponentiation, and subtraction is lower than both... so keep that in
mind when writing formulae.

If you are writing VB, use the precedence rules for VB. The VB rules
clearly state that exponentiation has higher precedence than negation,
and subtraction is lower. This may have its roots before the existence of
Microsoft.

Many languages do not have an exponentiation operator, requiring
functions instead (often pow()). Such use eliminates the operator
precedence issue.

PERL does have an exponentiation operator, and it is higher precedence
than unary + and -.

FORTRAN90 does have an exponentiation operator, and it is higher
precedence than unary + and -.

It is part of the programming landscape... algebraic expressions are not
universal, they need to be written for the specific language.

Now, I hear that you think that is a bad idea, but it isn't likely to
change. It is most unlikely that a new version of any language will
change operator precedence, it has too many issues.

Owen
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
everyone better be careful while building those shortwave radios [email protected] Shortwave 9 April 14th 08 08:50 PM
Be careful replying to off topic messages here! (La Site Communique) Dave Boatanchors 0 February 10th 04 10:15 PM
Be Careful What you Say on The Air Girls Dwight Stewart General 2 December 18th 03 02:22 AM
Be Careful What you Say on The Air Girls Dwight Stewart Scanner 2 December 18th 03 02:22 AM
Be Careful What you Say on The Air Girls Dwight Stewart Shortwave 2 December 18th 03 02:22 AM


All times are GMT +1. The time now is 03:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 RadioBanter.
The comments are property of their posters.
 

About Us

"It's about Radio"

 

Copyright © 2017