|
|
|
|
|
by jvickers
1876 days ago
|
|
In JavaScript (specifically node / V8) if dividing multiple values by the same divisor, is it fastest to calculate the reciprocal and then multiply it? How about other languages (and compiler systems)? Are there binary tricks worth knowing about to quickly calculate reciprocals? |
|
However, when we enable `-ffast-math`, we permit the compiler to do a bit more aggressive optimization in this domain (trading off precision), and we see multiplication (mulss) is emitted: https://godbolt.org/z/KEb1nc43z