On Feb 15, 2017, at 2:56 PM, Peter Mew wrote: > APPEND TO ARRAY(StartSampleArray;($Start*<>SampleRate/75)) > > This does not always evaluate correctly when compiled > it shoud read > > APPEND TO ARRAY(StartSampleArray;$Start*(<>SampleRate/75)) > this fixes the problem
On Feb 15, 2017, at 4:11 PM, Chuck Miller wrote: > Actually you are correct only form a mathematical basis from 4D basis > evaluation occurs from left to right with not parens. It does not follow > mathematical constructs In the case that Peter is referring to, the difference in operation order that 4D uses and the standard order of operations has nothing to do with his problem. He is doing 2 operations: multiplication and division. Both 4D and the “standard" order for these 2 operators is left to right. The issue is that he is doing operations on longints values and the intermediate values of the formula calculation are also stored in a longint and he is overflowing what can be stored in a longint. 4D is calculating the formula value from left to right so the first operation is the multiplication — $Start * <>SampleRate. This causes a longint overflow sometimes and results in a negative number. Then the division operation is done. By adding parenthesis to the formula he forces the division — <>SampleRate / 75 — to occur first. The result of this operation is then multiplied by $Start; thus eliminating the possible overflow condition. Tim ******************************************** Tim Nevels Innovative Solutions 785-749-3444 timnev...@mac.com ******************************************** ********************************************************************** 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 **********************************************************************