Re: [q-lang-users] Unparse on Rationals
Brought to you by:
agraef
From: Rob H. <hub...@gm...> - 2006-06-22 08:05:48
|
On 22/06/06, Albert Graef <Dr....@t-...> wrote: > John Cowan wrote: > > Rob Hubbard scripsit: > > > >>I wondered whether it would be preferable to present, for example: > >> > >> 3%1 as just 3 > >> The LHS has the advantage of looking like the rational it is > >> The RHS is clearly simpler > > No, I definitely have to oppose this. :) It should be clear to see that > it is a rational number, so 3%1, not 3. For the same reason, a complex > number is unparsed as X+Y*i even if Y is zero. (Currently I do simplify > the case of a zero real part, though, in this case the number would be > printed as just Y*i, but that also makes it clear that it's a complex > number.) Thanks. That was the sort of answer I was after: definite. I was still not certain of the intention behind unparse, i.e. whether just the semantic value should be presented to the user as simply as possible, or whether the type should also be indicated. Clearly it is the latter. > >> 11%5 as 2+1%5 > >> The LHS is simpler this time > >> The magnitude of the RHS more obvious (i.e. that it's "2 and a bit") > > > > I definitely prefer the LHS in this case, because 2+1%5+3+2%5*i is > > completely misleading (or would it be parenthesized by the unparser?) > > Yes the LHS, again. If you need a better format to see the magnitude, > well that's what ratutils::str_mixed is for. Okay. Similarly, thanks. Rob. |