64-bit ExponentVector weights and formatting truncate exponents to 32 bits
Nobody has claimed this yet.
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
The 64-bit dense representation used by `f4/ntuple-monomial.hpp` loses high exponent bits in `ExponentVector.hpp` weight evaluation and formatting.
```cpp
using Ops = ExponentVector;
int64_t a[] = {int64_t{1} << 40};
auto weight = Ops::weight(1, a, std::vector{1});
buffer out;
Ops::elem_text_out(out, 1, a, {"x"}, true);
```
Expected: weight `1099511627776`, text `x1099511627776`.
Actual: weight `0`, text `x`.
`weight` unconditionally uses the int32_t `safe::mult`/`safe::add` routines, even for the unchecked 64-bit instantiation. `elem_text_out` copies the exponent into an `int`. Ordinary multiplication, power, and simple_degree correctly preserve the same large input in the accompanying tests.
Reproduced with direct GoogleTest assertions in the Debug engine build at c156fdcba4, Apple Clang 21. No production changes.
### Failing unit-test blocks
- `TEST(ExponentVector, DISABLED_wideWeightsAndPrinting)` in `M2/Macaulay2/e/unit-tests/ExponentVectorTest.cpp`.
These regressions were explicitly run and confirmed to fail against the current implementation. They assert the intended corrected behavior and remain disabled in normal runs until the defect is fixed.
Run from the CMake build directory after building `M2-unit-tests`:
```sh
./Macaulay2/e/M2-unit-tests \
--gtest_also_run_disabled_tests \
--gtest_filter='ExponentVector.DISABLED_wideWeightsAndPrinting'
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with f4/ntuple-monomial.hpp and ExponentVector.hpp, then run the named disabled test in M2/Macaulay2/e/unit-tests/ExponentVectorTest.cpp using the provided GoogleTest command. Trace the wide weight and formatting paths shown by the failure. Done means the test passes with the expected 64-bit weight and text while existing tests remain passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100