Re: formatting rationals



On 2011-11-29 14:00:22 +0000, Frode V. Fjeld said:

BTW when I said that FORMAT is for human consumption, I should have said
"external consumption", as in anything external to CL itself. So you
might be writing 12499999/12500000 into some file format that only
accepts decimal notation, and for all you know the 0.00000002 difference
is extremely significant.

If I was writing it for consumption of something that dealt with rationals, then I'd print the rational (perhaps in a format whatever will read it understands, in the (rather unlikely) case it's not a/b. If I'm printing for something that expects floats, then that difference is not significant, because that difference *is* float rounding error. If I was printing for something that expects doubles, then I'd presumably have made the effort to coerce to a double.

So I guess there are a couple of remaining cases:
* printing for humans. As I said previously <huge string of digits><interesting couple of digits> is a seriously poor presentation for humans, and there are easy better alternatives.
* printing for something that supports big decimals or some other extended-precision float type. That's not a huge number of applications (and I bet they all deal with rationals as well).

--tim

.



Relevant Pages

  • Re: Table Style Reports
    ... With owner-draw, you can change the ... > Printing is usually much harder, and the issues of printing are comparable to those of ... Perhaps some grid controls have such features built in, ... > tried printing except by writing my own code for a long time. ...
    (microsoft.public.vc.mfc)
  • Re: Table Style Reports
    ... You can also use an owner-draw CListBox, which is a lot easier to use in terms of control ... Printing is usually much harder, and the issues of printing are comparable to those of ... Perhaps some grid controls have such features built in, ... tried printing except by writing my own code for a long time. ...
    (microsoft.public.vc.mfc)
  • Re: Leftover questions for Tony P.
    ... Suzanne takes a wrong-way rhetorical trip and gets lost. ... control" or not or whether they trust and if so how much. ... teaching cursive writing any more, ... so they want to go back to printing. ...
    (talk.origins)
  • Re: Leftover questions for Tony P.
    ... so they want to go back to printing. ... At least they went back to the reading, writing, and arithmetic. ... and how to mix ink. ... There were still a few of those giant tricycles that ...
    (talk.origins)
  • Re: Leftover questions for Tony P.
    ... so they want to go back to printing. ... At least they went back to the reading, writing, and arithmetic. ... school teaches any longer how to sharpen a swan feather before ... and how to mix ink. ...
    (talk.origins)