A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-October/093055.html below:

[Python-Dev] Can 3.1 still be built without complex?

[Python-Dev] Can 3.1 still be built without complex? [Python-Dev] Can 3.1 still be built without complex?Mark Dickinson dickinsm at gmail.com
Thu Oct 15 21:42:50 CEST 2009
On Thu, Oct 15, 2009 at 8:17 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>>>> (-1)**.5
> (6.123031769111886e-17+1j)
>
> Don't we have a precision problem here? 0.5 is supposed to be represented
> exactly, isn't it?

0.5 is represented exactly, but complex.__pow__ makes no pretence of
being correctly rounded (and making it correctly rounded would likely
be prohibitively expensive in terms of code size and complexity).  It's
using something like x**y = exp(y*log(x)) behind the scenes, at least
for computing the argument of the result.

For square roots, cmath.sqrt produces better results.

Mark
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