heyyy guysss....just trying to make a code to proove .999=1

any ideass?? :))
ty!!

## All 11 Replies

I'm not sure that code can prove it; you're asking the machine to deal with numbers to infinite precision. As soon as you start hitting floating point limits, you can no longer trust the numbers.

.round?

If you want to make 0.999 become 1 then you use ".round ". Else f you want prove it mathematically then try this http://en.wikipedia.org/wiki/Limit_(mathematics). Write your code for this equation. I never try. XD

In my computer it takes 16 iterations from 0.9 to reach floating point limit of accuracy, if you mean that:

``````1 0.99
2 0.999
3 0.9999
4 0.99999
5 0.9999990000000001
6 0.9999999
7 0.9999999900000001
8 0.999999999
9 0.9999999999
10 0.99999999999
11 0.999999999999
12 0.9999999999999001
13 0.99999999999999
14 0.999999999999999
15 0.9999999999999999
16 1.0``````

The code was not in C++, but results should be similar in C++.

Idk if this works but maybe try out using this algebra:

``````1/9 = 0.1111....
9 * 1/9 = 9 * 0.1111
1 = 0.999....``````

See if you get similar result on a computer.

No code can do that..it's a totally crazy idea. I'd love to know if you find a way to do that.

Not sure how you plan to write a program to prove that, since you already know it's false.

No it is True with repeating decimal 9 of infinite precicion see previous post proving it simply and elegantly with 1 / 9 *9 (same could be done with decimal reprecentation of any number with inverse with repeating decimals)

I'm not sure are you looking this?

LHS= .9999*
= ( 1.0 - 0.0*****1 )
= 1.0 - lim[n->infinity] 1/n
= 1.0 - 0
= 0

.: LHS = RHS

so proving this using code is simple. So you need a Automated Theorm Proving
math engine and in font end you can fetch the following rules.

Here's a nice video about it, which I recently stumbled upon.

commented: Good clear maths link +13

I didn't see anything saying that the OP was asking to prove that 0.999<repeating> was equal to 1.0. The OP says, prove that 0.999 (which I interpreted as exactly 0.999 as in 0.999000).

Is this a sinister puzzle given by a computer science teacher or something? If so, I believe I see the trick to it.

The puzzle probably wants you to realize that floating point numbers are typically stored with a mantissa and an exponent. What I believe the puzzle is looking for is you to come up with a floating point representation format where the mantissa doesn't have enough bits to store 0.999 - the closest representation would be 1.0.

commented: Good logic and well writeen answer with a start to solving it +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.