Skip to content

Implement asin and acos in cmath - #3200

Closed
egemengol wants to merge 1 commit into
RustPython:mainfrom
egemengol:cmath-asin-acos
Closed

egemengol wants to merge 1 commit into
RustPython:mainfrom
egemengol:cmath-asin-acos

Conversation

@egemengol

Copy link
Copy Markdown

These functions show a weird rounding error like this:

Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 🖖
>>>>> import cmath
>>>>> cmath.acos(0.2)
(1.369438406004566+0.00000000000000011102230246251565j)
>>>>> cmath.asin(0.2)
(0.20135792079033082+0.00000000000000011102230246251565j)

For which CPython returns:

Python 3.9.7 (default, Oct  1 2021, 17:26:30) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cmath
>>> cmath.acos(0.2)
(1.369438406004566-0j)
>>> cmath.asin(0.2)   
(0.20135792079033082+0j)

The tests are ignored for the moment, see here

Docstrings are copied from CPython docs.

@egemengol
egemengol marked this pull request as ready for review October 2, 2021 13:46
@egemengol

egemengol commented Oct 2, 2021 •

Copy link
Copy Markdown
Author

Please note that the imaginary part of the result of acos should be negative zero but it is positive something instead.

@Snowapril

Snowapril commented Oct 2, 2021 •

Copy link
Copy Markdown
Contributor

Ah.. I think duplicated #3198 here 😢

@DimitrisJim DimitrisJim mentioned this pull request Oct 2, 2021
16 tasks done
@egemengol

Copy link
Copy Markdown
Author

It seems so, please close at will :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants