Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!homxb!mtuxo!mtune!rutgers!im4u!ut-sally!husc6!cmcl2!brl-adm!adm!V4039%TEMPLEVM.BITNET@CUNYVM.CUNY.EDU From: V4039%TEMPLEVM.BITNET@CUNYVM.CUNY.EDU (Stan Horwitz) Newsgroups: comp.lang.c Subject: Re: parens honored Message-ID: <11205@brl-adm.ARPA> Date: 11 Jan 88 15:23:23 GMT Sender: news@brl-adm.ARPA Lines: 25 I have a suggest which allows numerical programmers to avoid using temporary variables in their C programs. Restructure your formula so in a way that C has no other option but to evaluate it correctly. This should eliminate most but not all, of the need for temporary variables. EXAMPLE: Given arrays X and Y, and XX, XY, and SSXY, the formula SSXY = SUM(XY)/N - SUM(X) * SUM(Y) / N where N is the number of elements in all of the arrays is part of the method of linear least squares regression. In order to get C to see this formula correctly, it can be reorganized to look like SSXY = (-SUM(Y) * SUM(Y) + SUM(XY)) / N. In this form, there can be no ambiguity (or misinterpretation) as to how the formula is to be computed by any compiler. Oops, almost forgot, the function SUM will take an array of size N and return the sum of it's elements. Don't worry about what types things are. Just assume every thing is interger with the exeption of SSXY which could be of type float. This allows the evaluation of the formula with no need to computer temporary variables. Stan Horwitz V4039 at TEMPLEVM.BITNET Philadelphia, PA