Compartilhar via


Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

Another set of functionality we may want to add in Orcas are classes which can be an integer of arbitrary length, and a double of arbitrary precision (which could essentially be the arbitrary length integer with a decimal offset).  Aside from this type itself, we are interested in what related functionality you would be looking for. 

  • What functions do you wish we had in System.Math that you could use on one of these types?
  • What types of conversions are you looking for (aside from conversion to int and double, respectively)
  • In what cases can you see these types being extremely useful?  Some we have identified are crypto and general scientific work.
  • IronPython (Python for .NET) already has an implementation of these types, what’s great about this type, and is there anything that you wish it had?

 

Looking forward to some great feedback!

            -Ari

Comments

  • Anonymous
    July 20, 2006
    Welcome new readers! There are a number of great posts that caught my attention today. In addition, I...
  • Anonymous
    July 20, 2006
    How would these types differ from BigInteger and BigDecimal that already exist in the J# libraries?

  • Anonymous
    July 20, 2006
    One thing missing from the BCL when dealing with floating point numbers is a way to compare those numbers to within epsilon and perhaps even an arbitrary (specified) epsilon.  With this in mind, I would like to see something like Math.AlmostEquals(double d1, double d2) and Math.AlmostEquals(double d1, double d2, double epsilon).  
  • Anonymous
    July 20, 2006
    KeithH,

    That's a great idea. And in fact, there is already suggestion for that.
    Feedback ID: 93727
    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=93727
    I hope this is still under consideration.
    As per 93727, I prefer overloading Double.Equals over a static.
  • Anonymous
    July 20, 2006
    The comment has been removed
  • Anonymous
    July 21, 2006
    How about some way of detecting if adding two doubles results in saturation? I can't find a way of doing this at present and I'd like to show users useful feedback rather than just returning Double.MaxValue.
  • Anonymous
    July 21, 2006
    Rounding methods, to specified number of decimal places:
    - 0.5 up,
    - 0.5 to even or odd
    - towards zero
    - away from zero
    - down
    - up
    (I think that covers all the possibilities).

  • Anonymous
    July 22, 2006
    Have you looked at the Numerical.Net blog? I link to it in the URL field. It has some excellent points on what scientific community would need in terms of additional math support. When you are looking at the math stuff anyways, please take those points into consideration!
  • Anonymous
    July 22, 2006
    And one more point. I have a fairly complex scientific model developed on top of .Net. One thing I haven't found a good solution for my case is divison by zero. With double, the variable gets a value of Double.PositiveInfinity assigned and the program continues to run. Now, in our case, this is almost always a sign of a bug and misspecification of the model code. But we end up with just all output having the value NaN or something like that and it is really, really difficult to find the point where this first buggy divison happened. Am I missing something here and there is an easy solution already? If not, maybe you could introduce some sort of model where instead of these special values exceptions are thrown.
  • Anonymous
    July 22, 2006
    Interesting concept.  What sort of bounds, or limits, where you thinking?

    It would have to be really fast to get good adoption.
  • Anonymous
    July 25, 2006
    I think it would be better named as "arbitrary precision decimal", since "Double" implies double-precision floating point, which seems entirely incorrect based on your description...

    -Ryan / Kardax
  • Anonymous
    September 10, 2006
    Welcome new readers! There are a number of great posts that caught my attention today. In addition, I
  • Anonymous
    December 04, 2008
    Welcome new readers! There are a number of great posts that caught my attention today. In addition, I have started my 3rd CAB article to be posted here as well as getting my Syracuse WCF slides up on the site. Agile/Extreme Programming/TDD Now, Scott