Skip to content

Use numerator when calling "roots" on element of fraction field#4450

Open
d-torrance wants to merge 1 commit into
Macaulay2:developmentfrom
d-torrance:roots
Open

Use numerator when calling "roots" on element of fraction field#4450
d-torrance wants to merge 1 commit into
Macaulay2:developmentfrom
d-torrance:roots

Conversation

@d-torrance

Copy link
Copy Markdown
Member

This used to segfault. Also add some unit tests.

Before

i1 : R = QQ[x];

i2 : roots((x - 1)/x)
-- SIGSEGV
-* stack trace, pid: 103461
 0# profiler_stacktrace(std::ostream&, int) at /usr/src/macaulay2-1.26.06+git202606141309-0ppa202606152342~ubuntu24.04.1/M2/Macaulay2/d/main.cpp:128
 1# segv_handler at /usr/src/macaulay2-1.26.06+git202606141309-0ppa202606152342~ubuntu24.04.1/M2/Macaulay2/d/main.cpp:244
 2# 0x000079654F245330 in /lib/x86_64-linux-gnu/libc.so.6
 3# rawRoots at interface/polyroots.cpp:30
 4# interface_rawRoots at /usr/src/macaulay2-1.26.06+git202606141309-0ppa202606152342~ubuntu24.04.1/M2/Macaulay2/d/interface.dd:1517
 5# evaluate_evalraw at /usr/src/macaulay2-1.26.06+git202606141309-0ppa202606152342~ubuntu24.04.1/M2/Macaulay2/d/evaluate.d:1662
 6# evaluate_evalSequence at /usr/src/macaulay2-1.26.06+git202606141309-0ppa202606152342~ubuntu24.04.1/M2/Macaulay2/d/evaluate.d:457
...

After

i1 : R = QQ[x];

i2 : roots((x - 1)/x)

o2 = {1}

o2 : List

AI Disclosure

Claude helped with the C++ code

This used to segfault.  Also add some unit tests.
@d-torrance d-torrance added the Engine Macaulay2/e label Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Engine Macaulay2/e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant