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
Bad sign in sign_mantissa_exponent() methods #14448
Comments
Attachment: trac_14448_sign_of_mantissa-tm.patch.gz Tested on sage 5.9.beta5 |
This comment has been minimized.
This comment has been minimized.
Changed keywords from mpfr, float to mpfr, RDF |
comment:2
I'm guessing this is ready for review? Looks good, but one small thing, could you change line 2930 in
or something to this extent, noting the problem was fixed in this ticket? Thanks, Travis |
comment:3
I think it's a bug that the mantissa of 1 and -1 are different. |
Patch updated so that it quotes this trac ticket |
comment:5
Attachment: trac_14448_sign_of_mantissa-tm.2.patch.gz I added the reference to this trac ticket. I also put this ticket under review. |
comment:6
Looks good to me. |
Reviewer: Travis Scrimshaw |
Author: Thierry Monteil |
This comment has been minimized.
This comment has been minimized.
Merged: sage-5.10.beta0 |
The
.sign_mantissa_exponent()
methods of theRealNumber
andRealDoubleElement
classes give a negative mantissa when the number is negative, which does not corresponds to the behaviour described in the documentation :http://www.sagemath.org/doc/reference/rings_numerical/sage/rings/real_mpfr.html
http://www.sagemath.org/doc/reference/rings_numerical/sage/rings/real_double.html
We propose here to fix it.
By the way, the variable name '
mantissa
' sometimes (always?) appears in the source with the meaning of a signed mantissa. I would suggest to renamed itsigned_mantissa
ors_mantissa
to ease code reading (though i do not feel able to detect which one is signed or not along the code). See for example the.exact_rational()
method inreal_mpfr.pyx
.Apply: attachment: trac_14448_sign_of_mantissa-tm.2.patch
CC: @jasongrout @zimmermann6
Component: basic arithmetic
Keywords: mpfr, RDF
Author: Thierry Monteil
Reviewer: Travis Scrimshaw
Merged: sage-5.10.beta0
Issue created by migration from https://trac.sagemath.org/ticket/14448
The text was updated successfully, but these errors were encountered: