
Nov 6th, 2002, 10:36 AM
#41
PowerPoster
bump because kayjay and I crossed posts

Nov 6th, 2002, 10:36 AM
#42
Frenzied Member
Originally posted by phinds
................anyone has any further quesitons on this subject ... fugeddaboudit !!! I'm sick of the whole thing. I first encounted this problem in about 1963 and I've explained the whole thing .............
1963 Don't think even my mother born then!
Thanx for the time and effort. Though I still don not completely understand I'll make an effort.
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia

Nov 6th, 2002, 10:41 AM
#43
Banned
phinds, take a look at this page :
http://hankfiles.pcvsconsole.com/answer.php?file=454
I dont see any round for converting 5.375

Nov 6th, 2002, 10:43 AM
#44
PowerPoster
Originally posted by nemaroller
These are all good explanations, but still, this code raises questions.... the binary equivalents are still equal..
[/Highlight]
Actually the only way to test Phinds theory (which I am in agreement with) would be to do the conversion in the other direction. You will probably find that you can come up with two different binary numbers that both convert to 1.4.
Thanks for the explanation phinds .. but please dont be hard on someone for questioning 1.4<>1.4 = True

Nov 6th, 2002, 10:54 AM
#45
PowerPoster
I dont see any round for converting 5.375
which is EXACTLY in agreement with my statement.
5.375 is rational in binary, so as I explained, it will not suffer any rounding error.
You keep setting up strawmen to avoid a conclusion that you apparently don't like.
Do the math on 1.4

Nov 6th, 2002, 10:59 AM
#46
Banned
If you do the math on 1.4 yes you do end up with that trailing 1100.
So then the value gets rounded. Right.
The fact remains though that you're still comparing two numbers that would have been rounded the same.
1.4 v 1.4

Nov 6th, 2002, 11:01 AM
#47
I wonder how many charact
Well, obviously Phinds must know what he's talking about...
Its basically the fact that numbers you would think would have an absolute finite value in decimal, like .04, does not mean it is so in binary, because of the way that number system is set up... in fact, 0.4 seems to go on forever in binary when trying to convert that decimal fraction to binary... you just wont get an ending...
The same applies for 1.36..... In my limited runs, it appears only decimal fractional numbers ending with 5, can have a finite representation in binary (.375,.5,.15)

Nov 6th, 2002, 11:02 AM
#48
Member
Here is an example of what's going on. I had to write the program in C to demonstrate. Check out the subtle difference when I dumped the memory where the variables were stored. Then when I print the variables again, they appear equal. In memory, however they are not. The comparison operation checks that all bits are identical. Clearly, these variables appear to hold the same value...and for math calculations it would work fine. But for comparison they are definitely not equal.
f1 = 1.360000
f2 = 0.040000
f3 = 1.400000
f1 + f2 = 1.400000
f1 dump = 0x600000003ff5c28f
f2 dump = 0x400000003fa47ae1
f3 dump = 0x600000003ff66666
f4 dump = 0x6a0000003ff66666
f1 = 1.360000
f2 = 0.040000
f3 = 1.400000
f1 + f2 = 1.400000
Here is the code I ran (for all you C buffs...it's a quick cloodge for a demo.)
Code:
#include <stdio.h>
int main(void)
{
void *temp;
double f1 = 1.36f, f2 = 0.04f;
double f3 = 1.4f;
double f4;
printf("f1 = %f\n", f1);
printf("f2 = %f\n", f2);
printf("f3 = %f\n", f3);
f4 = f1 + f2;
printf("f1 + f2 = %f\n", f4);
temp = &f1;
printf("f1 dump = 0x%x%x\n", *(int*)temp, *(int*)((int)temp + 4));
temp = &f2;
printf("f2 dump = 0x%x%x\n", *(int*)temp, *(int*)((int)temp + 4));
temp = &f3;
printf("f3 dump = 0x%x%x\n", *(int*)temp, *(int*)((int)temp + 4));
temp = &f4;
printf("f4 dump = 0x%x%x\n", *(int*)temp, *(int*)((int)temp + 4));
printf("f1 = %f\n", f1);
printf("f2 = %f\n", f2);
printf("f3 = %f\n", f3);
printf("f1 + f2 = %f\n", f4);
return 0;
}

Nov 6th, 2002, 11:09 AM
#49
I wonder how many charact
Actually, it appears only decimal fractions that are all odd and end with 5, will have a finite representation in binary....
http://www.cs.nmsu.edu/~pfeiffer/cla...otes/base.html
Last edited by nemaroller; Nov 6th, 2002 at 11:14 AM.

Nov 6th, 2002, 11:21 AM
#50
I wonder how many charact
Hell, thats not even true.... I don't know, guess there just isn't a solid rule here....

Nov 6th, 2002, 11:27 AM
#51
I wonder how many charact
But just to cool off this thread... the binary system was initially developed by Gottfried Wilhelm von Leibniz in 1623, but it was discovered the Chineese had actually developed it 700 years earlier.... solid lines are 1's, broken lines are 0's...
http://www.albany.net/~cybernet/Iching.jpg
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
