So you’re saying there’s been a bug for at least 14 years in 4D math operations 
when running compiled and it’s never been fixed. How hard can it be? Saying to 
use parenthesis to ensure the order of operations is a workaround. Are we 
supposed to use parenthesis around every single math operation to make sure 4D 
obeys it’s own rules?

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

Not exactly easy to read.

And is the problem with exponentiation only related to addition or is it with 
others as well? Does

2*2^3

give a different result running compiled?

The language reference is very clear:

"The order in which an expression is evaluated is called precedence. 4D has a 
strict left-to-right precedence, in which algebraic order is not observed...To 
override the left-to-right precedence, you MUST use parentheses.”

The manual does not list an exception to this rule for exponentiation when 
running compiled and it’s crazy that we can’t depend on math to be performed 
the same compiled vs interpreted.

------------------------------------------------
Richard Wright
DataDomain
rwri...@datadomainsoftware.com
------------------------------------------------


> Date: Thu, 28 Sep 2017 18:16:25 +0000
> From: Timothy Penner <tpen...@4d.com>
> 
> Parenthesis should always be used with 4D's math operations as a way to force 
> the order of operations.
> 
> If you do not use Parenthesis then you may find different values in compiled 
> mode vs interpreted mode -
> 
> For example:
> 
> interpreted: 2+2^3=64
> compiled: 2+2^3=10
> 
> This behavior has existed since at least 4D 2003...
> 
> -Tim


**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to