Consider sage: a = RR(pi/4); a 0.785398163397448 sage: b = RealField(100)(arctan(1/2) + arctan(1/3)); b 0.78539816339744830961566084582 sage: a - b 0.000000000000000 sage: a._sub_(b) -3.06161699786838e-17
I don't know that that's an improvement. The problem is that one simply doesn't have the precision in the inputs to make the "higher" precision of the output meaningful. (Really, if you're doing arithmetic that has cancellation like this, you should be working with fixed rather than floating point representations.) Also, -1 to complicating the coercion model even more. On Tue, Oct 7, 2014 at 1:32 PM, Jeroen Demeyer <jdeme...@cage.ugent.be> wrote: > On 2014-10-07 19:03, Volker Braun wrote: >> >> IMHO way too complicated, and too few people understand coercion as it >> is already. I'd rather have one unnecessary rounding than ring >> operations where I can't predict the outcome without reading the source >> first. > > I would argue that the result would be *more* predictable and certainly more > accurate than now. > >> Coercion must always be from higher precision to lower precision, this >> is the only structure-preserving map. > > Sure, my proposal doesn't change this. > > Essentially, my proposal boils down to: when doing an operation on arguments > with differing precisions, *first* do the operation and *then* lower the > precision instead of the other way around. > > > -- > 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/d/optout. -- 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/d/optout.