Skip Menu |
 

This queue is for tickets about the Number-Format CPAN distribution.

Report information
The Basics
Id: 77643
Status: open
Priority: 0/
Queue: Number-Format

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

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



Subject: Non-negative result for negative argument
Download (untitled) / with headers
text/plain 199b
Number::Format seems to have an issue when dealing with negative numbers that are small in magnitude, e.g., perl -MNumber::Format -e 'print Number::Format::format_number(-0.00001,5)."\n";' 1e-05
I think I have a fix for this problem.
Subject: diff-t.txt
Download diff-t.txt
text/plain 488b
--- format_number.t.73 2009-05-05 16:52:50.000000000 -0400 +++ format_number.t 2012-06-09 11:16:54.000000000 -0400 @@ -17,6 +17,7 @@ is(format_number('1.2300', 7, 1), '1.2300000', 'extra zeroes'); is(format_number(.23, 7, 1), '0.2300000', 'leading zero'); is(format_number(-100, 7, 1), '-100.0000000', 'negative with zeros'); +is(format_number(-1e-5, 5), '-1e-05', 'negative scientific'); # # https://rt.cpan.org/Ticket/Display.html?id=40126
Subject: diff-pm.txt
Download diff-pm.txt
text/plain 428b
--- Format.pm.73 2009-09-25 19:47:51.000000000 -0400 +++ Format.pm 2012-06-09 13:36:50.000000000 -0400 @@ -547,7 +547,7 @@ if ($number =~ /^(-?[\d.]+)e([+-]\d+)$/) { # Don't attempt to format numbers that require scientific notation. - return $number; + return ($sign < 0) ? $self->format_negative($number) : $number; } # Split integer and decimal parts of the number and add commas


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.