On Sep 9, 8:28 pm, Yann <yannlaiglecha...@gmail.com> wrote: > Hi, > Just to be sure I understand your proposal, would the following be the > expected behavior? > > sage: RIF(7,123).str() > '0?' > sage:RIF(7,123).str(error_digits=1) > '0?0..2e2' > sage:RIF(7,123).str(error_digits=2) > '0?00..13e1' > sage:RIF(7,123).str(error_digits=3) > '0?007...123' The principle should remain that the moment error_digits>0 the representation should imply an actual enclosing interval, in fact the string should be a possible input to the RIF constructor. Any fixed-point representation is dubious when dealing with bounds that have no significant digits in common, and nonsensical when they are not of the same order of magnitude. Maybe automatically revert to bracket notation as is done for Infinity and NaN. sage: RIF(7,123).str(error_digits=1,style='brackets') [ 7 .. 2e2 ] Moreover, when there is no common correct first digit, not only force bracket notation, but also do not allow error_digits=0.
If someone just must have a single number even though the bounds are terrible, use center(). After all, N() is not allowed for an interval: why should there be other ways of cooking an interval down to a single number without asking the user to be more specific?. Maybe we could supply geometric_center(RIF(1,1e6)) giving 1e3, for same-sign bounds of course. The last case (after changing three dots to two) is what I have in mind, yes. On Sep 9, 8:29 pm, Jason Grout <jason-s...@creativetrax.com> wrote: > I presume negative numbers would be: > > -3.14? is the interval (-3.15, -3.14] > > Is that what you are thinking? Yes. > > What about intervals that span the origin? What about: sage: z=RIF(-0.001,0.002) sage: z.str(error_digits=1) 0.00?-1..2 The minus sign after the question mark is ugly, but I do not see where else it could go. Dirk --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---