Skip to content

exp(0) does not work in p-adic extension #38037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
luiscresporuiz opened this issue May 20, 2024 · 2 comments · Fixed by #39479
Closed
2 tasks done

exp(0) does not work in p-adic extension #38037

luiscresporuiz opened this issue May 20, 2024 · 2 comments · Fixed by #39479
Assignees

Comments

@luiscresporuiz
Copy link

luiscresporuiz commented May 20, 2024

Steps To Reproduce

Run the following three lines:

R.<a>=Zq(9,prec=5)
zero=R.zero()
exp(zero)

Expected Behavior

The number 1 in R (the same as R.one())

Actual Behavior

Sage gives an error:
ValueError: unit part of 0 not defined

Additional Information

No response

Environment

- **OS**: Ubuntu 22.04
- **Sage Version**: 10.2

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
@fchapoton
Copy link
Contributor

Handling zero has to be fixed in sage.rings.padics.padic_generic_element.pAdicGenericElement._exp_generic

@Noel-Roemmele
Copy link
Contributor

Dave Morris has assigned this to me to be fixed.

@Noel-Roemmele Noel-Roemmele self-assigned this Feb 19, 2025
vbraun pushed a commit to vbraun/sage that referenced this issue Feb 21, 2025
sagemathgh-39479: Fixed crash when exp(0) of p-adic numbers is called
    
Fixes sagemath#38037. Fixes crash when exp(0) is called when using p-adic
numbers. Since the unit part of 0 does not exist it was causing a crash.
Therefore, to fix this bug we check if our exponent is exactly 0 and if
it is return 1 immediately. Also added a doctest to verify that the
issue has been fixed.

### 📝 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
    
URL: sagemath#39479
Reported by: Noel-Roemmele
Reviewer(s):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants