Skip to content

Fix singular Z2m ring creation and polynomial comparison#40855

Merged
vbraun merged 1 commit intosagemath:developfrom
user202729:fix-singular-z2m
Oct 27, 2025
Merged

Fix singular Z2m ring creation and polynomial comparison#40855
vbraun merged 1 commit intosagemath:developfrom
user202729:fix-singular-z2m

Conversation

@user202729
Copy link
Contributor

@user202729 user202729 commented Sep 20, 2025

See the new test, previously it fails.

The n_Z2m ring creation is caused by #39075.

Singular source code contains

      // is exponent <=2^(8*sizeof(unsigned long))
      mp_bitcnt_t l=mpz_scan1 (modBase,0);
      if ((l>0) && (l<=8*sizeof(unsigned long)))
      {

so the limit is taken from there.

The polynomial comparison fix is workaround for Singular/Singular#1293. #39018 touches this part of the code, although I think it doesn't introduce the bug.

Fix #40838

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@user202729 user202729 force-pushed the fix-singular-z2m branch 2 times, most recently from 052cbc8 to 23522a2 Compare September 20, 2025 12:04
@github-actions
Copy link

Documentation preview for this PR (built with commit 4d557f2; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

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

LGTM.

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 20, 2025
sagemathgh-40855: Fix singular Z2m ring creation and polynomial comparison
    
See the new test, previously it fails.

The `n_Z2m` ring creation is caused by sagemath#39075.

Singular source code contains

```
      // is exponent <=2^(8*sizeof(unsigned long))
      mp_bitcnt_t l=mpz_scan1 (modBase,0);
      if ((l>0) && (l<=8*sizeof(unsigned long)))
      {
```

so the limit is taken from there.

The polynomial comparison fix is workaround for
Singular/Singular#1293. sagemath#39018 touches this
part of the code, although I think it doesn't introduce the bug.



Fix sagemath#40838

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#40855
Reported by: user202729
Reviewer(s): Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 26, 2025
sagemathgh-40855: Fix singular Z2m ring creation and polynomial comparison
    
See the new test, previously it fails.

The `n_Z2m` ring creation is caused by sagemath#39075.

Singular source code contains

```
      // is exponent <=2^(8*sizeof(unsigned long))
      mp_bitcnt_t l=mpz_scan1 (modBase,0);
      if ((l>0) && (l<=8*sizeof(unsigned long)))
      {
```

so the limit is taken from there.

The polynomial comparison fix is workaround for
Singular/Singular#1293. sagemath#39018 touches this
part of the code, although I think it doesn't introduce the bug.



Fix sagemath#40838

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#40855
Reported by: user202729
Reviewer(s): Travis Scrimshaw
@vbraun vbraun merged commit d735455 into sagemath:develop Oct 27, 2025
24 of 25 checks passed
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.

Overflow in singular polynomial rings

3 participants