FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Now passing test_math from 3.13.2 with some caveat by hbina · Pull Request #5610 · RustPython/RustPython · GitHub

Now passing test_math from 3.13.2 with some caveat - #5610

Merged
youknowone merged 1 commit into
RustPython:mainfrom
hbina:hbina-fix-py313-test-math
Apr 5, 2025
Merged

Now passing test_math from 3.13.2 with some caveat#5610
youknowone merged 1 commit into
RustPython:mainfrom
hbina:hbina-fix-py313-test-math

Conversation

hbina commented Mar 15, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

There are incompatibilities in the implementation of fma from libc vs musl.

I have added the tests that shows the differences here,

#[test]
fn fma_negative_zero() {
    let tiny = 1e-300;
    assert!(libm::fma(tiny, tiny, 0.0).is_sign_positive());
    // TODO: RUSTPYTHON incompatibility between fma inside libc and musl
    // assert!(libm::fma(tiny, -tiny, 0.0).is_sign_negative());
    assert!(libm::fma(-tiny, -tiny, 0.0).is_sign_positive());
    // TODO: RUSTPYTHON incompatibility between fma inside libc and musl
    // assert!(libm::fma(-tiny, tiny, 0.0).is_sign_negative());
    assert!(libm::fma(tiny, tiny, -0.0).is_sign_positive());
    assert!(libm::fma(tiny, -tiny, -0.0).is_sign_negative());
    assert!(libm::fma(-tiny, -tiny, -0.0).is_sign_positive());
    assert!(libm::fma(-tiny, tiny, -0.0).is_sign_negative());
}

hbina force-pushed the hbina-fix-py313-test-math branch 2 times, most recently from 4dd3ff8 to 594a330 Compare March 23, 2025 13:42
Comment thread Lib/test/test_math.py

Copy link
Copy Markdown
Member

I am a bit confused by the libc vs musl situation. Which version fits to CPython behavior? Does CPython follow musl implementation?
libm's README says it is a port of musl implementaiton. So if we follow the libm implementation, is it compatible to CPython?

hbina commented Mar 30, 2025

Copy link
Copy Markdown
Contributor Author

CPython uses the system's libm, so on most system its probably going to be libc's libm. Meanwhile, the Rust's libm is based on musl's libm.

Comment thread Lib/test/test_math.py Outdated
Comment thread stdlib/src/math.rs Outdated
Comment thread stdlib/src/math.rs Outdated
Comment thread stdlib/src/math.rs Outdated
hbina force-pushed the hbina-fix-py313-test-math branch from ee05a75 to 7191aae Compare April 1, 2025 09:53
Implemnted fma in math module.
hbina force-pushed the hbina-fix-py313-test-math branch from 7191aae to af42192 Compare April 5, 2025 03:17
youknowone changed the title Now passing test_math from 3.12.2 with some caveat Now passing test_math from 3.13.2 with some caveat Apr 5, 2025

youknowone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks!

youknowone merged commit d800a6b into RustPython:main Apr 5, 2025
hbina deleted the hbina-fix-py313-test-math branch April 5, 2025 08:08
Shakil582 pushed a commit to Shakil582/RustPython that referenced this pull request Apr 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL