> From: Peter W A Wood > > Mark Waddingham kindly explains how the engine performs > arithmetic in this QCC entry - > http://quality.runrev.com/show_bug.cgi?id=9349
That page states that arithmetic is done on 64-bit floating-point values, which is what I always assumed, and suggests the possibility of going to decimal in the future. I posted this response: "Where decimal arithmetic still fails is when a quotient doesn't have a finite representation. 1/3*3 will always be .99999... to whatever precision the decimal arithmetic is done. "An alternative is to define an 'epsilon' global property, with a default value of something like 1e-15, which says how close numbers must be in order to be considered equal. Comparing a and b could be done by actually comparing (a-b) to (a+b)*epsilon. Allow the user to set epsilon to anything from zero to, say, 0.1." This works for any two positive numbers; negative numbers would work the same, but have their sense reversed. Numbers could be compared to zero, or to numbers of the opposite sign, by comparing their difference to epsilon. What that page doesn't make explicit is whether even intermediate values in calculations are converted to and from strings. Since many numeric values are never needed in their human-readable form (loop counters being the most obvious example), having a way to deal with binary numbers and decimal numbers interchangeably would be a HUGE win. My suggestion was to represent values as the combination of a number and a string, one of which may be missing and only generated whenever something asks for it. A missing number could be represented as a NaN, and a missing string by a null pointer. -- Ciao, Paul D. DeRocco Paul mailto:pdero...@ix.netcom.com _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode