On 03/25/2012 05:59 AM, David Green wrote:
> On 2012-March-23, at 12:01 am, Damian Conway wrote:
>> [...] we ought to allow for the inevitable loss of significant digits within 
>> the two preliminary division ops, and therefore compare the results with an 
>> suitably larger epsilon.
>> That would not only be computational more justifiable, I suspect it might 
>> also produce more "least surprise". ;-)
> 
> I think that comparisons for floating-point values should take some kind of 
> 'significance' adverb and complain if it's missing.  Having to be explicit 
> makes for the least surprise of all.
> 
>    π == 22/7                   # error
>    π == 22/7 :within(0.002)    # true
>    π == 22/7 :within(0.00002)  # false

Note that neither 22/7 nor 0.002 are floating-point values.

I don't know if the majority of the perl6-language posters have realized
it yet, but both Perl 6 and the its implementations are quite mature
these days. Mature enough that such proposals should be prototyped as
modules, and thoroughly tested on lots of existing code before taken
into consideration for

Niecza supports operator adverbs, and supports them on user-defined
operators, so there's nothing to stop you from trying it.

Cheers,
Moritz

Reply via email to