Post Reply 
Plus42 Equations, Preview Release
03-31-2022, 08:00 AM (This post was last modified: 03-31-2022 08:04 AM by toml_12953.)
Post: #481
RE: Plus42 Equations, Preview Release
(03-30-2022 10:38 PM)Albert Chan Wrote:  
(03-30-2022 08:01 PM)Thomas Okken Wrote:  Hmmm... for all integer exponents?

Python limited integer squaring to +/- 100, "normal" complex pow beyond that.
source: complexobject.c, static Py_complex c_powi(Py_complex x, long n)

This is Python 2.6 (newer version is similar)

>>> z = 3+4j
>>> z100 = z**100
>>> abs(z - z**101/z100), abs(z - z100/z**99)
(2.4565801279300335e-14, 9.9301366129890925e-16)
>>>
>>> z = 4+5j
>>> z100 = z**100
>>> abs(z - z**101/z100), abs(z - z100/z**99)
(1.7680105590573434e-14, 0.0)

Here's what the later version looks like:
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> z = 3+4j
>>> z100=z**100
>>> abs(z - z**101/z100), abs(z - z100/z**99)
(4.631533241295194e-14, 9.930136612989092e-16)
>>>
>>> z = 4+5j
>>> z100 = z**100
>>> abs(z - z**101/z100), abs(z - z100/z**99)
(1.855102611454866e-14, 0.0)
>>>

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Plus42 Equations, Preview Release - toml_12953 - 03-31-2022 08:00 AM



User(s) browsing this thread: 1 Guest(s)