Re: pretty_print bug
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jun 28, 2004
- 477 views
On Sat, 26 Jun 2004 10:17:25 -0700, Robert Craig <guest at RapidEuphoria.com> wrote: >I think Pete Lomax's solution makes sense for your situation. I want to make it clear: that was a quick & dirty answer, not necessarily a good or correct one. I only said "Try" >It requires no changes to pretty_print(). Hmm, see below. >pretty_print() lets you choose a format for numbers that are >in the Euphoria integer() range, and another format for >all other numbers. I don't want to add a third range, i.e. >numbers that are integer-valued but are just outside >Euphoria's 31-bit integers. I have to (reluctantly) agree. Euphoria has 31-bit integers. Try and ignore that and you risk opening up a world of pain. > And I don't want Al Getz's >solution. It would choose a different format for >any huge floating-point number that just happened to be >a mathematical integer. Few people would want their >printouts of large floating-point numbers to occasionally and >unexpectedly flip into a different format. Rob, that *is* a knee-jerk reaction. Al's solution is perfectly fine in terms of pretty_print. I can't see a problem with it anyway ( bar foot-in-the-door for 32-bit integer support ). >It's not my intention to make pretty_print() do all things >for all people. I'm just trying to cover simple, common cases, >and I'm trying to keep the documentation and the code >reasonably short and understandable. Absolutely agree, 100%. >If you want to add >a bell or whistle to pretty_print(), you can copy it >and edit it to your heart's content. Ditto, this is trivial. However, I do want to stress: Anyone bar Rob making changes to Euphoria\include\misc.e\pretty_print() itself I would *STRONGLY* discourage. There is nothing like making such a change to your own machine and then weeks, months, or years later wondering why the same program fails miserably on an apparently identical machine. Editing a *copy* of that file is, of course, fine. Even if 2.5 is looming too close, I see nothing even slightly worrying with the following (though I doubt it will ever help anyone much): if integer(a) then -- By Al Getz 26/5/2004: to print 32-bit ints, make a copy of this -- file, and replace the above line with: -- if a-floor(a)=0 and -#FFFFFFFF<=a and a<=#FFFFFFFF then Regards, Pete