Doug McNutt wrote: > Thinking about what I actually do. . . > > A near equal test of a float ought to be a fractional error based on the > current value of the float. > > $x tested for between $a*(1.0 + $errorfraction) and $a*(1.0 - > $errorfraction) > > If you're dealing with propagation of errors during processing of data the > fractional error is usually the one that's important. Finances might be > different but floating dollars have their own set of problems relating to > representation of decimal fractions.
Half-baked idea here: could we somehow use some dwimmery akin to Whatever magic to provide some meaning to a postfix:<%> operator? Something so that you could say: $x within 5% And it would translate it to: $x within 0.05 * $x ? Something along the lines of: 1. infix:<within> sets Whatever to its lhs while evaluating its rhs 2. postfix:<%> returns the requested percentage of Whatever; if Whatever is undefined, return the requested percentage of 1. -- Jonathan "Dataweaver" Lang