Re: pretty_print bug

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu