-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Moin,
On Sunday 10 September 2006 14:54, Peter John Acklam via RT wrote:
Show quoted text> Sun Sep 10 08:54:57 2006: Request 21413 was acted upon.
[snip]
Show quoted text> I categorized this as a critical bug since a math module is unreliable,
> and thus for many purposes useless, if the results are so erroneous as
> those below:
>
> Math::BigInt::VERSION is 1.77
> Math::BigFloat::VERSION is 1.51
>
> perl is v5.8.7 built for cygwin-thread-multi-64int
>
> The following works as expected:
>
> $ perl -MMath::BigFloat -wle \
> 'print Math::BigFloat->new(shift)->blsft(0, 10)' -- '31.4159365'
> 31.4159365
>
> The following also works as expected:
>
> $ perl -MMath::BigFloat -wle \
> 'print Math::BigFloat->new(shift)->blsft(1, 10)' -- '31.4159365'
> 314.159365
>
> The following should print '3.14159365':
>
> $ perl -MMath::BigFloat -wle \
> 'print Math::BigFloat->new(shift)->blsft(-1, 10)' -- '31.4159365'
> 3
I do not get why you think that shifting by a "negative" amount is
supported :-D It clearly is not documented to be that way. (I can
understand that you would expect the result, tho)
Show quoted text> The following works fine, sort of, but appends a trailing zero:
>
> $ perl -MMath::BigFloat -wle \
> 'print Math::BigFloat->new(shift)->brsft(0, 10)' -- '31.4159365'
> 31.41593650
Actually, it doesn't.
perl -MMath::BigFloat -wle 'print scalar \
Math::BigFloat->new(shift)->brsft(0, 10)' -- '31.4159365'
The reason is that print calls brsft() in list context, and brsft() does
seem to call bdiv() in list context, too:
sub brsft
{
...
$x->bdiv($n->bpow($y),$a,$p,$r,$y);
}
There probably should be a "scalar" before that call to bdiv.
The "0" is appended due to (from the POD):
=item bdiv
The following will probably not do what you expect:
print $c->bdiv(123.456),"\n";
It prints both quotient and reminder since print works in list
context. Also, bdiv() will modify $c, so be carefull. You probably
want to use
print $c / 123.456,"\n";
print scalar $c->bdiv(123.456),"\n"; # or if you want to modify $c
instead.
:)
Show quoted text> The following should print '3.14159365', but is really screwy
> (note the TWO decimal separators):
>
> $ perl -MMath::BigFloat -wle \
> 'print Math::BigFloat->new(shift)->brsft(1, 10)' -- '31.4159365'
> 3.141593651.4159365
Same "bug" again.
Show quoted text> The following should print '314.159365', but is also screwy:
>
> $ perl -MMath::BigFloat -wle \
> 'print Math::BigFloat->new(shift)->brsft(-1, 10)' -- '31.4159365'
> 3000.02
Same "bug". It returns "300", tho, so shifting by negative amounts could use
some correction.
Negative amounts of shifting should probably either be supported, or
disallowed. They certainly werent expected when I wrote the code.
I do not have much time right now, holidy coming up etc. It might be that I
will not be able to look into these issues before 2006-10-10 :/
(I fixed the scalar issue in my local copy of v1.78, see
http://Bloodgate.com/perl/packages/devel/Math-BigInt-1.78.tar.gz for a
snapshot)
Thank you for your report!
All the best,
Tels
- - --
Signed on Sun Sep 10 15:25:35 2006 with key 0x93B84C15.
Visit my photo gallery at
http://bloodgate.com/photos/
PGP key on
http://bloodgate.com/tels.asc or per email.
"Given enough time, all legal battles in the tech industry will invoke
the DMCA. This generally means that all constructive arguments have
ended." NialScorva's law
- - --
Signed on Sun Sep 10 15:37:28 2006 with key 0x93B84C15.
Visit my photo gallery at
http://bloodgate.com/photos/
PGP key on
http://bloodgate.com/tels.asc or per email.
"Retsina?" - "Ja, Papa?" - "Warp 3." - "Is gut, Papa."
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iQEVAwUBRQQVlncLPEOTuEwVAQI0Kwf+IOhUoTnI4NZRXovuPo1Hn60KkO/rfKk+
8H9voiVYR3Fpw3f3pLGcoEwzRKh9g/OJoFyh9F/eOJ8iEAcE9YSDOZOlgCyp8SOW
con6+EK2Gw6NqqBpGHGYcb5o06nC3cZ5FyO5zFsqp+nGQvDnNaVYBDaqgZDxscWo
bErcod7D9qBraAniHDsimH1Y0DMJ1o+EapqXP/LgP33T8AVNCkqsKuFHiYYGYwXi
tktoEl6wnkO8RpqT2iWrkD31Ox98Vx/jWbrNA3GoBKvgFntBr0D7gBVlDs8Y2Tkw
4xJ1/5a9EVbEO3wWUYonV4f6gxS39gybTTCSOv4iyUYvbOOG4gOJHg==
=sWrR
- -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iQEVAwUBRQQXFncLPEOTuEwVAQLHcAf+MFNYqnf3+JOWNxGfVzEIP4y0CJYOfYYv
m6CT2ZIW7iqkiDSULjercA5xb113yYMdOWGcx3e5nmUu/uLMxyzvTJWB+XMXE+Op
5tb6twPOwW7sc0+xOf7fkR1IRIAx08ESNEKKto/euv8LVkeh/UZXcXTcKRfbNIrr
2+UxUmFB1zaPJ3wVvRSEgDpWHBPhmOE4RFJMzpRvrVQHrCF2hPxyFjthd4F0xv8R
xMBgXKLgKrzvQzt2LWXBYNEts3W05HPCf6kLathJPf+KrQTBbqsIezkdAy8BMNIC
8ORLyuDz3jWJEYSWDid9GmM1ZiwsZ0z/oBajBoxfq2kEc5NV8Q979A==
=9rFL
-----END PGP SIGNATURE-----