Raymond: Thanks for the answer, but (for reasons not obvious in that image) it's not a decimal/division problem. I set the variable it was checking to exactly 0.9867 a bit earlier (Technically, later. This whole mod was an experiment in time travel).
In the end, I solved it by adding 0.0133 to the variable and checking if it equaled 1. It went through.
... don't know the result! number is stored in a variable (memory); 1.0/3.0 will be stored in registers, which could be a different size to memory - that is, a different number of bits .. which are unlikely to be the same
Sorry for the dull message - but float equality is dangerous ground.
((why is 1.0/4.0 likely to behave well but 1.0/10.0not? ))
I have given this image my enď̸͍̻̤̠̞̹͖̫̮̮̠͖̙͎̲̣̯̓́ͫ̀͐̑ͥ̊̀ͣ̄ͥͪ̽̀̀͡ͅorsemen͕͎͙͐̒̓̓ͫt̨͔̩͍̮̙͓̣̙ͯ̇̾͌̍̄͊̈̓͜͞ͅ.
Haha! That's pretty intense! I don't think you have to w̏̿̂ͬ͏o̧͈͐ͥͮr̮͌rͪ̆̆̏y̪͍̹̽ͦ͐̇̋̔ though...
I mean, if it started to tä̸̸̲͇̜̞͉̤͖͈͖̭̦̘̻̘͎͙͎̯̜͋̎̐ͯ͑̓̃̃͗͑̏̐͛ͦ͠͡ke over, I'm sure you'd̹͓̗͕͇͓͓ͩͩͪ̉͌ͬ̍ ̩͉̯̺̫̪͖̟̑̔͋̅ṡ̭̿ͧͥ̇̒͑ͨȅ̻͙͙̪̽̾͗̋̇̎̃͗e͕̻̠̬̠̻ͧͫͣ̄ͧͪ̔ͅ signs...
If you d͓̲̞̯̯̝̹̪̭̩͇̹̯̬͇͎ͨ̔̒̈ͦ̓̍̾̂̾̆̀̾ͭ̓ͤ̚͜͢ͅǫ̴͍̩͍̘͓̭̦̣̥̘̮̳̯̫̭̙͙̓͂͗̆̉ͭͨ̊̂̇͝ͅ, then you'd better watch out cuz i̷̧̺̞̲̲̟̱͛̎̊̿́̍͟ṱ̴̫̗̪͙͉̩̘ͥ̈͋͝'̘͎͕̠̪̭͌͛̊̓ͬ̏͊̆͢͝s̲̣̗̪͈̐̎̀͟ c̈̋̈͒͊̂̒̑̎ͪͧͯͪͩ̚͘͠҉̧̞͖̠̗̫̗̦̖͇o̵̶̡̤̖͍̯̟̹̙̼͍̬ͧ̔̋͗ͤ̅͗ͦ́̀̚͢ͅm̴̛̑ͪ̈́̎̄̋̕҉̷̖̞̞̝̟̭̫̞͕̞̤̰̟̦̘ͅi̥̗̜̯̼̠͔͕͎͎̟̳̘̺̺͆̓ͭ̍̓̀̕͜͞͡n̛̛͖̝̰̳̻̱͖̙̣̟̈̓̔̍̿͑̄ͭ̏͂̊ͥ͆̅ͭ̂͑̔g̛̦͖͓͚̯͔̠͍̻̦͈ͭͨ̆͒̉ͫ̐̉ͪ͊͂͐̐͟͢͠ ̴̼̭̦̱̺̰̩̯̙͔̪ͭ̇̉ͨ̈̇̏̃ͮ̈́͊̕͞f̴̴̢̭̩̭̪͍̰͚͖͓̟̠̯͗̀̽̉ô̸̧̳̩͍͕͔͎͚̯̦̲̠ͪ̉ͤ̿ͦ͋̓̾ͭ͊̐̚̕͢r̶͔̹̻̪̜̭̝̪̯̩̻͖̰̦̼̖͊̂̎͂̈́̀̍̀́͡ ̛͚͎̥̼͙͚̭͕̙̃̾͒ͨͤͨ̏͌ͬ̎ͮ̽̃̽̀͘͠y̸͈͎͙̯͚͍̞͓̤̘͈̾ͮ̊͋̓ͤ̿́͢o̧̨̫̖̦̖͈̣̣͒ͯͥͥͨͨ͊͛͜ͅu̡̗̺͇̘̲͉͗̂͑̄͂͊͋͐̈̓ͮ̎͛̿̇̀ͣ̚͟͠͝.̵̡̛̪̥̳̫̠͙̒ͧ̀ͣ̉̈́̍ͭͮͤ̆̋ͮ̔̅̏ ̸̨̠͉͕̫͉̯̙̦̱̱̳͕̼͉̙̣ͥͫͯͫ͒̀ͦ̌͒̑ͮ͊ͪ̀ͣ̊̚̚͘:̽͛͂̈́̉͒̅̀̅̓͋ͣ̚͠҉͏̩̟̗̫̩̗͔̳̹͖̤̥̝̯͈ͅͅ)̧̆̽̿͌ͫ̊̍͆ͬ̓̏̈̎͋̑͊̇̉̿͏̼̟͍̖͠)̴̸̮͖̮̳͍̥̭͚͚̳̗̠̮̳̬͕͚̺ͣͫ̆ͤ̂ͣ̄̏̒͢͡͝)̘̫͎̘̻̮̃ͬͥ̐̏̓ͤ͛̈́̅̚͝͡)̵̛̳̖͈̭̾̀͋ͧ̐̋̅̇͘)̢̰̜̟̤̞̙̹̙̲̃̿̍ͣ̇͊̆̑̓̋̆)̵̥͕̼̮̙͚͙̪͈̜̦̱̭͕̠̣̟͙̓̑̆̈́̇̄ͦͣ̓ͪͥ̅́͒́͟
7 comments
If I write 0.25
then I know the computer can represent this exactly
But, it can not store 0.1 exactly!
((how does it store 0.1 ???))
---
Have just written a small C program:
#include <stdio.h>
int main(int argc, char** argv) {
float a = 0.1;
if (a == 0.1) {
printf("same
");
} else {
printf("differ
");
}
return 0;
}
When I run this it prints 'differ' !!
.. your result may vary ...
((if it differs, change 0.1 to 0.25 in both places
.. this should be the same
))
((hmmn - ok, if I change float to double then 0.1 is same))
---
In the end, I solved it by adding 0.0133 to the variable and checking if it equaled 1. It went through.
In non-language type code
number = 1.0/3.0; ie (1/3)
print "%0.4f" number ==> 0.3333
print "%0.5f" number ==> 0.33333
if (number == 0.3333) {
print "hi"
}
... not going to do anything,
as we know it's not 'really' 0.3333
if (number == 1.0/3.0) {
print "yes"
} else {
print "no"
}
... don't know the result!
number is stored in a variable (memory);
1.0/3.0 will be stored in registers, which could
be a different size to memory
- that is, a different number of bits
.. which are unlikely to be the same
Sorry for the dull message - but float equality is dangerous ground.
((why is 1.0/4.0 likely to behave well
but 1.0/10.0not?
))
As a computer programmer I'll tell you that this is not limited to the construction set.
Cthulu? No. Ia Yog-Sothoth!
[media]http://www.youtube.com/watch?v=KSvsy11PHxM&feature=related[/media]
Haha! That's pretty intense! I don't think you have to w̏̿̂ͬ͏o̧͈͐ͥͮr̮͌rͪ̆̆̏y̪͍̹̽ͦ͐̇̋̔ though...
I mean, if it started to tä̸̸̲͇̜̞͉̤͖͈͖̭̦̘̻̘͎͙͎̯̜͋̎̐ͯ͑̓̃̃͗͑̏̐͛ͦ͠͡ke over, I'm sure you'd̹͓̗͕͇͓͓ͩͩͪ̉͌ͬ̍ ̩͉̯̺̫̪͖̟̑̔͋̅ṡ̭̿ͧͥ̇̒͑ͨȅ̻͙͙̪̽̾͗̋̇̎̃͗e͕̻̠̬̠̻ͧͫͣ̄ͧͪ̔ͅ signs...
If you d͓̲̞̯̯̝̹̪̭̩͇̹̯̬͇͎ͨ̔̒̈ͦ̓̍̾̂̾̆̀̾ͭ̓ͤ̚͜͢ͅǫ̴͍̩͍̘͓̭̦̣̥̘̮̳̯̫̭̙͙̓͂͗̆̉ͭͨ̊̂̇͝ͅ, then you'd better watch out cuz i̷̧̺̞̲̲̟̱͛̎̊̿́̍͟ṱ̴̫̗̪͙͉̩̘ͥ̈͋͝'̘͎͕̠̪̭͌͛̊̓ͬ̏͊̆͢͝s̲̣̗̪͈̐̎̀͟ c̈̋̈͒͊̂̒̑̎ͪͧͯͪͩ̚͘͠҉̧̞͖̠̗̫̗̦̖͇o̵̶̡̤̖͍̯̟̹̙̼͍̬ͧ̔̋͗ͤ̅͗ͦ́̀̚͢ͅm̴̛̑ͪ̈́̎̄̋̕҉̷̖̞̞̝̟̭̫̞͕̞̤̰̟̦̘ͅi̥̗̜̯̼̠͔͕͎͎̟̳̘̺̺͆̓ͭ̍̓̀̕͜͞͡n̛̛͖̝̰̳̻̱͖̙̣̟̈̓̔̍̿͑̄ͭ̏͂̊ͥ͆̅ͭ̂͑̔g̛̦͖͓͚̯͔̠͍̻̦͈ͭͨ̆͒̉ͫ̐̉ͪ͊͂͐̐͟͢͠ ̴̼̭̦̱̺̰̩̯̙͔̪ͭ̇̉ͨ̈̇̏̃ͮ̈́͊̕͞f̴̴̢̭̩̭̪͍̰͚͖͓̟̠̯͗̀̽̉ô̸̧̳̩͍͕͔͎͚̯̦̲̠ͪ̉ͤ̿ͦ͋̓̾ͭ͊̐̚̕͢r̶͔̹̻̪̜̭̝̪̯̩̻͖̰̦̼̖͊̂̎͂̈́̀̍̀́͡ ̛͚͎̥̼͙͚̭͕̙̃̾͒ͨͤͨ̏͌ͬ̎ͮ̽̃̽̀͘͠y̸͈͎͙̯͚͍̞͓̤̘͈̾ͮ̊͋̓ͤ̿́͢o̧̨̫̖̦̖͈̣̣͒ͯͥͥͨͨ͊͛͜ͅu̡̗̺͇̘̲͉͗̂͑̄͂͊͋͐̈̓ͮ̎͛̿̇̀ͣ̚͟͠͝.̵̡̛̪̥̳̫̠͙̒ͧ̀ͣ̉̈́̍ͭͮͤ̆̋ͮ̔̅̏ ̸̨̠͉͕̫͉̯̙̦̱̱̳͕̼͉̙̣ͥͫͯͫ͒̀ͦ̌͒̑ͮ͊ͪ̀ͣ̊̚̚͘:̽͛͂̈́̉͒̅̀̅̓͋ͣ̚͠҉͏̩̟̗̫̩̗͔̳̹͖̤̥̝̯͈ͅͅ)̧̆̽̿͌ͫ̊̍͆ͬ̓̏̈̎͋̑͊̇̉̿͏̼̟͍̖͠)̴̸̮͖̮̳͍̥̭͚͚̳̗̠̮̳̬͕͚̺ͣͫ̆ͤ̂ͣ̄̏̒͢͡͝)̘̫͎̘̻̮̃ͬͥ̐̏̓ͤ͛̈́̅̚͝͡)̵̛̳̖͈̭̾̀͋ͧ̐̋̅̇͘)̢̰̜̟̤̞̙̹̙̲̃̿̍ͣ̇͊̆̑̓̋̆)̵̥͕̼̮̙͚͙̪͈̜̦̱̭͕̠̣̟͙̓̑̆̈́̇̄ͦͣ̓ͪͥ̅́͒́͟
Your trials are not suprising considering that the design and development teams would gather in a swap and chant
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
when the stars were right...