GeezerVison is showing github.com — Now passing test_math from 3.13.2 with some caveat by hbina · Pull Request #5610 · RustPython/RustPython
Conversation
hbina
commented
Mar 15, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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());
}
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
youknowone reacted with thumbs up emoji
Uh oh!
There was an error while loading. Please reload this page.
|
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?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Implemnted fma in math module.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Shakil582
pushed a commit
to Shakil582/RustPython
that referenced
this pull request
Apr 6, 2025
Implemnted fma in math module.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|