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.
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: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.
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 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.
thoughtfully wrote:If you told us what your exact requirements are, we could help better.
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.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.
Yakk wrote:It will tell you that, for every epsilon you try, that sqrt(2)^2 is within epsilon of 1
Users browsing this forum: No registered users and 0 guests