I am experiencing a very strange phenomenon. I am coding up a CFD code solving a totally hyperbolic problem. Governing Equation is compressible inviscid Euler equations. If you take a look at the following two lines:
they are completely the same! Except that I put extra parenthesis, which are trivial. The strange phenomenon is, the time history results are firstly same, then quickly different, and are different throughout the time range I am interested. Does anyone have similar experiences?
How different is "different"? The bracketing may affect the order of evaluation, so floating-point rounding might lead to very small differences. If any terms haven't been initialised (look, in particular, at your "minus 1" and "plus 1" density*velocity and gradient terms at boundaries) then this would also lead to differences (and be a significant error).
On an unrelated note, your weights look a bit unusual and since those inside the bracket add up to 2.0 then I'm surprised to see 2.0 and not 0.5 outside. However, only you know what you are doing with rinteg outside this code snippet.