Order of operators

Jim Bufalini jim at visitrieve.com
Thu Aug 27 09:55:21 EDT 2009


Mark Schonewille wrote:

 
> I need to calculate
> 
> 1*2+3-4/5^6
> 
> as
> 
> ((((1*2)+3)-4)/5)^6
> 
> rather than
> 
> (1*2)+3-(4/(5^6))
> 
> without using brackets. This should increase speed performance. Any
> ideas?

Not sure about no brackets without multiple puts into vars (which should add
time), but for less brackets:

put ((1*2+3-4)/5)^6

Answer is the same due to brackets, precedence of operators (* before +) and
left to right calculation (+ before -). 

But, I'm curious. How much time do brackets add? It's something I never
thought of.

Aloha from Hawaii,

Jim Bufalini




More information about the use-livecode mailing list