Is it possible to make a program that divides to an infinite decimal place? I'm trying to get one to work, but it only goes up to 16 decimal places, then after that, it just gives me 0's.

- 10-17-2005NecroFromHellPossible to make a program that divides to an infinite decimal place?
Is it possible to make a program that divides to an infinite decimal place? I'm trying to get one to work, but it only goes up to 16 decimal places, then after that, it just gives me 0's.

- 10-17-2005sean
Well of course it's possible to write a program that would do that. The problem is that the hardware the program is running on is eventually going to run out of space. But if you want to get as close as possible, you're going to have to define your own date type (probably using a linked list to store an unknown-beforehand amount of data) and write your own code for dividing with said data type. Good luck, but it's probably not worth the effort.

- 10-17-2005squeaker
in fact it is easyer than you think. because the anwser would be zero. if you were to have something like that it would be "infinitly close to zero" and in math infinitly close to X is infact X. a great example 1/3=.333333... 2/3=.66666... and 3/3=.9999... the number .99999.... is infinitly close to 1 and it is one since 9/9 is also equale to one. some one might argue that 1/3 is not equale to .999999.... but it makes no diffrence because .999999... is a rational number and 1 is a rational number. and there is a rule (not sure what it is called) that says between any two diffrent rational numbers there is another diffrent rational number. and you obviously cant fit anything inbetween 1 and .999999... also you cant actualy have and infinite decimal places since you can not quantify infinity. (i hate it when people said this before i understood it but it is true that) infinity is a concept not a number.

- 10-17-2005Ancient DragonQuote:

Originally Posted by**NecroFromHell**

- 10-17-2005Enahs
Not to mention that if it can go to infinity the calculation would never actually finish.

- 10-17-2005seanQuote:

some one might argue that 1/3 is not equale to .999999....

- 10-17-2005Rashakil Fol
If you're just talking about 'dividing,' then you are looking for a rational number datatype. Then you can have infinite decimal numbers represented, in fraction form (only if the decimal is repeating, of course). As long as you avoid square roots, limits of sequences, Functions of Interest, and mainly stick to basic arithmetic, you should be able to represent numbers exactly and do computations with them.

http://www.boost.org/libs/rational/

Any number you want to compute is always possible to represent in a finite amount of space.

Quote:

Originally Posted by**squeaker**

- 10-18-2005NecroFromHell
ok, forget what about the infinity thing, i'm just try to make a program divide any number and keep dividing it for as long as it has enough memory. And if it takes time for the number to be divided, how do i make the program update what's in the window of what it's already got for the answer?

- 10-18-2005squeaker
oh. i see what you mean. you want to know in decimal what for example: 23/27 is. right? well if both numbers are whole numbers eventualy the decimal number will start to repeate. my computer says 23/27 is: 0.043478260869565217391304347826087. this would be writen like this:

_______________________

.0434782608695652173913

because after 913 it starts over with 043478...

hope that helps

Code:

Quote:

some one might argue that 1/3 is not equale to .999999....

If I didn't know what you really meant to type because of context, I would. But either way - try applying your logic to PI.

- 10-18-2005Ancient Dragon
See this thread for doing math with unlimited numeric size (limited by computer RAM and hard driver)

- 10-18-2005MitchellHQuote:

Originally Posted by**squeaker**

- 10-18-2005Brad0407Quote:

Originally Posted by**squeaker**

_ _

1 - .9 = .01

1.00000000000...

- .99999999999....

-----------------------

.000000000...1 - 10-19-2005anonytmouseQuote:

Originally Posted by**MitchellH**

Code:`pi = 3.141592653`

22/7 = 3.142857142

- 10-19-2005Brad0407
I'm not sure who said that you can't divide to an infinite decimal place, but it is not true. You can write a program that will find any decimal place. If you can write and infinite loop then you can work out a program to infinite decimal place. You can't store all the info at the same time because of hardware restraints, but you can't display it all any way so why does that matter? You can at least make it so that the user couldn't tell the difference. I'll write a program to do it and prove you all wrong. I'll be posting again in another hour with the source code to work out the square root of 2 to infinite decimal places.( I might actually wait till tomorrow because I'm kinda tired)

- 10-20-2005Ancient DragonQuote:

Originally Posted by**Brad0407**