
28 Nov
2012
28 Nov
'12
11:14 a.m.
On 11/28/2012 08:02 AM, Christopher Howard wrote:
Say I have functions like so:
code: -------- circleRadians = 2 * pi
radius = (/ circleRadians) --------
My question: each time I call radius, will a division operation be performed? Is there anything to be gained, following the old adage that multiplication is more efficient than division in hardware, from something like:
This doesn't answer your question, but is an interesting read: http://stackoverflow.com/questions/12653787/what-optimizations-can-ghc-be-ex... I've seen a lot of surprising stuff come out of the optimizer. If you really want to know which is faster, try both ways.