Re: pretty_print bug
- Posted by Brian Broker <bkb at cnw.com> Jun 26, 2004
- 463 views
Robert Craig wrote: > > Brian Broker wrote: > > > > <font color="#330033"></font> > > <font color="#0000FF">include </font><font color="#330033">misc.e</font> > > <font color="#330033"></font> > > <font color="#0000FF">constant</font> > > <font color="#330033">n = > > {536870912,4294934783,3735928559,2164260736,1073741824,1073741823}</font> > > <font color="#330033"></font> > > <font color="#FF00FF">printf</font><font color="#330033">(1,</font><font > > color="#00A033">"{%x,%x,%x,%x,%x,%x}\n"</font><font color="#330033">,n)</font> > > <font color="#330033">pretty_print(1, n, </font><font > > color="#993333">{</font><font color="#330033">0,2,1,78,</font><font > > color="#00A033">"%x"</font><font color="#993333">} </font><font > > color="#330033">)</font> > > <font color="#330033"></font> > > > > Output: > > {20000000,FFFF80FF,DEADBEEF,80FFFF80,40000000,3FFFFFFF} > > {20000000,4294934783,3735928559,2164260736,1073741824,3FFFFFFF} > > pretty_print() uses integer() (31-bit numbers) to determine if > something is an integer, whereas printf() tries to handle 32-bit > values as well. Quirky, inconsistent, but I don't plan to change it. > > Regards, > Rob Craig > Rapid Deployment Software > <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a> > How quirky, inconsistant, and unfortunate... wrong answer imho. -- B