On Tue, Oct 15, 2002 at 01:29:36AM -0400, Tim Peters wrote: > BTW, if we know we're not interested in anything other than 32-bit products, > > double _prod = (double)src1 * (double)src2; > if (_prod < 4294967296.0) /* 2**32 */ > result = (size_t)_prod; > else > overflow; s/_prod;/src1 * src2;/ Re-calculating the product with integer multiplication is probably faster than converting a double to integer on any sane CPU. I wonder if the old SPARCs that don't have an integer multiply instruction actually have a floating point to integer conversion that is faster than integer mul. Wasting "expensive" multiplications this way still feels blasphemous :) Oren
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4