A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-October/029603.html below:

[Python-Dev] Memory size overflows

[Python-Dev] Memory size overflows [Python-Dev] Memory size overflowsOren Tirosh oren-py-d@hishome.net
Wed, 16 Oct 2002 04:15:32 -0400
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