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/2011-April/111106.html below:

[Python-Dev] Not-a-Number

[Python-Dev] Not-a-NumberNick Coghlan ncoghlan at gmail.com
Fri Apr 29 08:35:21 CEST 2011
On Fri, Apr 29, 2011 at 3:28 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Robert Kern wrote:
>> Actually, Python treats all NaNs as quiet NaNs and never signalling NaNs.
>
> Sorry, did I get that backwards? I thought it was signalling NANs that cause
> a signal (in Python terms, an exception)?
>
> If I do x = 0.0/0 I get an exception instead of a NAN. Hence a signalling
> NAN.

Aside from the divide-by-zero case, we treat NaNs as quiet NaNs. This
is largely due to the fact float operations are delegated to the
underlying CPU, and SIGFPE is ignored by default. You can fiddle with
it either by building and using the fpectl module, or else by
switching to decimal.Decimal() instead (which offers much finer
control over signalling through its thread local context information).
The latter is by far the preferable course, unless you're targeting
specific hardware with well-defined FPE behaviour.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

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