What's the relative speed of floating point add vs. floating point multiply

后端 未结 6 1203
小鲜肉
小鲜肉 2020-12-01 10:48

A decade or two ago, it was worthwhile to write numerical code to avoid using multiplies and divides and use addition and subtraction instead. A good example is using forwa

6条回答
  •  半阙折子戏
    2020-12-01 11:07

    The speed difference of * / vs + - depends on your processor architecture. In general and with x86 in particular the speed difference has become less with modern processors. * should be close to +, when in doubt: just experiment. If you have a really hard problem with lots of FP operations also consider using your GPU (GeForce, ...) which works as a vector processor.

提交回复
热议问题