luis, flexaplex: Mark decided he'd take a different approach to the woeful inadequacy of computers' floating point capabilities. While it is true that most languages cannot correctly compare fifths/tenths added together (it is a repeating decimal in binary and therefore can not be represented in a single string of bits of any size), or that sin(pi) == 0 (it's actually 1.2246063538223773e-16), Mark decided that GM should have that capability. That being the case, he made his comparison operators not compare the entire double.
If GM evaluates 1.0000000000001 > 1 as false, Mark is an idiot. ENIGMA will evaluate 1.0000000000001 > 1 and 1.000000000000001 > 1 as true, 1.0000000000000001 > 1 as false. This is because 1.0000000000000001 is simply outside the precision of a floating point value. In actuality, both ENIGMA and GM will store more bits of precision than they check, which is all the solution really needs at this point.
Because of this, I was going to replicate the behavior in ENIGMA by casting to float before comparisons. IEEE tells us that this isn't as simple as just chopping off a large part of the significand, since doubles implement larger exponents as well. But I'm assuming FPUs have a special path just for the occasion.
|