Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Divide and C Message-ID: <15636@smoke.brl.mil> Date: 30 Mar 91 14:15:02 GMT References: <639@taumet.com> <1991Mar29.163422.14672@uunet.uu.net> <1991Mar29.182919.20728@helios.physics.utoronto.ca> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 12 In article <1991Mar29.182919.20728@helios.physics.utoronto.ca> neufeld@aurora.physics.utoronto.ca (Christopher Neufeld) writes: > Are there compilers which go to the trouble of hardcoding something >like this if they see division or multiplication by integer powers of >two, or do they all get lazy and assume a math coprocessor? Most compilers I've dealt with have optimized integer division and multiplication by constant powers of two into shift instructions, but not for floating-point operands. By the way, it is not necessarily "lazy" to rely on an FPU for speed. Anyone who has serious floating-point demands is going to get one anyway.