Skip Menu |

This queue is for tickets about the GDGraph CPAN distribution.

Maintainer(s)' notes

There are plenty of good ideas of what people can do published here on the queue. Turning a patch from the tracker into a pull request is not one of them. In order to get maintainers' attention way more quickier, PR should have at least a sample included. We know it's hard to test images generating software, but it doesn't mean we can not test numbers produced by intermediate algorithms used to generate these images, so either a test or a sample.

Report information
The Basics
Id: 2779
Status: resolved
Priority: 0/
Queue: GDGraph

People
Owner: mverb [...] cpan.org
Requestors: mverb [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Division by 0 error
From: Alexander Hartmaier <Alexander.Hartmaier@DELETED> Date: Tue, 10 Jun 2003 13:17:17 +0200 To: martien.verbruggen@tradingpost.com.au Subject: GD::Graph division by 0 Hi Martien! I've a problem with GD::Graph if all data-points are 0. This line (1661 in version 1.37 of axestype.pm) in '/usr/lib/perl5/site_perl/5.8.0/GD/Graph/axestype.pm' triggers a division by 0: my $ratio = $scale_1 / $scale_2; I've changed it to: my $ratio = ($scale_2 == 0) ? 1 : $scale_1 / $scale_2; Now the graph looks ok and the division by 0 is gone. I don't looked further what $ratio is used for so you may want to change the '1' which is used if $scale_2 is zero to another value. Would be nice if this patch is included in the next CPAN version of GD:: Graph =) Yours sincerly Alexander Hartmaier T-Systems
I can't actually reproduce this bug. I've tried: @data = ( [qw( A B C D E )], [0, 0, 0, 0, 0]); use GD::Graph::bars; my $c = GD::Graph::bars->new(); $c->plot(\@data); But it does not give me the error you describe. There used to be some division by zero errors at some point, but they should have all been fixed earlier. I am not at home, so I can't get at my version control system, but I'm sure that I made at least two reasonable recent changes to fix some problems in that area. Show quoted text
> This line (1661 in version 1.37 of axestype.pm) in ' > /usr/lib/perl5/site_perl/5.8.0/GD/Graph/axestype.pm' triggers a
division by 0: Show quoted text
> > my $ratio = $scale_1 / $scale_2;
The current version is 1.40, but it still contains that line. Since 1.37 there have been two public releases that could have fixed this problem (my CHANGES file isn't entirely a full record). Show quoted text
> I've changed it to: > > my $ratio = ($scale_2 == 0) ? 1 : $scale_1 / $scale_2;
While this fixes the symptoms, it doesn't fit the problem. The _fits_vals_range functions are not supposed to return just zeroes, or identical values for min and max. Could you maybe send me a data set that shows the problem, or confirm that it's still a problem with 1.40? Martien