2013/8/26 Marc Mezzarobba <m...@mezzarobba.net> > Hi, > > Sage happily coerces floating-point numbers (e.g., elements of RR) into > intervals (e.g., elements of RIF), subject to some conditions on the > precision of the source and destination rings. > > The relevant portion of the coercion graph looks like this: > > ( +---> RDF ) > | | > Exact v > real ---> RLF ---> RR > fields | > | v > +---> RIF > > The coercions RLF --> RIF and RLF --> RR --> RIF violate the requirement > that coercions should form a commutative diagram. Right now, it is not > too much of an issue in practice, because coercions X --> RIF are > constructed based on the existing coercions X --> RR and direct > coercions like RLF --> RIF always(?) end up being preferred to variants > going through RR. > > But this is of course pretty fragile to changes in the coercion system. > If a coercion path of the form X --> RR --> RIF is ever chosen for some > exact ring X (whose elements are not exactly representable by elements > of RR!), arithmetic operations between elements of X and intervals will > yield mathematically incorrect results. Besides, things like > > sage: iv = 1 + 2^(-55) + 0. + RIF(1) > sage: iv.lower(), iv.upper() > (2.00000000000000, 2.00000000000000) > > can already make for subtle bugs in the current situation. > > The same issue exists for CC, CIF and friends. > > I see little value in having mixed operations between floating-point > numbers and intervals work automatically, so I would be in favor of > removing the coercions from floating-point rings to interval rings > altogether. What do you think? >
+1 When I use interval arithmetic, I do that because I want a proof that a number is in an interval. But I also know that I can make a mistake of the form of your example above. We can allow explicit conversions both ways, but it makes more sense to me if automatic coercions don't go from RealField to RealIntervalField. > > -- > Marc > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.