Re: Formatted printing (D5.1 and D6)
Posted by
Schwab,Wilhelm K on
Mar 26, 2006; 12:33am
URL: https://forum.world.st/Formatted-printing-D5-1-and-D6-tp3378016p3378021.html
Peter,
> Thanks for the quick reply. I have followed the link and tried to use the
> options I want, but it does not seem to work as I expected. I am not after
> anything fancy. I have a table with three columns of floats, and I want to
> print each column in an 8 character field with 4 decimal places. As a test I
> did:
> '%8.4f' sprintfWith: 1.2345
> and I got the answer ' 0.0000'. When I changed the '%8.4f' to '%8.4e', it
> gave the answer '7.8367e-316', and it gave the same answer if I dropped the
> decimal point in the argument and put 12345.
>
> At this point I feel inclined to give up and accept the default output from
> Dolphin, even though I can't get the points to line up!
Have you considered #printOn:decimalPlaces:? Getting the points to line
up correctly might be even more trouble than simply getting the right
number of digits on the right of the decimal point, at least in a
variable pitch font. One way to do it would be to draw the decimal
places and then draw the digits relative to them. Of course, if you
care about alignment, then a fixed pitch font is probably better anyway.
Have a good one,
Bill
--
Wilhelm K. Schwab, Ph.D.
[hidden email]