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

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

  • Comments 13

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!


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

  • 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).  
  • KeithH,

    That's a great idea. And in fact, there is already suggestion for that.
    Feedback ID: 93727
    I hope this is still under consideration.
    As per 93727, I prefer overloading Double.Equals over a static.
  • Please, make it efficient like the Apfloat library and not crappy like JDK BigInteger... I always use large integer for statistical analysis and they are a must for me!
  • 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.
  • 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).

  • 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!
  • 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.
  • Interesting concept.  What sort of bounds, or limits, where you thinking?

    It would have to be really fast to get good adoption.
  • 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
  • Welcome new readers! There are a number of great posts that caught my attention today. In addition, I
  • 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

Page 1 of 1 (13 items)