-
Notifications
You must be signed in to change notification settings - Fork 60
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
BDouble Operations #19
Comments
Yes, BDouble definitely needs more methods, I will add some stubs and start implementing the missing stuff. |
|
The name also fits better since this project also contains BDouble. But I'm a little bit worried that that the project will get less downloads because most people look for the search term "swift big integer" or "swift bigint" |
That's true, but that is also what the description and tags are for? |
Yeah you're right, I'll change it tomorrow :D |
Great - you should publish the the CocoaPods trunk when you do :) |
Here is some janky scientific notation - suggestions/comments/improvements appreciated. Didn't really want to read this http://kurtstephens.com/files/p372-steele.pdf |
Hi all: I've been playing around with a square root method for a large primes project I'm working on and I'm willing to tackle this request. I've got some feed back requests before I wrap it up:
precondition( n.isPositive() ) Is this the best approach to take, or should I be doing something different? Alternatives - return nil - makes using the function a bit more painful - and you could be introducing further errors down stream - but you avoid the hard break. - invert the number? I really don't like the idea because it's hiding the problem....
Thanks in advance for your advice and direction. -fossfool |
I suppose the |
I need to eat crow. After digging into in the core code, I've realized precision is not like the "normal" precision we're used to associating with floating point variables. It has nothing to do with the actual precision of the underlying value stored in the variable. As I understand it now, precision only comes into play when converting a BDouble to a decimal string representation. Would you agree? Changing the "Global Default" is easy enough, and while you may be looking to be compatible with other libraries, I'd opt for a name which more clearly conveys what it does. For anyone coming across this later, there are two functions used to create a decimal string representation of BDouble: decimalDescription() and decimalExpansion(precisionAfterDecimalPoint: Int), decimalDescription() just passes self.precision to decimalExpansion. The rub is if you do: var x = BDouble(0.0) You get: 0.6667 Precision isn't "sticky." It get's clobbered in the assignment back to x. The precision of the
0.66666666666666666666666666666666666666666666666667 Better yet, use:
// 2/3 Since precision isn't "sticky," I don't think there's much value adding precision to the inits, and would impact initialization times (granted very very negligibly). Further, I think it would be a distraction in equations, and may lead people to actually believing they need to worry about it if they come across you code down the road. |
Currently, yes, When a new
I think normally people only set the However, this brings up a good point that for operations, if a new I don't think an optional precision argument in the initializer would slow down creation too much and could have a default to alleviate some confusion. Some of the current initializers should be convenience initializers as well. I can work on fixing/improving the initializers if we can come to some agreement on a way forward. |
I'm getting, Ambiguous use of operator '+=', when I try x += 2/3. My math is so so calculus back in college 30 years ago, and a lifetime of aviation and computer science kept the basic skills up. Mostly logic and set theory though. I was a CISSP - so I'm interested in the crypto when you go there. Okay back to precision - not used now - would like to "Reserve it" for later use... Got ya. Here's how I've made my code more readable before I realized it wasn't an issue:
Off the top of my head, and thinking in general terms, in other languages I've used a setter property - to get around things like this. Expose a .value property instead of doing an assignment on the entire structure, that could be a way around it.
I did some digging and I ran across this: I haven't worked with them in Swift yet. Let me go read up and review the swift docs. I think it may be what we're looking for. Hey, drop me an email. I've exposed an address on my profile if you want to take this offline while we hash this out. |
You might be interested in |
Pretty much only have modulo left. I finished root in 6a379be |
BDouble
is missing some important functionality. Below are some of things I think should be added:BDouble
also needs full support for theString
initialization method (completed in #20)Also proposing a repository name change to some variant of
BigNumber
The text was updated successfully, but these errors were encountered: