-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
function for floating point representation of a number #7830
Comments
Attachment: trac-7830-floating_point_representation.patch.gz |
comment:2
Looks good. I don't like the name |
comment:3
parts() seems too vague. Maybe ieee_754_parts(), except that we support arbitrary precision, not just the set precisions they mention. Maybe floating_point_representation(), or sign_mantissa_exponent(). I'm willing to concede on the naming to make sure this gets in before I start my numerical analysis class in two weeks :). |
comment:4
Lets go with |
apply on top of previous patch |
comment:5
Attachment: trac-7830-change-name.patch.gz Okay, I added a patch which changes the name. This is hopefully ready for a positive review now :). |
comment:6
I see that you have only added this method to mpfr. Should we not preserve as much consistency as possible between the different real types by also adding it to real_double? |
comment:7
Very good point. I'll look at this. I might just end up creating an RR number and calling this method behind the scenes |
Attachment: trac-7830-sign_m_e.patch.gz apply on top of previous patches |
comment:8
I've added a similar function to RDF now. |
comment:9
http://en.wikipedia.org/wiki/IEEE_754-1985 The exponent for 0 should be 0. This also avoids the issue of platform dependance for that value, and Also, sage/rings/real_mpfr.pyx, line 1890 should be EXAMPLES:: |
Attachment: trac-7830-fixes.patch.gz apply on top of previous patches |
comment:10
The last patch fixes a few other documentation errors and an error in multiplicative_order too. For free. |
all four of the above folded into one |
comment:11
Attachment: 7830-real-rep-all.patch.gz Looks good. |
Merged: sage-4.3.2.alpha0 |
Author: Jason Grout |
Reviewer: Robert Bradshaw, John Cremona |
comment:13
The mantissa and exponent for MPFR is not the same as the mantissa and exponent for IEEE 754. So I'm a little doubtful about the choice to follow IEEE 754 conventions for the exponent value of 0. (but I'm not doubtful enough to change it). I just thought I'd point out that the values from MPFR are different than the conventions from IEEE 754 for the same floating point number. |
Here's a function that answers the question posed in http://groups.google.com/group/sage-devel/browse_thread/thread/c8c75b483f2c47f6 -- give the sign, mantissa, and exponent of a floating point number.
I also cleaned up a few minor other things.
Component: basic arithmetic
Author: Jason Grout
Reviewer: Robert Bradshaw, John Cremona
Merged: sage-4.3.2.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/7830
The text was updated successfully, but these errors were encountered: