Welcome to MSDN Blogs Sign in | Join | Help

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

Published Thursday, July 20, 2006 9:02 AM by BCLTeam
Filed under: ,

Comments

Thursday, July 20, 2006 2:23 PM by Sam Gentile

# New and Notable 110

Welcome new readers! There are a number of great posts that caught my attention today. In addition, I...
Thursday, July 20, 2006 3:01 PM by Greg Young

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

How would these types differ from BigInteger and BigDecimal that already exist in the J# libraries?

Thursday, July 20, 2006 4:52 PM by KeithH

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

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).  
Thursday, July 20, 2006 8:15 PM by dono

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

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.
Friday, July 21, 2006 5:13 AM by lorenzo

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

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!
Friday, July 21, 2006 8:41 AM by Philip Stears

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

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.
Saturday, July 22, 2006 4:53 AM by Richard

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

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).

Saturday, July 22, 2006 11:57 AM by davidacoder

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

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!
Saturday, July 22, 2006 12:01 PM by davidacoder

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

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.
Saturday, July 22, 2006 1:34 PM by Peter Ritchie

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

Interesting concept.  What sort of bounds, or limits, where you thinking?

It would have to be really fast to get good adoption.
Tuesday, July 25, 2006 12:00 PM by Ryan Lamansky (Kardax)

# re: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

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
Sunday, September 10, 2006 12:25 PM by Sam Gentile

# New and Notable 110

Welcome new readers! There are a number of great posts that caught my attention today. In addition, I
New Comments to this post are disabled
 
Page view tracker