Skip Menu |
 

This queue is for tickets about the Math-BigRat CPAN distribution.

Report information
The Basics
Id: 121139
Status: resolved
Priority: 0/
Queue: Math-BigRat

People
Owner: Nobody in particular
Requestors: haffread [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 0.2612
  • 0.2611
  • 0.260805
  • 0.2609
  • 0.2610
Fixed in: 0.2613



MIME-Version: 1.0
X-Spam-Status: No, score=-1.334 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, SPF_SOFTFAIL=0.665] autolearn=no
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
content-type: text/plain; charset="utf-8"; format="flowed"
Message-ID: <6d50aa09-b885-4d79-516a-e5bb830b2717 [...] gmail.com>
X-Received: by 10.28.165.13 with SMTP id o13mr689841wme.139.1492245248132; Sat, 15 Apr 2017 01:34:08 -0700 (PDT)
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -1.334
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id DF1402402CD for <cpan-bug+math-bigrat [...] hipster.bestpractical.com>; Sat, 15 Apr 2017 04:34:23 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ouz33jePYI+D for <cpan-bug+math-bigrat [...] hipster.bestpractical.com>; Sat, 15 Apr 2017 04:34:22 -0400 (EDT)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id 91E1724020F for <bug-math-bigrat [...] rt.cpan.org>; Sat, 15 Apr 2017 04:34:22 -0400 (EDT)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 8B0DE11E00D for <bug-math-bigrat [...] rt.cpan.org>; Sat, 15 Apr 2017 01:34:21 -0700 (PDT)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 6EEF411E010 for <bug-math-bigrat [...] rt.cpan.org>; Sat, 15 Apr 2017 01:34:15 -0700 (PDT)
Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 9C8EC11E00D for <bug-math-bigrat [...] rt.cpan.org>; Sat, 15 Apr 2017 01:34:09 -0700 (PDT)
Received: by mail-wm0-f42.google.com with SMTP id o81so6614448wmb.1 for <bug-math-bigrat [...] rt.cpan.org>; Sat, 15 Apr 2017 01:34:09 -0700 (PDT)
Received: from [192.168.0.5] ([2.120.243.113]) by smtp.gmail.com with ESMTPSA id p101sm5475549wrb.64.2017.04.15.01.34.07 for <bug-math-bigrat [...] rt.cpan.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Apr 2017 01:34:07 -0700 (PDT)
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Delivered-To: cpan-bug+math-bigrat [...] hipster.bestpractical.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
Subject: Problem with operator values being changed
Return-Path: <haffread [...] gmail.com>
X-RT-Mail-Extension: math-bigrat
X-Original-To: cpan-bug+math-bigrat [...] hipster.bestpractical.com
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=tlMkntea6czWD5AkCXpaHlIf7yi1zTc8hf2bJTe6r3A=; b=P0Wmt1CzWi3/nJqbyf/ixzNYSaVTF8MNxYZxp+W0AXmqn33sZfoT5UbRTGSDRUp6AX q0ugNHxVCWnrm7JBPDelcUdY2vVer6ghyALZeQ0NjcZKt+LHwK1NjcMsWHWhbOCyaawT Q5Rd4YL9LtXFeTmUHmFDLYCNEAWtYde/Xt1UQYwuDNXXO1cNN10XdAXNJUI3JOcg3RlI r5apJdGdBKIrAFAFAhPHOD66+aqBeDAfJTWJQoW4RI0DI41jlP8YphKN4lvKHhdbFaDx AIo1LVyfBQv4PBvL+KpNxApiUmEmeD4KebFdabtMccKtHjnLtA2lprRzIo5HkEg2a8r5 33sg==
X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=tlMkntea6czWD5AkCXpaHlIf7yi1zTc8hf2bJTe6r3A=; b=ByF+jSUCmwyZ6lD++3moRkfhJqTcnXjmh/epXAetR4gkwhNCCgbUuWs8lslOyLvvXd Hr7NCkTKOQPeDPJjMLLWZRTAOJ2GFVTZ7yMi4EYk/ExElRvnILMe0bVnJonF1SgKWn8M rpslrjU2cJFXOrTykpRSMX3+/IlWw+efoeVHJG4omxrsCOzN6fgIZTQlopAFRY9AtHNr 5DDvPGt3pDLEAniiHVuMsj6CrOPcD+XLPoAtso6eoTrZ3IFFuJBczFVrtLwE5jY5Mn6p NYGs5136r34y+TqtDI2Hyig/eASs8Rx+yu2Pddihdr/7s5360qG0WaJ6//SCCmtoBu/D tpFQ==
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1300_1399 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, NO_URI_HTTPS 0, SINGLE_URI_IN_BODY 0, SPF_PASS 0, URI_WITH_PATH_ONLY 0, WEBMAIL_SOURCE 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HELO_GMAIL 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MOZILLA_USER_AGENT 0, __NO_HTML_TAG_RAW 0, __PHISH_SPEAR_STRUCTURE_1 0, __RDNS_GMAIL 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_NOT_IMG 0, __URI_NO_MAILTO 0, __URI_NS , __URI_WITH_PATH 0, __USER_AGENT 0, __YOUTUBE_RCVD 0, __blackholes.mail-abuse.org_TIMEOUT , __zen.spamhaus.org_ERROR '
Date: Sat, 15 Apr 2017 09:34:07 +0100
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2017.4.15.82117
To: bug-math-bigrat [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Paul Haffenden <haffread [...] gmail.com>
X-GM-Message-State: AN3rC/688Zya+YIFp3sfG2AWlNAnglC6FmHuiNFXPQdbvmTOQ1JLmq4L QUfV7Iee7ER2Pi7Hvgk=
X-RT-Original-Encoding: utf-8
X-RT-Interface: Email
Content-Length: 1279
Download (untitled) / with headers
text/plain 1.2k
Hello, I'm using strawberry perl on windows 7 This is perl 5, version 24, subversion 1 (v5.24.1) built for MSWin32-x86-multi-thread-64int Copyright 1987-2017, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. And I'm having a problem with this little piece of example code, in that $maxpts is getting changed unexpectedly after the multiplication: ============================== use strict; use warnings; use Math::BigRat; sub main { my($pts) = Math::BigRat->new("61/4"); my($maxpts) = Math::BigRat->new("40/1"); print("BigRat varsion: $Math::BigRat::VERSION\n"); my($tmp) = $pts->copy(); print("$tmp $maxpts\n"); $tmp = $tmp * $maxpts; print("$tmp $maxpts\n"); } main(); exit(0); ====================== When I run it I get: BigRat varsion: 0.2612 61/4 40 610 10 But if I change the initial value of $maxpts to '5/1' say, then $maxpts doesn't change after the multiplication. Paul.
MIME-Version: 1.0
In-Reply-To: <6d50aa09-b885-4d79-516a-e5bb830b2717 [...] gmail.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
References: <6d50aa09-b885-4d79-516a-e5bb830b2717 [...] gmail.com>
Content-Type: multipart/mixed; boundary="----------=_1496223199-22938-2"
Message-ID: <rt-4.0.18-22938-1496223199-309.121139-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 536
Download (untitled) / with headers
text/plain 536b
This is a very severe problem. I have added a smaller test script. Using Math::BigRat version 0.2612, it prints: 1..2 # Math::BigRat version is 0.2612 ok 1 not ok 2 # Failed test at t/11a_math_bigrat.t line 16. # got: '1' # expected: '3/2' # Looks like you failed 1 test of 2. Using Math::BigRat version 0.2608, it prints: 1..2 # Math::BigRat version is 0.2612 ok 1 not ok 2 # Failed test at t/11a_math_bigrat.t line 16. # got: '1' # expected: '3/2' # Looks like you failed 1 test of 2. Regards, Martin
MIME-Version: 1.0
Subject: bigrat.t
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Type: application/octet-stream; name="bigrat.t"
Content-Disposition: inline; filename="bigrat.t"
Content-Transfer-Encoding: base64
Content-Length: 278
Download bigrat.t
text/x-perl 278b
#!/usr/bin/perl use strict; use warnings; use Test::More tests => 2; use Math::BigRat; diag('Math::BigRat version is ' . Math::BigRat->VERSION); my $a = Math::BigRat->new('3/2'); my $x = Math::BigRat->new('2/3'); is("$a", "3/2"); my $y = $a; $y = $x * $y; is("$a", "3/2");
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-22938-1496223199-309.121139-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <6d50aa09-b885-4d79-516a-e5bb830b2717 [...] gmail.com> <rt-4.0.18-22938-1496223199-309.121139-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-14274-1496223608-1442.121139-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 112
Download (untitled) / with headers
text/plain 112b
Using Math::BigRat version 0.2608, it prints: 1..2 # Math::BigRat version is 0.2608 ok 1 ok 2 Regards, Martin
MIME-Version: 1.0
Subject: [PATCH] Problem with operator values being changed
In-Reply-To: <6d50aa09-b885-4d79-516a-e5bb830b2717 [...] gmail.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
References: <6d50aa09-b885-4d79-516a-e5bb830b2717 [...] gmail.com>
Content-Type: multipart/mixed; boundary="----------=_1496266583-7074-2"
Message-ID: <rt-4.0.18-7074-1496266582-1232.121139-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 98
I found the problem. The bmul method modified its second argument. I have added a patch. -Martin
MIME-Version: 1.0
Subject: Math-BigRat-0.2612-MHASCH-01.patch
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Type: application/octet-stream; name="Math-BigRat-0.2612-MHASCH-01.patch"
Content-Disposition: inline; filename="Math-BigRat-0.2612-MHASCH-01.patch"
Content-Transfer-Encoding: base64
Content-Length: 1353
diff -Nrup Math-BigRat-0.2612.orig/lib/Math/BigRat.pm Math-BigRat-0.2612/lib/Math/BigRat.pm --- Math-BigRat-0.2612.orig/lib/Math/BigRat.pm 2017-03-01 12:48:14.000000000 +0100 +++ Math-BigRat-0.2612/lib/Math/BigRat.pm 2017-05-31 23:08:10.666505683 +0200 @@ -887,9 +887,9 @@ sub bmul { my $gcd_sq = $LIB -> _gcd($LIB -> _copy($y->{_n}), $x->{_d}); $x->{_n} = $LIB -> _mul(scalar $LIB -> _div($x->{_n}, $gcd_pr), - scalar $LIB -> _div($y->{_n}, $gcd_sq)); + scalar $LIB -> _div($LIB -> _copy($y->{_n}), $gcd_sq)); $x->{_d} = $LIB -> _mul(scalar $LIB -> _div($x->{_d}, $gcd_sq), - scalar $LIB -> _div($y->{_d}, $gcd_pr)); + scalar $LIB -> _div($LIB -> _copy($y->{_d}), $gcd_pr)); # compute new sign $x->{sign} = $x->{sign} eq $y->{sign} ? '+' : '-'; diff -Nrup Math-BigRat-0.2612.orig/t/rt121139.t Math-BigRat-0.2612/t/rt121139.t --- Math-BigRat-0.2612.orig/t/rt121139.t 1970-01-01 01:00:00.000000000 +0100 +++ Math-BigRat-0.2612/t/rt121139.t 2017-05-31 23:09:53.626885108 +0200 @@ -0,0 +1,16 @@ +#!perl + +# check for cpan rt #121139 + +use strict; +use warnings; +use Test::More tests => 2; +use Math::BigRat; + +my $a = Math::BigRat->new('3/2'); +my $x = Math::BigRat->new('2/3'); +is("$a", "3/2"); + +my $y = $a; +$y = $x * $y; +is("$a", "3/2");


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.