Thanks for all the great responses guys, I'll see if I can answer your questions and cetera now.
Laguana wrote:Essentially rather than storing a bitstring of the number in some base (fixed point numbers) or scientific notation (floating point numbers), you essentially store a way to calculate the number to an arbitrary precision. Operations on the numbers become operations on these functions.
It sounds like you want to keep track of your math symbolically. There are Computer Algebra Systems (the main open source one is Maxima, others you might be familiar with are Maple and Mathematica). Usually, there is some way to link to them from your code. If your needs aren't too sophisticated, a simple, lightweight CAS such as mathomatic
would be worth checking out.
Yeah, this seems like what I wanted. I'll have to check out the links and other things you mentioned when I've more time.
thoughtfully wrote:If you want to roll your own, then yes, functional languages like Haskell are very well suited to the task. Students of functional programming often do a simple CAS as part of their studies.
That seems like it would be interesting to try. I was originally composing this (if composing is a valid word to use there) in C++, though it occurs to me that it's probably not the best language for problems like these.
thoughtfully wrote:If you told us what your exact requirements are, we could help better.
Steax wrote:Yes, it'd be best to know what we're dealing with here. I was under the impression that Anachrome was in need of some sort of precise math, such as for mathematics or physics.
The project I've in mind with this is a base-coversion program (base as in binary) which I want eventually to be able to convert between things like base i +/- 1 or phi or sqrt(2). I'd like it to be able to perform exact conversions (the most relavant thing that comes to mind are radix points and repeating decimals: 1/3 should be interpreted as 0.3(...) or somesuch, and I don't want to have to make a thing which tries to guess if some float (or double) is a repeating decimal or just happens to look like one.
Anyways, I don't know if I'm going about this the wrong way or in a way far more tedious than any of the other ways or something, so if you have any ideas, I'd love to hear them.
(And, though I'm working in C++ right now, I don't have any strong reason to remain with it other than the fact that it's a language I know well and enjoy. Though Haskell was mentioned a couple of times, so I'll definitely have a look into that as well, and possibly others).