develooper Front page | perl.perl6.language | Postings from March 2012

Re: How to make a new operator.

Thread Previous | Thread Next
From:
Jonathan Lang
Date:
March 24, 2012 18:17
Subject:
Re: How to make a new operator.
Message ID:
59399C57-9E1B-451B-8CDA-5064DBB56FF8@gmail.com
On Mar 24, 2012, at 5:26 PM, Damian Conway <damian@conway.org> wrote:

>> Actually, that one works fine in both niecza and rakudo, since those are Rats.
> 
> Oh, that's good to hear.
> 
> It doesn't change my underlying argument however. Any operations
> performed on genuine floats are going to lose precision, and if we're
> using such operations to infer relationships (such as equality or
> sequence) then we ought to take the loss of precision we're causing
> into account when deciding outcomes.
> 
> Which seems to mean either (a) making it a compiletime error to request
> sequence inferences on floats , or (b) comparing the differences and
> quotients within the sequence inference with a larger epsilon (or using
> interval arithmetic).
> 
> Damian

IMHO: if we're going to take loss of precision into account, we should do so explicitly.  I'm a bit rusty, so forgive me if I misuse the terminology: if a number has an epsilon, the epsilon should be attached to it as a trait so that it can be accessed by the program.  This allows all sorts of things, like "close enough" smart-matching and error propagation.  The main question is if Perl should assign a minimum epsilon to all floats by default, or if this should be an "all's fair if you predeclare" type of thing.  
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About