develooper Front page | perl.perl5.porters | Postings from April 2007

Re: [perl #42260] power-of two differences in minus operation

Thread Previous | Thread Next
Andy Dougherty
April 9, 2007 12:21
Re: [perl #42260] power-of two differences in minus operation
Message ID:
On Mon, 9 Apr 2007, Tels wrote:

> Hash: SHA1
> Moin,
> On Monday 09 April 2007 19:00:56 Andy Dougherty wrote:
> > On Sat, 31 Mar 2007, jhh wrote:
> > > Using bignum or bigint does not change the results.
> >
> > That's odd.  You'll have to show us specifically what you're doing.
> > It's probably best if you modify the program below and show what you
> > expect and what you get.  BigInt should work.

> When using "-Mbignum", the diff will be zero, but the printout of $c will be 
> wrong since %0.f is used, which converts the BigInt to a normal floating 
> point value before printing, thus losing bits:

Yes.  I agree.  That's why I said the original poster would have to 
show us specifically what he was doing.

You are also correct that the wrong number is still printed by 
printf("%.0f").  However, the wrong number also was printed with perl5.6 
and that apparently wasn't an important issue for the original poster. 
(Why it didn't matter, I don't know, but then I don't know the full 
context of the original problem.)

    Andy Dougherty

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About