Is there an lossless algorithm for division?

If you store your number as a numerator/denominator pair then, yes, you can make it lossless By that, I mean the number 10 when divided by 3 is stored not as 3.3333333 but instead as the pair {10,3} This means that, when you multiply it by 3 again, it will become 10 Of course, that may not work in all edge cases. You still won't be able to represent irrational numbers like PI or the square root of 2, since they can neither be represented as a finite decimal sequence nor a ratio But, for division only (using rational numbers), I can't conceive of an edge case where it wouldn't work.

If you store your number as a numerator/denominator pair then, yes, you can make it lossless. By that, I mean the number 10, when divided by 3, is stored not as 3.3333333 but instead as the pair {10,3}. This means that, when you multiply it by 3 again, it will become 10.

Of course, that may not work in all edge cases. You still won't be able to represent irrational numbers like PI or the square root of 2, since they can neither be represented as a finite decimal sequence nor a ratio. But, for division only (using rational numbers), I can't conceive of an edge case where it wouldn't work.

Use a arbitrary precision arithmetic library such as the GNU GMP to get "infinite precision" numbers. The library is available at: gmplib.org.

Arbitrary' is not 'infinite', although I'm going to assume you know that since you quoted the offending term :-) I also have a hard time recommending GMP for any robust code since it has the (what I consider fatal for a general purpose library) flaw of just exiting (pulling the rug from underneath you) when it runs out of memory. Granted, that's only likely in the most extreme of cases but, since that's where GMP would be used anyway, I'm not a big fan of it. But it's a viable option for code where you don't mind that sort of behaviour which may well be the case here.

– paxdiablo Mar 25 at 3:23 And, though is is personal experience only, I've always found the MPIR (a GMP fork) folks a lot more amenable to discussion and assistance. YMMV. They also do native Windows as well.

– paxdiablo Mar 25 at 3:27.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions