Skip to content

sqrt(Mod(,)) produces a result from some extended ring when no square roots exist #38803

@maxale

Description

@maxale

Steps To Reproduce

Check this out:

sage: is_square(Mod(2, 101010))
False
sage: sqrt(Mod(2, 101010))
sqrt2
sage: _.parent()
Univariate Quotient Polynomial Ring in sqrt2 over Ring of integers modulo 101010 with modulus x^2 + 101008

Expected Behavior

As is_square() tells us, Mod(2, 101010) is not a square and thus computing sqrt(Mod(2, 101010)) should raise a ValueError.

Actual Behavior

Instead, it produces a result from some extension ring. Sage should not do so, unless it is explicitly asked to look for a root in a wider ring.

Additional Information

See #38802 for a related issue with parameter all=True.

Environment

  • OS: Ubuntu 24.04.1 LTS
  • Sage Version: 10.5.beta6

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions