ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 12 Oct 2022 01:04:05 +0200Changing the meaning of /https://ask.sagemath.org/question/64395/changing-the-meaning-of/ I have a program that makes some calculations in a ring R, where R may be either approximate real numbers (for which I am using RealField(20), or approximate p-adic numbers, for which I use Zp(p,prec=numbits).
I need to do division. If R is RealField, I can just use /, but // is undefined. If R is Zp, / complains if the denominator is a non-unit. Fine, this makes sense, but I want it to makes its best guess, which is implemented by //.
Anyway, the formulas I have involve dividing. I'd rather use the same functions for some calculations, no matter what R is. How can I overload / in Zp to do what // does, even in the case of non-units? Or // in RealField() to be /?John LWed, 12 Oct 2022 01:04:05 +0200https://ask.sagemath.org/question/64395/possible bug in: _cmp_ functionhttps://ask.sagemath.org/question/48658/possible-bug-in-_cmp_-function/Hello,
on a 2019-release of sage, the following behaviour was observed:
After defining:
R = Zp(5)
a = R(5, 6)
b = R(10)
an inconsistent output was given for `a<b` and `b>a`:
a<b
False
b>a
True
Is this a bug, or should the output not be consistent here for some reason?
P.S: The comparison function is implemented in the file: `padic_generic_element.pyx`
Thank you.noaWed, 06 Nov 2019 21:23:41 +0100https://ask.sagemath.org/question/48658/