Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Martin Ward Newsgroups: comp.compilers Subject: Re: Optimization techniques Date: Fri, 26 Apr 2019 20:10:10 +0100 Organization: Compilers Central Lines: 14 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <19-04-028@comp.compilers> References: <19-04-004@comp.compilers> <19-04-012@comp.compilers> <19-04-018@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="54988"; mail-complaints-to="abuse@iecc.com" Keywords: arithmetic Posted-Date: 26 Apr 2019 15:15:10 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:2212 On 23/04/19 08:43, David Brown wrote: > But mathematical identities such as associativity and commutativity are > valid because signed integer overflow does not happen - thus "a * (b + > c)" can be changed to "(a * b) + (a * c)". If b is large and c has a value close to -b then a * (b + c) might be OK while (a * b) will overflow and cause undefined behaviour. -- Martin Dr Martin Ward | Email: martin@gkc.org.uk | http://www.gkc.org.uk G.K.Chesterton site: http://www.gkc.org.uk/gkc | Erdos number: 4